enkessler/cuke_modeler

View on GitHub

Showing 37 of 37 total issues

Class Gherkin9Adapter has 25 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Gherkin9Adapter < GherkinBaseAdapter

    # Adapts the given AST into the shape that this gem expects
    def adapt(ast)
      adapted_ast = {}
Severity: Minor
Found in lib/cuke_modeler/adapters/gherkin_9_adapter.rb - About 2 hrs to fix

    Class Gherkin20Adapter has 23 methods (exceeds 20 allowed). Consider refactoring.
    Open

      class Gherkin20Adapter < GherkinBaseAdapter
    
        # Adapts the given AST into the shape that this gem expects
        def adapt(ast)
          adapted_ast = {}
    Severity: Minor
    Found in lib/cuke_modeler/adapters/gherkin_20_adapter.rb - About 2 hrs to fix

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

          def adapt_rule(rule_ast)
            adapted_rule = {}
      
            # Saving off the original data and removing parsed data for child elements in order to avoid duplicating data
            save_original_data(adapted_rule, rule_ast)
      Severity: Major
      Found in lib/cuke_modeler/adapters/gherkin_9_adapter.rb and 1 other location - About 1 hr to fix
      lib/cuke_modeler/adapters/gherkin_9_adapter.rb on lines 54..70

      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 71.

      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

          def adapt_background(background_ast)
            adapted_background = {}
      
            # Saving off the original data and removing parsed data for child elements in order to avoid duplicating data
            save_original_data(adapted_background, background_ast)
      Severity: Major
      Found in lib/cuke_modeler/adapters/gherkin_9_adapter.rb and 1 other location - About 1 hr to fix
      lib/cuke_modeler/adapters/gherkin_9_adapter.rb on lines 74..90

      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 71.

      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

          def adapt_scenario(test_ast)
            adapted_scenario = {}
      
            # Saving off the original data and removing parsed data for child elements in order to avoid duplicating data
            save_original_data(adapted_scenario, test_ast)
      Severity: Major
      Found in lib/cuke_modeler/adapters/gherkin_20_adapter.rb and 1 other location - About 1 hr to fix
      lib/cuke_modeler/adapters/gherkin_20_adapter.rb on lines 73..91

      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 65.

      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

          def adapt_rule(rule_ast)
            adapted_rule = {}
      
            # Saving off the original data and removing parsed data for child elements in order to avoid duplicating data
            save_original_data(adapted_rule, rule_ast)
      Severity: Major
      Found in lib/cuke_modeler/adapters/gherkin_20_adapter.rb and 1 other location - About 1 hr to fix
      lib/cuke_modeler/adapters/gherkin_20_adapter.rb on lines 95..113

      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 65.

      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

      Method to_s has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          def to_s
            text = ''
      
            text << "#{tag_output_string}\n" unless tags.empty?
            text << "#{@keyword}:#{name_output_string}"
      Severity: Minor
      Found in lib/cuke_modeler/models/outline.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 to_s has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          def to_s
            text = ''
      
            text << "#{tag_output_string}\n" unless tags.empty?
            text << "#{@keyword}:#{name_output_string}"
      Severity: Minor
      Found in lib/cuke_modeler/models/example.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

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

                def parsing_method(source_text, filename)
                  messages = Gherkin.from_source(filename,
                                                 source_text,
                                                 { include_gherkin_document: true })
                                    .to_a.map(&:to_hash)
      Severity: Major
      Found in lib/cuke_modeler/parsing.rb and 1 other location - About 1 hr to fix
      lib/cuke_modeler/parsing.rb on lines 153..166

      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 49.

      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

                def parsing_method(source_text, filename)
                  messages = Gherkin.from_source(filename,
                                                 source_text,
                                                 { include_gherkin_document: true })
                                    .to_a.map(&:to_hash)
      Severity: Major
      Found in lib/cuke_modeler/parsing.rb and 1 other location - About 1 hr to fix
      lib/cuke_modeler/parsing.rb on lines 136..149

      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 49.

      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

      Method to_s has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def to_s
            text = ''
      
            text << "#{tag_output_string}\n" unless tags.empty?
            text << "#{@keyword}:#{name_output_string}"
      Severity: Minor
      Found in lib/cuke_modeler/models/scenario.rb - About 55 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 to_s has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def to_s
            text = ''
      
            text << "#{tag_output_string}\n" unless tags.empty?
            text << "#{@keyword}:#{name_output_string}"
      Severity: Minor
      Found in lib/cuke_modeler/models/feature.rb - About 55 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

                def parsing_method(source_text, filename)
                  messages = Gherkin.from_source(filename,
                                                 source_text,
                                                 { include_gherkin_document: true })
                                    .to_a.map(&:to_hash)
      Severity: Minor
      Found in lib/cuke_modeler/parsing.rb and 1 other location - About 45 mins to fix
      lib/cuke_modeler/parsing.rb on lines 121..132

      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 41.

      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

                def parsing_method(source_text, filename)
                  messages = Gherkin.from_source(filename,
                                                 source_text,
                                                 { include_gherkin_document: true })
                                    .to_a.map(&:to_hash)
      Severity: Minor
      Found in lib/cuke_modeler/parsing.rb and 1 other location - About 45 mins to fix
      lib/cuke_modeler/parsing.rb on lines 106..117

      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 41.

      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

          def process_source(source_text)
            base_file_string = "# language: #{Parsing.dialect}
            #{dialect_feature_keyword}:
                                  #{dialect_scenario_keyword}:
                                    #{dialect_step_keyword} step\n"
      Severity: Minor
      Found in lib/cuke_modeler/models/table.rb and 1 other location - About 40 mins to fix
      lib/cuke_modeler/models/doc_string.rb on lines 68..77

      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 37.

      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

          def process_source(source_text)
            base_file_string = "# language: #{Parsing.dialect}
            #{dialect_feature_keyword}:
                                  #{dialect_scenario_keyword}:
                                    #{dialect_step_keyword} step\n"
      Severity: Minor
      Found in lib/cuke_modeler/models/doc_string.rb and 1 other location - About 40 mins to fix
      lib/cuke_modeler/models/table.rb on lines 78..87

      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 37.

      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

      Then(/^all of them can be output as text appropriate to the model type$/) do |code_text|
        original_text = code_text
      
        @available_model_classes.each do |clazz|
          code_text = original_text.gsub('<model_class>', clazz.to_s)
      Severity: Minor
      Found in testing/cucumber/step_definitions/verification_steps.rb and 1 other location - About 35 mins to fix
      testing/cucumber/step_definitions/verification_steps.rb on lines 14..23

      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 36.

      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

      Then(/^all of them can provide a custom inspection output$/) do |code_text|
        original_text = code_text
      
        @available_model_classes.each do |clazz|
          code_text = original_text.gsub('<model_class>', clazz.to_s)
      Severity: Minor
      Found in testing/cucumber/step_definitions/verification_steps.rb and 1 other location - About 35 mins to fix
      testing/cucumber/step_definitions/verification_steps.rb on lines 1..10

      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 36.

      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

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

          def clear_child_elements(ast, child_paths)
            # rubocop:disable Security/Eval - This is not blind data
            # rubocop:disable Style/DocumentDynamicEvalDefinition - Nice idea but bad detection ability
            child_paths.each do |traversal_path|
              # Don't add any properties to the object if it didn't already have them
      Severity: Minor
      Found in lib/cuke_modeler/adapters/gherkin_20_adapter.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 to_s has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def to_s
            text = ''
      
            text << "#{tag_output_string}\n" unless tags.empty?
            text << "#{@keyword}:#{name_output_string}"
      Severity: Minor
      Found in lib/cuke_modeler/models/rule.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

      Severity
      Category
      Status
      Source
      Language