class CukeLinter::StepWithTooManyCharactersLinter
A linter that detects steps that are too long
Constants
- DEFAULT_STEP_LENGTH_THRESHOLD
The threshold used if not otherwise configured
Public Instance Methods
configure(options)
click to toggle source
Changes the linting settings on the linter using the provided configuration
# File lib/cuke_linter/linters/step_with_too_many_characters_linter.rb, line 11 def configure(options) @step_length_threshold = options['StepLengthThreshold'] if options['StepLengthThreshold'] end
message()
click to toggle source
The message used to describe the problem that has been found
# File lib/cuke_linter/linters/step_with_too_many_characters_linter.rb, line 25 def message "Step is too long. #{@linted_step_length} characters found (max #{step_length_threshold})" end
rule(model)
click to toggle source
The rule used to determine if a model has a problem
# File lib/cuke_linter/linters/step_with_too_many_characters_linter.rb, line 16 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
Private Instance Methods
step_length_threshold()
click to toggle source
The maximum length allowable of a step
# File lib/cuke_linter/linters/step_with_too_many_characters_linter.rb, line 34 def step_length_threshold @step_length_threshold || DEFAULT_STEP_LENGTH_THRESHOLD end