enkessler/cuke_cataloger

View on GitHub

Showing 13 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 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 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 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 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 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

                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

                Severity
                Category
                Status
                Source
                Language