enkessler/cuke_cataloger

View on GitHub

Showing 15 of 15 total issues

Class UniqueTestCaseTagger has 60 methods (exceeds 20 allowed). Consider refactoring.
Open

  class UniqueTestCaseTagger

    # The pattern of a sub id
    SUB_ID_PATTERN = /^\d+\-\d+$/ # Not a part of the public API. Subject to change at any time.

Severity: Major
Found in lib/cuke_cataloger/unique_test_case_tagger.rb - About 1 day to fix

    File unique_test_case_tagger.rb has 430 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    module CukeCataloger
    
      # A tagger that handles test case cataloging.
      class UniqueTestCaseTagger
    
    
    Severity: Minor
    Found in lib/cuke_cataloger/unique_test_case_tagger.rb - About 6 hrs to fix

      Method scan_for_tagged_tests has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

          def scan_for_tagged_tests(feature_directory, tag_prefix = '@test_case_', id_column_name = 'test_case_id')
            @results = []
            @known_id_tags = {}
      
            configure_id_tag(tag_prefix)
      Severity: Minor
      Found in lib/cuke_cataloger/unique_test_case_tagger.rb - About 1 hr to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Method create_tasks has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

        def self.create_tasks
          desc 'Add unique id tags to tests in the given directory'
          task 'tag_tests', [:directory, :prefix, :row_id, :id_column_name] do |_t, args|
            location = args[:directory] || '.'
            prefix = args[:prefix] || '@test_case_'
      Severity: Minor
      Found in lib/cuke_cataloger/rake_tasks.rb - About 1 hr to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Method create_tasks has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def self.create_tasks
          desc 'Add unique id tags to tests in the given directory'
          task 'tag_tests', [:directory, :prefix, :row_id, :id_column_name] do |_t, args|
            location = args[:directory] || '.'
            prefix = args[:prefix] || '@test_case_'
      Severity: Minor
      Found in lib/cuke_cataloger/rake_tasks.rb - About 1 hr to fix

        Method check_for_malformed_row_tags has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def check_for_malformed_row_tags(test, id_column_name)
              test.examples.each do |example|
                next unless id_column?(example, id_column_name)
        
                example_rows_for(example).each do |row|
        Severity: Minor
        Found in lib/cuke_cataloger/unique_test_case_tagger.rb - About 45 mins to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Method validate_rows has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def validate_rows(test, rule, desired, row_check, id_column_name)
        Severity: Minor
        Found in lib/cuke_cataloger/unique_test_case_tagger.rb - About 35 mins to fix

          Method tag_tests has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def tag_tests(feature_directory, tag_prefix = '@test_case_', explicit_indexes = {}, tag_rows = true, id_column_name = 'test_case_id') # rubocop:disable Metrics/LineLength
          Severity: Minor
          Found in lib/cuke_cataloger/unique_test_case_tagger.rb - About 35 mins to fix

            Method update_value_row has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def update_value_row(file_lines, line_index, row, row_id, id_column_name)
            Severity: Minor
            Found in lib/cuke_cataloger/unique_test_case_tagger.rb - About 35 mins to fix

              Method fill_in_row has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def fill_in_row(file_lines, line_index, row, row_id, id_column_name)
              Severity: Minor
              Found in lib/cuke_cataloger/unique_test_case_tagger.rb - About 35 mins to fix

                Method validate_rows has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    def validate_rows(test, rule, desired, row_check, id_column_name)
                      test.examples.each do |example|
                        next unless id_column?(example, id_column_name)
                
                        example_rows_for(example).each do |row|
                Severity: Minor
                Found in lib/cuke_cataloger/unique_test_case_tagger.rb - About 35 mins to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Method configure_test_suite_model has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    def configure_test_suite_model(feature_directory)
                      @directory = CukeModeler::Directory.new(feature_directory)
                      @model_repo = CQL::Repository.new(@directory)
                
                      @tests = @model_repo.query do
                Severity: Minor
                Found in lib/cuke_cataloger/unique_test_case_tagger.rb - About 25 mins to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Method determine_known_ids has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    def determine_known_ids(feature_directory, tag_prefix = '@test_case_', id_column_name = 'test_case_id')
                      known_ids = []
                
                      found_tagged_objects = scan_for_tagged_tests(feature_directory, tag_prefix, id_column_name)
                                             .collect { |result| result[:object] }
                Severity: Minor
                Found in lib/cuke_cataloger/unique_test_case_tagger.rb - About 25 mins to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                When(/^the existing ids are determined$/) do
                  @directory = CukeModeler::Directory.new(@test_directory)
                
                  args = [@directory.path]
                  args << @tag_prefix if @tag_prefix
                Severity: Minor
                Found in testing/cucumber/step_definitions/action_steps.rb and 1 other location - About 15 mins to fix
                testing/cucumber/step_definitions/action_steps.rb on lines 12..18

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 25.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                When(/^the ids in the test suite are validated$/) do
                  @directory = CukeModeler::Directory.new(@test_directory)
                
                  args = [@directory.path]
                  args << @tag_prefix if @tag_prefix
                Severity: Minor
                Found in testing/cucumber/step_definitions/action_steps.rb and 1 other location - About 15 mins to fix
                testing/cucumber/step_definitions/action_steps.rb on lines 31..36

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 25.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Severity
                Category
                Status
                Source
                Language