AMeng/chefspec-bootstrap

View on GitHub

Showing 6 of 8 total issues

Method map has 72 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def map
      {
        cookbook_file: {
          it: { create_if_missing: IT_CREATE_IF_MISSING },
          expect: { create_if_missing: EXPECT_CREATE_IF_MISSING }
Severity: Major
Found in lib/api_map.rb - About 2 hrs to fix

    Method generate_test_cases has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def generate_test_cases(resources)
          test_cases = []
          resources.each do |resource|
            verbs = resource.instance_variable_get(:@performed_actions)
            if verbs.empty?
    Severity: Minor
    Found in lib/chefspec_bootstrap.rb - About 1 hr to fix

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

          def initialize(recipe, template_file, spec_helper_file, output_file, cookbook_path)
      Severity: Minor
      Found in lib/chefspec_bootstrap.rb - About 35 mins to fix

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

            def setup
              unless File.exist?(@recipe)
                abort "Unable to locate recipe file (#{@recipe})"
              end
        
        
        Severity: Minor
        Found in lib/chefspec_bootstrap.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 get_it_block has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def get_it_block(noun, verb, adjective)
              verb = 'ignore' if verb == :nothing
              it = '%{verb}s the %{adjective} %{noun}'
              noun_readable = noun.to_s.gsub('_', ' ')
              verb_readable = verb.to_s.gsub('_', ' ')
        Severity: Minor
        Found in lib/chefspec_bootstrap.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 generate_test_cases has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def generate_test_cases(resources)
              test_cases = []
              resources.each do |resource|
                verbs = resource.instance_variable_get(:@performed_actions)
                if verbs.empty?
        Severity: Minor
        Found in lib/chefspec_bootstrap.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