ifad/vacman_controller

View on GitHub

Showing 140 of 145 total issues

Class has too many lines. [158/100]
Open

    class Properties
      class << self
        # Gets the available token property names
        #
        def names

This cop checks if the length a class exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Method has too many lines. [59/10]
Open

        def read_cast(property, value)
          # Short-circuit on 'NA'
          return nil if value == 'NA' or value == 'DISABLE'

          case property

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Method has too many lines. [49/10]
Open

        def write_cast!(property, value)
          case property
            # Bounded integer values
          when 'last_time_used'
            write_check_bounds! property, value,

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Cyclomatic complexity for write_cast! is too high. [18/6]
Open

        def write_cast!(property, value)
          case property
            # Bounded integer values
          when 'last_time_used'
            write_check_bounds! property, value,

This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.

Cyclomatic complexity for read_cast is too high. [14/6]
Open

        def read_cast(property, value)
          # Short-circuit on 'NA'
          return nil if value == 'NA' or value == 'DISABLE'

          case property

This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.

Assignment Branch Condition size for write_cast! is too high. [22.02/15]
Open

        def write_cast!(property, value)
          case property
            # Bounded integer values
          when 'last_time_used'
            write_check_bounds! property, value,

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Class Token has 21 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Token
    # Opens the given dpx_filename with the given transport key and,
    # if successful, returns Token instances for all tokens in the
    # DPX file.
    #
Severity: Minor
Found in lib/vacman_controller/token.rb - About 2 hrs to fix

    Perceived complexity for write_cast! is too high. [11/7]
    Open

            def write_cast!(property, value)
              case property
                # Bounded integer values
              when 'last_time_used'
                write_check_bounds! property, value,

    This cop tries to produce a complexity score that's a measure of the complexity the reader experiences when looking at a method. For that reason it considers when nodes as something that doesn't add as much complexity as an if or a &&. Except if it's one of those special case/when constructs where there's no expression after case. Then the cop treats it as an if/elsif/elsif... and lets all the when nodes count. In contrast to the CyclomaticComplexity cop, this cop considers else nodes as adding complexity.

    Example:

    def my_method                   # 1
      if cond                       # 1
        case var                    # 2 (0.8 + 4 * 0.2, rounded)
        when 1 then func_one
        when 2 then func_two
        when 3 then func_three
        when 4..10 then func_other
        end
      else                          # 1
        do_something until a && b   # 2
      end                           # ===
    end                             # 7 complexity points

    Perceived complexity for read_cast is too high. [8/7]
    Open

            def read_cast(property, value)
              # Short-circuit on 'NA'
              return nil if value == 'NA' or value == 'DISABLE'
    
              case property

    This cop tries to produce a complexity score that's a measure of the complexity the reader experiences when looking at a method. For that reason it considers when nodes as something that doesn't add as much complexity as an if or a &&. Except if it's one of those special case/when constructs where there's no expression after case. Then the cop treats it as an if/elsif/elsif... and lets all the when nodes count. In contrast to the CyclomaticComplexity cop, this cop considers else nodes as adding complexity.

    Example:

    def my_method                   # 1
      if cond                       # 1
        case var                    # 2 (0.8 + 4 * 0.2, rounded)
        when 1 then func_one
        when 2 then func_two
        when 3 then func_three
        when 4..10 then func_other
        end
      else                          # 1
        do_something until a && b   # 2
      end                           # ===
    end                             # 7 complexity points

    Align the parameters of a method call if they span more than one line.
    Open

                  [1, 364]

    Here we check if the parameters on a multi-line method call or definition are aligned.

    Example: EnforcedStyle: withfirstparameter (default)

    # good
    
    foo :bar,
        :baz
    
    # bad
    
    foo :bar,
      :baz

    Example: EnforcedStyle: withfixedindentation

    # good
    
    foo :bar,
      :baz
    
    # bad
    
    foo :bar,
        :baz

    Use empty lines between method definitions.
    Open

            def read_cast(property, value)

    This cop checks whether method definitions are separated by one empty line.

    NumberOfEmptyLines can be and integer (e.g. 1 by default) or an array (e.g. [1, 2]) to specificy a minimum and a maximum of empty lines.

    AllowAdjacentOneLineDefs can be used to configure is adjacent one line methods definitions are an offense

    Example:

    # bad
    def a
    end
    def b
    end

    Example:

    # good
    def a
    end
    
    def b
    end

    Extra blank line detected.
    Open

    
          # Get a Token property

    This cops checks for two or more consecutive blank lines.

    Example:

    # bad - It has two empty lines.
    some_method
    # one empty line
    # two empty lines
    some_method
    
    # good
    some_method
    # one empty line
    some_method

    Extra blank line detected.
    Open

    
            # Maps the given property value to a Ruby value for:

    This cops checks for two or more consecutive blank lines.

    Example:

    # bad - It has two empty lines.
    some_method
    # one empty line
    # two empty lines
    some_method
    
    # good
    some_method
    # one empty line
    some_method

    Line is too long. [84/80]
    Open

            @_property_names ||= VacmanController::LowLevel.kernel_property_names.freeze
    Severity: Minor
    Found in lib/vacman_controller/kernel.rb by rubocop

    Extra blank line detected.
    Open

    
        # Resets error count and time window
    Severity: Minor
    Found in lib/vacman_controller/token.rb by rubocop

    This cops checks for two or more consecutive blank lines.

    Example:

    # bad - It has two empty lines.
    some_method
    # one empty line
    # two empty lines
    some_method
    
    # good
    some_method
    # one empty line
    some_method

    Extra blank line detected.
    Open

    
        # Forces PIN change on this token
    Severity: Minor
    Found in lib/vacman_controller/token.rb by rubocop

    This cops checks for two or more consecutive blank lines.

    Example:

    # bad - It has two empty lines.
    some_method
    # one empty line
    # two empty lines
    some_method
    
    # good
    some_method
    # one empty line
    some_method

    Extra blank line detected.
    Open

    
        # Set both primary and backup application enabled status
    Severity: Minor
    Found in lib/vacman_controller/token.rb by rubocop

    This cops checks for two or more consecutive blank lines.

    Example:

    # bad - It has two empty lines.
    some_method
    # one empty line
    # two empty lines
    some_method
    
    # good
    some_method
    # one empty line
    some_method

    Extra blank line detected.
    Open

    
        # Returns a +Token::Properties+ object giving low-level access to the
    Severity: Minor
    Found in lib/vacman_controller/token.rb by rubocop

    This cops checks for two or more consecutive blank lines.

    Example:

    # bad - It has two empty lines.
    some_method
    # one empty line
    # two empty lines
    some_method
    
    # good
    some_method
    # one empty line
    some_method

    Do not prefix writer method names with set_.
    Open

        def set_pin(pin)
    Severity: Minor
    Found in lib/vacman_controller/token.rb by rubocop

    This cop makes sure that accessor methods are named properly.

    Example:

    # bad
    def set_attribute(value)
    end
    
    # good
    def attribute=(value)
    end
    
    # bad
    def get_attribute
    end
    
    # good
    def attribute
    end

    Keep a blank line before and after protected.
    Open

          protected

    Access modifiers should be surrounded by blank lines.

    Example:

    # bad
    class Foo
      def bar; end
      private
      def baz; end
    end
    
    # good
    class Foo
      def bar; end
    
      private
    
      def baz; end
    end
    Severity
    Category
    Status
    Source
    Language