simple-oauth2/simple_oauth2

View on GitHub

Showing 6 of 6 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

  module OAuth2
    module Strategies
      # Resource Owner Password Credentials strategy class. Processes request and respond with Access Token.
      #
      # @see https://tools.ietf.org/html/rfc6749#section-4.3
Severity: Minor
Found in lib/simple_oauth2/strategies/password.rb and 1 other location - About 20 mins to fix
lib/simple_oauth2/strategies/client_credentials.rb on lines 2..34

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 28.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

  module OAuth2
    module Strategies
      # ClientCredentials strategy class. Processes request and respond with Access Token.
      #
      # @see https://tools.ietf.org/html/rfc6749#section-4.4
Severity: Minor
Found in lib/simple_oauth2/strategies/client_credentials.rb and 1 other location - About 20 mins to fix
lib/simple_oauth2/strategies/password.rb on lines 2..34

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 28.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

required_ruby_version (2.2, declared in simple_oauth2.gemspec) and TargetRubyVersion (2.1, declared in .rubocop.yml) should be equal.
Open

  s.required_ruby_version = '>= 2.2.2'
Severity: Minor
Found in simple_oauth2.gemspec by rubocop

Checks that required_ruby_version of gemspec and TargetRubyVersion of .rubocop.yml are equal. Thereby, RuboCop to perform static analysis working on the version required by gemspec.

Example:

# When `TargetRubyVersion` of .rubocop.yml is `2.3`.

# bad
Gem::Specification.new do |spec|
  spec.required_ruby_version = '>= 2.2.0'
end

# bad
Gem::Specification.new do |spec|
  spec.required_ruby_version = '>= 2.4.0'
end

# good
Gem::Specification.new do |spec|
  spec.required_ruby_version = '>= 2.3.0'
end

# good
Gem::Specification.new do |spec|
  spec.required_ruby_version = '>= 2.3'
end

# good
Gem::Specification.new do |spec|
  spec.required_ruby_version = ['>= 2.3.0', '< 2.5.0']
end

Method Simple::OAuth2::Configuration#token_authenticator is defined at both lib/simple_oauth2/configuration.rb:53 and lib/simple_oauth2/configuration.rb:75.
Open

      def token_authenticator(&block)
Severity: Minor
Found in lib/simple_oauth2/configuration.rb by rubocop

This cop checks for duplicated instance (or singleton) method definitions.

Example:

# bad

def duplicated
  1
end

def duplicated
  2
end

Example:

# bad

def duplicated
  1
end

alias duplicated other_duplicated

Example:

# good

def duplicated
  1
end

def other_duplicated
  2
end

Method Simple::OAuth2::Configuration#on_refresh is defined at both lib/simple_oauth2/configuration.rb:66 and lib/simple_oauth2/configuration.rb:104.
Open

      def on_refresh(&block)
Severity: Minor
Found in lib/simple_oauth2/configuration.rb by rubocop

This cop checks for duplicated instance (or singleton) method definitions.

Example:

# bad

def duplicated
  1
end

def duplicated
  2
end

Example:

# bad

def duplicated
  1
end

alias duplicated other_duplicated

Example:

# good

def duplicated
  1
end

def other_duplicated
  2
end

Method Simple::OAuth2::Configuration#resource_owner_authenticator is defined at both lib/simple_oauth2/configuration.rb:56 and lib/simple_oauth2/configuration.rb:85.
Open

      def resource_owner_authenticator(&block)
Severity: Minor
Found in lib/simple_oauth2/configuration.rb by rubocop

This cop checks for duplicated instance (or singleton) method definitions.

Example:

# bad

def duplicated
  1
end

def duplicated
  2
end

Example:

# bad

def duplicated
  1
end

alias duplicated other_duplicated

Example:

# good

def duplicated
  1
end

def other_duplicated
  2
end
Severity
Category
Status
Source
Language