ifad/vacman_controller

View on GitHub
lib/vacman_controller/token.rb

Summary

Maintainability
A
2 hrs
Test Coverage

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

    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

    Use empty lines between method definitions.
    Open

        def verify!(otp)
    Severity: Minor
    Found in lib/vacman_controller/token.rb by rubocop

    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

    Use empty lines between method definitions.
    Open

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

    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

    Use empty lines between method definitions.
    Open

        def enable_backup_only!
    Severity: Minor
    Found in lib/vacman_controller/token.rb by rubocop

    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

    
        ####################################################################
    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

    Missing top-level class documentation comment.
    Open

      class Token
    Severity: Minor
    Found in lib/vacman_controller/token.rb by rubocop

    This cop checks for missing top-level documentation of classes and modules. Classes with no body are exempt from the check and so are namespace modules - modules that have nothing in their bodies except classes, other modules, or constant definitions.

    The documentation requirement is annulled if the class or module has a "#:nodoc:" comment next to it. Likewise, "#:nodoc: all" does the same for all its children.

    Example:

    # bad
    class Person
      # ...
    end
    
    # good
    # Description/Explanation of Person class
    class Person
      # ...
    end

    Use empty lines between method definitions.
    Open

        def serial
    Severity: Minor
    Found in lib/vacman_controller/token.rb by rubocop

    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

    
        # Returns the token Application Name
    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

    Use empty lines between method definitions.
    Open

        def to_h
    Severity: Minor
    Found in lib/vacman_controller/token.rb by rubocop

    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

    
        # Same as verify, but raises a VacmanController::Error if OTP verification
    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 this token's PIN
    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

    Use empty lines between method definitions.
    Open

        def activation
    Severity: Minor
    Found in lib/vacman_controller/token.rb by rubocop

    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

    Use empty lines between method definitions.
    Open

        def enable!
    Severity: Minor
    Found in lib/vacman_controller/token.rb by rubocop

    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

    
        # Return the token serial number
    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

    
        # Resets the token error count
    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 the primary 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

    Do not use space inside array brackets.
    Open

          [ ad.fetch('serial').scan(/\d(\d)/).flatten.join, ad.fetch('activation') ]
    Severity: Minor
    Found in lib/vacman_controller/token.rb by rubocop

    Checks that brackets used for array literals have or don't have surrounding space depending on configuration.

    Example: EnforcedStyle: space

    # The `space` style enforces that array literals have
    # surrounding space.
    
    # bad
    array = [a, b, c, d]
    
    # good
    array = [ a, b, c, d ]

    Example: EnforcedStyle: no_space

    # The `no_space` style enforces that array literals have
    # no surrounding space.
    
    # bad
    array = [ a, b, c, d ]
    
    # good
    array = [a, b, c, d]

    Example: EnforcedStyle: compact

    # The `compact` style normally requires a space inside
    # array brackets, with the exception that successive left
    # or right brackets are collapsed together in nested arrays.
    
    # bad
    array = [ a, [ b, c ] ]
    
    # good
    array = [ a, [ b, c ]]

    Line is too long. [83/80]
    Open

          "#<#{self.class.name} serial=#{serial.inspect} app_name=#{app_name.inspect}>"
    Severity: Minor
    Found in lib/vacman_controller/token.rb by rubocop

    Use empty lines between method definitions.
    Open

        def disable_pin!
    Severity: Minor
    Found in lib/vacman_controller/token.rb by rubocop

    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

    Use empty lines between method definitions.
    Open

        def force_pin_change!
    Severity: Minor
    Found in lib/vacman_controller/token.rb by rubocop

    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 empty line detected at module body beginning.
    Open

    
      class Token
    Severity: Minor
    Found in lib/vacman_controller/token.rb by rubocop

    This cops checks if empty lines around the bodies of modules match the configuration.

    Example: EnforcedStyle: empty_lines

    # good
    
    module Foo
    
      def bar
        # ...
      end
    
    end

    Example: EnforcedStyle: emptylinesexcept_namespace

    # good
    
    module Foo
      module Bar
    
        # ...
    
      end
    end

    Example: EnforcedStyle: emptylinesspecial

    # good
    module Foo
    
      def bar; end
    
    end

    Example: EnforcedStyle: noemptylines (default)

    # good
    
    module Foo
      def bar
        # ...
      end
    end

    Extra blank line detected.
    Open

    
        # Returns the token as an hash, that is suitable for passing to
    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

    
        # Verify a password. This is the usecase a user sends you an OTP
    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

    Use empty lines between method definitions.
    Open

        def app_name
    Severity: Minor
    Found in lib/vacman_controller/token.rb by rubocop

    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

    Use empty lines between method definitions.
    Open

        def reset!
    Severity: Minor
    Found in lib/vacman_controller/token.rb by rubocop

    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 empty line detected at module body end.
    Open

    
    end
    Severity: Minor
    Found in lib/vacman_controller/token.rb by rubocop

    This cops checks if empty lines around the bodies of modules match the configuration.

    Example: EnforcedStyle: empty_lines

    # good
    
    module Foo
    
      def bar
        # ...
      end
    
    end

    Example: EnforcedStyle: emptylinesexcept_namespace

    # good
    
    module Foo
      module Bar
    
        # ...
    
      end
    end

    Example: EnforcedStyle: emptylinesspecial

    # good
    module Foo
    
      def bar; end
    
    end

    Example: EnforcedStyle: noemptylines (default)

    # good
    
    module Foo
      def bar
        # ...
      end
    end

    Extra blank line detected.
    Open

    
        # Initialises a Token instance with the given token hash.
    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

    
        # Renders this token in your development console
    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

    Use empty lines between method definitions.
    Open

        def properties
    Severity: Minor
    Found in lib/vacman_controller/token.rb by rubocop

    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

    
        # Sets the "disabled" token 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

    Use empty lines between method definitions.
    Open

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

    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

    
        # Generate an OTP from this token. This does the same as hitting 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

    Extra blank line detected.
    Open

    
        # Set the 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

    Use empty lines between method definitions.
    Open

        def reset_error_count!
    Severity: Minor
    Found in lib/vacman_controller/token.rb by rubocop

    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

    
        # Generate activation data from the token blob and the digipass parameters
    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

    Use empty lines between method definitions.
    Open

        def inspect
    Severity: Minor
    Found in lib/vacman_controller/token.rb by rubocop

    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

    Use empty lines between method definitions.
    Open

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

    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

    Use empty lines between method definitions.
    Open

        def enable_primary_only!
    Severity: Minor
    Found in lib/vacman_controller/token.rb by rubocop

    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

    
        # Disables the PIN 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

    Do not use space inside array brackets.
    Open

          [ ad.fetch('serial').scan(/\d(\d)/).flatten.join, ad.fetch('activation') ]
    Severity: Minor
    Found in lib/vacman_controller/token.rb by rubocop

    Checks that brackets used for array literals have or don't have surrounding space depending on configuration.

    Example: EnforcedStyle: space

    # The `space` style enforces that array literals have
    # surrounding space.
    
    # bad
    array = [a, b, c, d]
    
    # good
    array = [ a, b, c, d ]

    Example: EnforcedStyle: no_space

    # The `no_space` style enforces that array literals have
    # no surrounding space.
    
    # bad
    array = [ a, b, c, d ]
    
    # good
    array = [a, b, c, d]

    Example: EnforcedStyle: compact

    # The `compact` style normally requires a space inside
    # array brackets, with the exception that successive left
    # or right brackets are collapsed together in nested arrays.
    
    # bad
    array = [ a, [ b, c ] ]
    
    # good
    array = [ a, [ b, c ]]

    Use empty lines between method definitions.
    Open

        def generate
    Severity: Minor
    Found in lib/vacman_controller/token.rb by rubocop

    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

    Use empty lines between method definitions.
    Open

        def disable!
    Severity: Minor
    Found in lib/vacman_controller/token.rb by rubocop

    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

    There are no issues that match your filters.

    Category
    Status