schubergphilis/vagrant-chef-zero

View on GitHub

Showing 7 of 9 total issues

Method finalize! has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

      def finalize!
        @enabled = true if @enabled == UNSET_VALUE
        @roles = nil if @roles == UNSET_VALUE
        @roles = expand_paths(@roles) if @roles
        @environments = nil if @environments == UNSET_VALUE
Severity: Minor
Found in lib/vagrant-chef-zero/config.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 select_cookbooks has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

        def select_cookbooks(path)
          cookbook_paths = []
          if path.nil?
            cookbook_paths = []
          elsif path.respond_to?('empty?') && path.empty?
Severity: Minor
Found in lib/vagrant-chef-zero/action/upload.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 chef_repo_path= has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

      def chef_repo_path=(path)
        @chef_repo_path = File.expand_path(path)
        @roles = path_exists?("#{path}/roles") ? "#{path}/roles" : nil
        @environments = path_exists?("#{path}/environments") ? "#{path}/environments" : nil
        @nodes = path_exists?("#{path}/nodes") ? "#{path}/nodes" : nil
Severity: Minor
Found in lib/vagrant-chef-zero/config.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 upload_data_bags has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

        def upload_data_bags(env)
          path = env[:machine].config.chef_zero.data_bags
          if path && path.is_a?(String) && File.directory?(path)
            data_bags = Dir.glob("#{path}/*").select{|d| File.directory? d}

Severity: Minor
Found in lib/vagrant-chef-zero/action/upload.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 select_items has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

        def select_items(path)
          if path.nil?
            path = []
          elsif path.respond_to?('empty?') && path.empty?
            path = []
Severity: Minor
Found in lib/vagrant-chef-zero/action/upload.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 upload_roles has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def upload_roles(env)
          path = env[:machine].config.chef_zero.roles
          existing_roles = @conn.role.all

          roles = select_items(path)
Severity: Minor
Found in lib/vagrant-chef-zero/action/upload.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 upload_environments has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def upload_environments(env)
          path = env[:machine].config.chef_zero.environments
          existing_envs = @conn.environment.all

          environments = select_items(path)
Severity: Minor
Found in lib/vagrant-chef-zero/action/upload.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