piotrmurach/github

View on GitHub
lib/github_api/client/activity/events.rb

Summary

Maintainability
A
3 hrs
Test Coverage

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

    def received(*args)
      arguments(args, required: [:user])
      params = arguments.params

      public_events = if params['public']
Severity: Minor
Found in lib/github_api/client/activity/events.rb and 1 other location - About 45 mins to fix
lib/github_api/client/activity/events.rb on lines 188..199

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

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

    def performed(*args)
      arguments(args, required: [:user])
      params = arguments.params

      public_events = if params['public']
Severity: Minor
Found in lib/github_api/client/activity/events.rb and 1 other location - About 45 mins to fix
lib/github_api/client/activity/events.rb on lines 150..161

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

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

    def repository(*args)
      arguments(args, required: [:user, :repo])

      response = get_request("/repos/#{arguments.user}/#{arguments.repo}/events", arguments.params)
      return response unless block_given?
Severity: Major
Found in lib/github_api/client/activity/events.rb and 20 other locations - About 30 mins to fix
lib/github_api/client/activity/events.rb on lines 64..69
lib/github_api/client/activity/events.rb on lines 89..94
lib/github_api/client/activity/starring.rb on lines 20..25
lib/github_api/client/activity/watching.rb on lines 19..24
lib/github_api/client/issues/assignees.rb on lines 15..20
lib/github_api/client/pull_requests.rb on lines 27..33
lib/github_api/client/repos.rb on lines 423..428
lib/github_api/client/repos.rb on lines 440..445
lib/github_api/client/repos.rb on lines 462..467
lib/github_api/client/repos/branches.rb on lines 24..29
lib/github_api/client/repos/collaborators.rb on lines 24..29
lib/github_api/client/repos/downloads.rb on lines 25..30
lib/github_api/client/repos/forks.rb on lines 22..27
lib/github_api/client/repos/hooks.rb on lines 48..53
lib/github_api/client/repos/invitations.rb on lines 19..24
lib/github_api/client/repos/keys.rb on lines 24..30
lib/github_api/client/repos/releases.rb on lines 31..36
lib/github_api/client/repos/statistics.rb on lines 18..23
lib/github_api/client/repos/statistics.rb on lines 37..42
lib/github_api/client/repos/statistics.rb on lines 81..86

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

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

    def network(*args)
      arguments(args, required: [:user, :repo])

      response = get_request("/networks/#{arguments.user}/#{arguments.repo}/events", arguments.params)
      return response unless block_given?
Severity: Major
Found in lib/github_api/client/activity/events.rb and 20 other locations - About 30 mins to fix
lib/github_api/client/activity/events.rb on lines 40..45
lib/github_api/client/activity/events.rb on lines 64..69
lib/github_api/client/activity/starring.rb on lines 20..25
lib/github_api/client/activity/watching.rb on lines 19..24
lib/github_api/client/issues/assignees.rb on lines 15..20
lib/github_api/client/pull_requests.rb on lines 27..33
lib/github_api/client/repos.rb on lines 423..428
lib/github_api/client/repos.rb on lines 440..445
lib/github_api/client/repos.rb on lines 462..467
lib/github_api/client/repos/branches.rb on lines 24..29
lib/github_api/client/repos/collaborators.rb on lines 24..29
lib/github_api/client/repos/downloads.rb on lines 25..30
lib/github_api/client/repos/forks.rb on lines 22..27
lib/github_api/client/repos/hooks.rb on lines 48..53
lib/github_api/client/repos/invitations.rb on lines 19..24
lib/github_api/client/repos/keys.rb on lines 24..30
lib/github_api/client/repos/releases.rb on lines 31..36
lib/github_api/client/repos/statistics.rb on lines 18..23
lib/github_api/client/repos/statistics.rb on lines 37..42
lib/github_api/client/repos/statistics.rb on lines 81..86

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

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

    def issue(*args)
      arguments(args, required: [:user, :repo])

      response = get_request("/repos/#{arguments.user}/#{arguments.repo}/issues/events", arguments.params)
      return response unless block_given?
Severity: Major
Found in lib/github_api/client/activity/events.rb and 20 other locations - About 30 mins to fix
lib/github_api/client/activity/events.rb on lines 40..45
lib/github_api/client/activity/events.rb on lines 89..94
lib/github_api/client/activity/starring.rb on lines 20..25
lib/github_api/client/activity/watching.rb on lines 19..24
lib/github_api/client/issues/assignees.rb on lines 15..20
lib/github_api/client/pull_requests.rb on lines 27..33
lib/github_api/client/repos.rb on lines 423..428
lib/github_api/client/repos.rb on lines 440..445
lib/github_api/client/repos.rb on lines 462..467
lib/github_api/client/repos/branches.rb on lines 24..29
lib/github_api/client/repos/collaborators.rb on lines 24..29
lib/github_api/client/repos/downloads.rb on lines 25..30
lib/github_api/client/repos/forks.rb on lines 22..27
lib/github_api/client/repos/hooks.rb on lines 48..53
lib/github_api/client/repos/invitations.rb on lines 19..24
lib/github_api/client/repos/keys.rb on lines 24..30
lib/github_api/client/repos/releases.rb on lines 31..36
lib/github_api/client/repos/statistics.rb on lines 18..23
lib/github_api/client/repos/statistics.rb on lines 37..42
lib/github_api/client/repos/statistics.rb on lines 81..86

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

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

    def org(*args)
      arguments(args, required: [:name])

      response = get_request("/orgs/#{arguments.name}/events", arguments.params)
      return response unless block_given?
Severity: Minor
Found in lib/github_api/client/activity/events.rb and 4 other locations - About 20 mins to fix
lib/github_api/client/gists/comments.rb on lines 18..24
lib/github_api/client/orgs/hooks.rb on lines 22..27
lib/github_api/client/orgs/teams.rb on lines 182..187
lib/github_api/client/orgs/teams.rb on lines 338..343

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

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

There are no issues that match your filters.

Category
Status