Class: CukeLinter::StepWithTooManyCharactersLinter
- Defined in:
- lib/cuke_linter/linters/step_with_too_many_characters_linter.rb
Overview
A linter that detects steps that are too long
Constant Summary collapse
- DEFAULT_STEP_LENGTH_THRESHOLD =
The threshold used if not otherwise configured
80
Instance Attribute Summary
Attributes inherited from Linter
Instance Method Summary collapse
-
#configure(options) ⇒ Object
Changes the linting settings on the linter using the provided configuration.
-
#message ⇒ Object
The message used to describe the problem that has been found.
-
#rule(model) ⇒ Object
The rule used to determine if a model has a problem.
Methods inherited from Linter
Constructor Details
This class inherits a constructor from CukeLinter::Linter
Instance Method Details
#configure(options) ⇒ Object
Changes the linting settings on the linter using the provided configuration
10 11 12 |
# File 'lib/cuke_linter/linters/step_with_too_many_characters_linter.rb', line 10 def configure() @step_length_threshold = ['StepLengthThreshold'] if ['StepLengthThreshold'] end |
#message ⇒ Object
The message used to describe the problem that has been found
24 25 26 |
# File 'lib/cuke_linter/linters/step_with_too_many_characters_linter.rb', line 24 def "Step is too long. #{@linted_step_length} characters found (max #{step_length_threshold})" end |
#rule(model) ⇒ Object
The rule used to determine if a model has a problem
15 16 17 18 19 20 21 |
# File 'lib/cuke_linter/linters/step_with_too_many_characters_linter.rb', line 15 def rule(model) return false unless model.is_a?(CukeModeler::Step) @linted_step_length = model.text.nil? ? 0 : model.text.length @linted_step_length > step_length_threshold end |