Class: CukeLinter::TestNameWithTooManyCharactersLinter
- Defined in:
- lib/cuke_linter/linters/test_name_with_too_many_characters_linter.rb
Overview
A linter that detects test names that are too long
Constant Summary collapse
- DEFAULT_TEST_NAME_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/test_name_with_too_many_characters_linter.rb', line 10 def configure() @test_name_length_threshold = ['TestNameLengthThreshold'] if ['TestNameLengthThreshold'] end |
#message ⇒ Object
The message used to describe the problem that has been found
24 25 26 |
# File 'lib/cuke_linter/linters/test_name_with_too_many_characters_linter.rb', line 24 def "Scenario name is too long. #{@linted_test_name_length} characters found (max #{test_name_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/test_name_with_too_many_characters_linter.rb', line 15 def rule(model) return false unless model.is_a?(CukeModeler::Scenario) || model.is_a?(CukeModeler::Outline) @linted_test_name_length = model.name.nil? ? 0 : model.name.length @linted_test_name_length > test_name_length_threshold end |