wycleffsean/haypub

View on GitHub

Showing 74 of 74 total issues

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

  def coerce(val)
    case val
    when :sun, :sunday
      return 1
    when :mon, :monday
Severity: Minor
Found in lib/payhub/attributes.rb by rubocop

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 coerce is too high. [9/6]
Open

  def coerce(val)
    case val
    when :sun, :sunday
      return 1
    when :mon, :monday
Severity: Minor
Found in lib/payhub/attributes.rb by rubocop

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.

Avoid too many return statements within this method.
Open

      return val
Severity: Major
Found in lib/payhub/attributes.rb - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

          return 5
    Severity: Major
    Found in lib/payhub/attributes.rb - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

            return 6
      Severity: Major
      Found in lib/payhub/attributes.rb - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

              return 7
        Severity: Major
        Found in lib/payhub/attributes.rb - About 30 mins to fix

          Prefer single-quoted strings when you don't need string interpolation or special symbols.
          Open

          require "pry"
          Severity: Minor
          Found in bin/console by rubocop

          Checks if uses of quotes match the configured preference.

          Example: EnforcedStyle: single_quotes (default)

          # bad
          "No special symbols"
          "No string interpolation"
          "Just text"
          
          # good
          'No special symbols'
          'No string interpolation'
          'Just text'
          "Wait! What's #{this}!"

          Example: EnforcedStyle: double_quotes

          # bad
          'Just some text'
          'No special chars or interpolation'
          
          # good
          "Just some text"
          "No special chars or interpolation"
          "Every string in #{project} uses double_quotes"

          Prefer single-quoted strings when you don't need string interpolation or special symbols.
          Open

            spec.authors       = ["Sean Carey"]
          Severity: Minor
          Found in payhub.gemspec by rubocop

          Checks if uses of quotes match the configured preference.

          Example: EnforcedStyle: single_quotes (default)

          # bad
          "No special symbols"
          "No string interpolation"
          "Just text"
          
          # good
          'No special symbols'
          'No string interpolation'
          'Just text'
          "Wait! What's #{this}!"

          Example: EnforcedStyle: double_quotes

          # bad
          'Just some text'
          'No special chars or interpolation'
          
          # good
          "Just some text"
          "No special chars or interpolation"
          "Every string in #{project} uses double_quotes"

          Extra empty line detected at module body end.
          Open

          
            end
          Severity: Minor
          Found in lib/payhub/schedule/monthly.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

          Prefer single-quoted strings when you don't need string interpolation or special symbols.
          Open

            spec.add_dependency "virtus", "~> 1.0.5"
          Severity: Minor
          Found in payhub.gemspec by rubocop

          Checks if uses of quotes match the configured preference.

          Example: EnforcedStyle: single_quotes (default)

          # bad
          "No special symbols"
          "No string interpolation"
          "Just text"
          
          # good
          'No special symbols'
          'No string interpolation'
          'Just text'
          "Wait! What's #{this}!"

          Example: EnforcedStyle: double_quotes

          # bad
          'Just some text'
          'No special chars or interpolation'
          
          # good
          "Just some text"
          "No special chars or interpolation"
          "Every string in #{project} uses double_quotes"

          Extra empty line detected at module body end.
          Open

          
            end
          Severity: Minor
          Found in lib/payhub/schedule/weekly.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

          Prefer single-quoted strings when you don't need string interpolation or special symbols.
          Open

            VERSION = "0.1.0"
          Severity: Minor
          Found in lib/payhub/version.rb by rubocop

          Checks if uses of quotes match the configured preference.

          Example: EnforcedStyle: single_quotes (default)

          # bad
          "No special symbols"
          "No string interpolation"
          "Just text"
          
          # good
          'No special symbols'
          'No string interpolation'
          'Just text'
          "Wait! What's #{this}!"

          Example: EnforcedStyle: double_quotes

          # bad
          'Just some text'
          'No special chars or interpolation'
          
          # good
          "Just some text"
          "No special chars or interpolation"
          "Every string in #{project} uses double_quotes"

          Prefer single-quoted strings when you don't need string interpolation or special symbols.
          Open

            spec.add_development_dependency "pry"
          Severity: Minor
          Found in payhub.gemspec by rubocop

          Checks if uses of quotes match the configured preference.

          Example: EnforcedStyle: single_quotes (default)

          # bad
          "No special symbols"
          "No string interpolation"
          "Just text"
          
          # good
          'No special symbols'
          'No string interpolation'
          'Just text'
          "Wait! What's #{this}!"

          Example: EnforcedStyle: double_quotes

          # bad
          'Just some text'
          'No special chars or interpolation'
          
          # good
          "Just some text"
          "No special chars or interpolation"
          "Every string in #{project} uses double_quotes"

          Missing top-level class documentation comment.
          Open

            class Customer
          Severity: Minor
          Found in lib/payhub/customer.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

          Useless assignment to variable - e.
          Open

          rescue Errno::ENOENT => e
          Severity: Minor
          Found in bin/console by rubocop

          This cop checks for every useless assignment to local variable in every scope. The basic idea for this cop was from the warning of ruby -cw:

          assigned but unused variable - foo

          Currently this cop has advanced logic that detects unreferenced reassignments and properly handles varied cases such as branch, loop, rescue, ensure, etc.

          Example:

          # bad
          
          def some_method
            some_var = 1
            do_something
          end

          Example:

          # good
          
          def some_method
            some_var = 1
            do_something(some_var)
          end

          %q-literals should be delimited by ( and ).
          Open

            spec.description   = %q{simple library for creating payhub bills with ruby}
          Severity: Minor
          Found in payhub.gemspec by rubocop

          This cop enforces the consistent usage of %-literal delimiters.

          Specify the 'default' key to set all preferred delimiters at once. You can continue to specify individual preferred delimiters to override the default.

          Example:

          # Style/PercentLiteralDelimiters:
          #   PreferredDelimiters:
          #     default: '[]'
          #     '%i':    '()'
          
          # good
          %w[alpha beta] + %i(gamma delta)
          
          # bad
          %W(alpha #{beta})
          
          # bad
          %I(alpha beta)

          Dependencies should be sorted in an alphabetical order within their section of the gemspec. Dependency codeclimate-test-reporter should appear before rspec.
          Open

            spec.add_development_dependency "codeclimate-test-reporter"
          Severity: Minor
          Found in payhub.gemspec by rubocop

          Dependencies in the gemspec should be alphabetically sorted.

          Example:

          # bad
          spec.add_dependency 'rubocop'
          spec.add_dependency 'rspec'
          
          # good
          spec.add_dependency 'rspec'
          spec.add_dependency 'rubocop'
          
          # good
          spec.add_dependency 'rubocop'
          
          spec.add_dependency 'rspec'
          
          # bad
          spec.add_development_dependency 'rubocop'
          spec.add_development_dependency 'rspec'
          
          # good
          spec.add_development_dependency 'rspec'
          spec.add_development_dependency 'rubocop'
          
          # good
          spec.add_development_dependency 'rubocop'
          
          spec.add_development_dependency 'rspec'
          
          # bad
          spec.add_runtime_dependency 'rubocop'
          spec.add_runtime_dependency 'rspec'
          
          # good
          spec.add_runtime_dependency 'rspec'
          spec.add_runtime_dependency 'rubocop'
          
          # good
          spec.add_runtime_dependency 'rubocop'
          
          spec.add_runtime_dependency 'rspec'
          
          # good only if TreatCommentsAsGroupSeparators is true
          # For code quality
          spec.add_dependency 'rubocop'
          # For tests
          spec.add_dependency 'rspec'

          Prefer single-quoted strings when you don't need string interpolation or special symbols.
          Open

              spec.metadata['documentation'] = "http://www.rubydoc.info/github/wycleffsean/haypub"
          Severity: Minor
          Found in payhub.gemspec by rubocop

          Checks if uses of quotes match the configured preference.

          Example: EnforcedStyle: single_quotes (default)

          # bad
          "No special symbols"
          "No string interpolation"
          "Just text"
          
          # good
          'No special symbols'
          'No string interpolation'
          'Just text'
          "Wait! What's #{this}!"

          Example: EnforcedStyle: double_quotes

          # bad
          'Just some text'
          'No special chars or interpolation'
          
          # good
          "Just some text"
          "No special chars or interpolation"
          "Every string in #{project} uses double_quotes"

          Use %q only for strings that contain both single quotes and double quotes.
          Open

            spec.summary       = %q{Payhub API gem}
          Severity: Minor
          Found in payhub.gemspec by rubocop

          Missing top-level class documentation comment.
          Open

            class Bill
          Severity: Minor
          Found in lib/payhub/bill.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
          Severity
          Category
          Status
          Source
          Language