Module: CukeLinter
- Extended by:
- Configuration, LinterRegistration
- Defined in:
- lib/cuke_linter.rb,
lib/cuke_linter/gherkin.rb,
lib/cuke_linter/version.rb,
lib/cuke_linter/configuration.rb,
lib/cuke_linter/linters/linter.rb,
lib/cuke_linter/default_linters.rb,
lib/cuke_linter/linter_registration.rb,
lib/cuke_linter/formatters/pretty_formatter.rb,
lib/cuke_linter/linters/test_with_no_name_linter.rb,
lib/cuke_linter/linters/test_with_bad_name_linter.rb,
lib/cuke_linter/linters/example_without_name_linter.rb,
lib/cuke_linter/linters/feature_without_name_linter.rb,
lib/cuke_linter/linters/step_with_end_period_linter.rb,
lib/cuke_linter/linters/single_test_background_linter.rb,
lib/cuke_linter/linters/element_with_common_tags_linter.rb,
lib/cuke_linter/linters/test_with_no_action_step_linter.rb,
lib/cuke_linter/linters/test_with_too_many_steps_linter.rb,
lib/cuke_linter/linters/feature_without_scenarios_linter.rb,
lib/cuke_linter/linters/element_with_too_many_tags_linter.rb,
lib/cuke_linter/linters/test_should_use_background_linter.rb,
lib/cuke_linter/linters/element_with_duplicate_tags_linter.rb,
lib/cuke_linter/linters/feature_without_description_linter.rb,
lib/cuke_linter/linters/step_with_too_many_characters_linter.rb,
lib/cuke_linter/linters/feature_file_with_invalid_name_linter.rb,
lib/cuke_linter/linters/test_with_no_verification_step_linter.rb,
lib/cuke_linter/linters/background_does_more_than_setup_linter.rb,
lib/cuke_linter/linters/outline_with_single_example_row_linter.rb,
lib/cuke_linter/linters/feature_file_with_mismatched_name_linter.rb,
lib/cuke_linter/linters/test_name_with_too_many_characters_linter.rb,
lib/cuke_linter/linters/test_with_setup_step_as_final_step_linter.rb,
lib/cuke_linter/linters/test_with_action_step_as_final_step_linter.rb,
lib/cuke_linter/linters/feature_with_too_many_different_tags_linter.rb,
lib/cuke_linter/linters/test_with_setup_step_after_action_step_linter.rb,
lib/cuke_linter/linters/test_with_setup_step_after_verification_step_linter.rb
Overview
TODO: Make a new class that it is from the POV of a Feature model instead
Defined Under Namespace
Modules: Configuration, LinterRegistration Classes: BackgroundDoesMoreThanSetupLinter, ElementWithCommonTagsLinter, ElementWithDuplicateTagsLinter, ElementWithTooManyTagsLinter, ExampleWithoutNameLinter, FeatureFileWithInvalidNameLinter, FeatureFileWithMismatchedNameLinter, FeatureWithTooManyDifferentTagsLinter, FeatureWithoutDescriptionLinter, FeatureWithoutNameLinter, FeatureWithoutScenariosLinter, Linter, OutlineWithSingleExampleRowLinter, PrettyFormatter, SingleTestBackgroundLinter, StepWithEndPeriodLinter, StepWithTooManyCharactersLinter, TestNameWithTooManyCharactersLinter, TestShouldUseBackgroundLinter, TestWithActionStepAsFinalStepLinter, TestWithBadNameLinter, TestWithNoActionStepLinter, TestWithNoNameLinter, TestWithNoVerificationStepLinter, TestWithSetupStepAfterActionStepLinter, TestWithSetupStepAfterVerificationStepLinter, TestWithSetupStepAsFinalStepLinter, TestWithTooManyStepsLinter
Constant Summary collapse
- DEFAULT_GIVEN_KEYWORD =
The default keyword that is considered a ‘Given’ keyword
'Given'.freeze
- DEFAULT_WHEN_KEYWORD =
The default keyword that is considered a ‘When’ keyword
'When'.freeze
- DEFAULT_THEN_KEYWORD =
The default keyword that is considered a ‘Then’ keyword
'Then'.freeze
- VERSION =
The release version of this gem
'1.3.0'.freeze
Class Method Summary collapse
-
.lint(file_paths: [], model_trees: [], linters: registered_linters.values, formatters: [[CukeLinter::PrettyFormatter.new]]) ⇒ Object
Lints the given model trees and file paths using the given linting objects and formatting the results with the given formatters and their respective output locations.
Methods included from Configuration
Methods included from LinterRegistration
clear_registered_linters, register_linter, registered_linters, reset_linters, unregister_linter
Class Method Details
.lint(file_paths: [], model_trees: [], linters: registered_linters.values, formatters: [[CukeLinter::PrettyFormatter.new]]) ⇒ Object
Lints the given model trees and file paths using the given linting objects and formatting the results with the given formatters and their respective output locations
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/cuke_linter.rb', line 49 def lint(file_paths: [], model_trees: [], linters: registered_linters.values, formatters: [[CukeLinter::PrettyFormatter.new]]) # rubocop:disable Metrics/LineLength # TODO: Test this? # Because directive memoization is based on a model's `#object_id` and Ruby reuses object IDs over the # life of a program as objects are garbage collected, it is not safe to remember the IDs forever. However, # models shouldn't get GC'd in the middle of the linting process and so the start of the linting process is # a good time to reset things @directives_for_feature_file = {} model_trees = [CukeModeler::Directory.new(Dir.pwd)] if model_trees.empty? && file_paths.empty? file_path_models = collect_file_path_models(file_paths) model_sets = model_trees + file_path_models linting_data = lint_models(model_sets, linters) format_data(formatters, linting_data) linting_data end |