Class: RemLint::Rules::GeneratedFileEdited
- Inherits:
-
RemLint::Rule
- Object
- RemLint::Rule
- RemLint::Rules::GeneratedFileEdited
- Defined in:
- lib/remlint/rules/generated_file_edited.rb
Overview
Hand-written commands in a file a tool owns.
TkRemind appends to its own file; ics2rem and radicale-remind
regenerate theirs from the other side of a sync. A command written into
one of those by hand survives until the next write and then does not, and
in the meantime the file mixes authored and generated state in something
no human is expected to read.
Which files a tool owns is not something the linter can work out, so it is
configured -- GeneratedFiles takes shell globs. With none configured the
rule has nothing to say, which is the honest default rather than a guess
about anybody's layout.
Comments are not reported: a note at the top of a generated file is how people mark it as generated in the first place.
Constant Summary collapse
- GENERATED_TAG =
What the tools write, and so what is not a hand edit. TkRemind tags everything it appends.
/\bTAG\s+"?TKTAG\d+/i
Constants inherited from RemLint::Rule
Instance Attribute Summary
Attributes inherited from RemLint::Rule
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from RemLint::Rule
all, enabled_by_default?, find, inherited, #initialize, rule_name, #rule_name, #run
Constructor Details
This class inherits a constructor from RemLint::Rule
Class Method Details
.default_severity ⇒ Object
27 28 29 |
# File 'lib/remlint/rules/generated_file_edited.rb', line 27 def self.default_severity "warning" end |
.description ⇒ Object
31 32 33 |
# File 'lib/remlint/rules/generated_file_edited.rb', line 31 def self.description "Hand-written commands in a file listed under GeneratedFiles." end |
Instance Method Details
#check ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/remlint/rules/generated_file_edited.rb', line 35 def check patterns = option("GeneratedFiles", []) if !patterns.empty? && generated?(patterns) report end end |