lukaszraczylo/salt-lint

View on GitHub

Showing 8 of 8 total issues

Method check_rules has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

    def self.check_rules(f)
      $invalid_yaml     = Hash.new
      $invalid_newline  = Hash.new
      $invalid_oneword  = Hash.new

Severity: Minor
Found in lib/salt-lint/actions.rb - About 2 hrs 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 act has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def self.act
      # Scanning for files in
      errors = 0
      if $arguments.scan_given
        list_of_files = SaltLint::Actions.scan
Severity: Minor
Found in lib/salt-lint/options.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 check_if_single_word_declaration has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def self.check_if_single_word_declaration(line_number, line, file)
      is_ok = true
      if $arguments.check_single_word
        Printer.print('debug', "Looking for single word declarations in #{file}", 5)
        if line =~ /(pkg|file|service):\n/
Severity: Minor
Found in lib/salt-lint/tests.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 check_rules has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def self.check_rules(f)
      $invalid_yaml     = Hash.new
      $invalid_newline  = Hash.new
      $invalid_oneword  = Hash.new

Severity: Minor
Found in lib/salt-lint/actions.rb - About 1 hr to fix

Method print has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def self.print(msg_type = 'info', message = 'no message specified', debug_level = 0)
    prefix  = nil
    show    = true
    kill    = false
    case msg_type
Severity: Minor
Found in lib/salt-lint/printer.rb - About 1 hr to fix

Method check_for_regexp has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def self.check_for_regexp(line_number, line, file, regex, debug_msg, warning_msg)
Severity: Minor
Found in lib/salt-lint/tests.rb - About 45 mins to fix

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

    def self.check_for_no_newline(line_number, line, file)
      is_ok = true
        if $arguments.check_newlines
        Printer.print('debug', "Checking for no-newline at the end of the file in file #{file}", 5)
        f = File.readlines(file).last
Severity: Minor
Found in lib/salt-lint/tests.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 check_line_length has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def self.check_line_length(line_number, line, file)
      is_ok = true
      if $arguments.check_line_length
        Printer.print('debug', "Checking line length: #{line_number}", 5)
        line.length > 80 ? is_ok = false : nil
Severity: Minor
Found in lib/salt-lint/tests.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