resivalex/my_target_api

View on GitHub

Showing 5 of 5 total issues

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

      def delete(*args)
        RestClient.delete(*args) { |response, &block| process_response(response, &block) }
      rescue RestClient::Exception => e
        raise(Exception.new(e, e.message).tap { e.set_backtrace(caller) })
      end
Severity: Minor
Found in lib/my_target_api/net_client.rb and 2 other locations - About 25 mins to fix
lib/my_target_api/net_client.rb on lines 38..42
lib/my_target_api/net_client.rb on lines 44..48

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 30.

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

Avoid parameter lists longer than 5 parameters. [6/5]
Open

    def raise_with_params(method:, url:, params:, response: nil, content:, original_exception: nil)
Severity: Minor
Found in lib/my_target_api/request.rb by rubocop

This cop checks for methods with too many parameters. The maximum number of parameters is configurable. Keyword arguments can optionally be excluded from the total count.

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

      def get(*args)
        RestClient.get(*args) { |response, &block| process_response(response, &block) }
      rescue RestClient::Exception => e
        raise(Exception.new(e, e.message).tap { e.set_backtrace(caller) })
      end
Severity: Minor
Found in lib/my_target_api/net_client.rb and 2 other locations - About 25 mins to fix
lib/my_target_api/net_client.rb on lines 44..48
lib/my_target_api/net_client.rb on lines 50..54

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 30.

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 3 locations. Consider refactoring.
Open

      def post(*args)
        RestClient.post(*args) { |response, &block| process_response(response, &block) }
      rescue RestClient::Exception => e
        raise(Exception.new(e, e.message).tap { e.set_backtrace(caller) })
      end
Severity: Minor
Found in lib/my_target_api/net_client.rb and 2 other locations - About 25 mins to fix
lib/my_target_api/net_client.rb on lines 38..42
lib/my_target_api/net_client.rb on lines 50..54

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 30.

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

Redundant curly braces around a hash parameter.
Open

      request = AddAccessTokenToRequestDecorator.new(request, { access_token: access_token })
Severity: Minor
Found in lib/my_target_api.rb by rubocop

This cop checks for braces around the last parameter in a method call if the last parameter is a hash. It supports braces, no_braces and context_dependent styles.

Example: EnforcedStyle: braces

# The `braces` style enforces braces around all method
# parameters that are hashes.

# bad
some_method(x, y, a: 1, b: 2)

# good
some_method(x, y, {a: 1, b: 2})

Example: EnforcedStyle: no_braces (default)

# The `no_braces` style checks that the last parameter doesn't
# have braces around it.

# bad
some_method(x, y, {a: 1, b: 2})

# good
some_method(x, y, a: 1, b: 2)

Example: EnforcedStyle: context_dependent

# The `context_dependent` style checks that the last parameter
# doesn't have braces around it, but requires braces if the
# second to last parameter is also a hash literal.

# bad
some_method(x, y, {a: 1, b: 2})
some_method(x, y, {a: 1, b: 2}, a: 1, b: 2)

# good
some_method(x, y, a: 1, b: 2)
some_method(x, y, {a: 1, b: 2}, {a: 1, b: 2})
Severity
Category
Status
Source
Language