This package provides the following services:
linter-dryer
Highlight repetition in Atom to help you stay DRY 🌂
Installation
apm install linter-dryer
Or install it from within Atom by going to Settings → Install and searching for linter-dryer
.
Usage
This package provides “copy–paste detection” for files and projects in Atom, using jscpd
. It will highlight code in the text editor that is repeated elsewhere. You may need to adjust the settings to get results that work well for your specific project.
jscpd
supports a wide range of languages and a full list is available in the jscpd
README.
Settings
Minimum repeating lines
- type:
'integer'
- default:
3
Set how many lines must repeat before they are flagged as a repetition by linter-dryer
.
Minimum repeating code tokens
- type:
'integer'
- default:
25
Code is processed and tokenized by jscpd
in order to find repetitions that are similar but not identical. This sets how many tokens need to match to qualify as a repetition. Values that are too low may produce meaningless output, while values that are too high may not return any results.
Scope to search for repetitions
'file'
OR'project'
- default:
'file'
Set whether the linter should look for repetitions only in the current file, or throughout the current project.
.ignore
files
- type:
'array'
of strings - default:
['.gitignore']
Specify files like .gitignore
or .npmignore
to use in deciding which files linter-dryer should ignore.
Additional ignore patterns
- type:
'array'
of strings - default:
['**/*.min.*']
Files that match any of the patterns set here will be ignored when looking for repetition. (See minimatch
for globbing documentation.) These patterns are applied in addition to rules found in any files set in the .ignore files option.
Repetition severity
'info'
,'warning'
OR'error'
- default:
'info'
Sets how the linter UI highlights repetitions in Atom. By default, a blue “info” level is set, but users can choose to have repetitions highlighted as warnings (orange) or errors (red).
Contributing
All contributions to this package — no matter how small — are welcome! Please see the contribution guidelines for notes on opening issues and submitting pull requests and the code of conduct for rules about how to treat other developers with kindness and respect.