piotrmurach/github

View on GitHub
lib/github_api/client/git_data/blobs.rb

Summary

Maintainability
A
35 mins
Test Coverage

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

    def create(*args)
      arguments(args, required: [:user, :repo]) do
        permit VALID_BLOB_PARAM_NAMES
        assert_required VALID_BLOB_PARAM_NAMES
      end
Severity: Minor
Found in lib/github_api/client/git_data/blobs.rb and 4 other locations - About 20 mins to fix
lib/github_api/client/git_data/commits.rb on lines 92..98
lib/github_api/client/git_data/tags.rb on lines 86..92
lib/github_api/client/issues/labels.rb on lines 80..86
lib/github_api/client/repos/merging.rb on lines 38..44

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

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

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

      get_request("/repos/#{arguments.user}/#{arguments.repo}/git/blobs/#{arguments.sha}", arguments.params)
Severity: Major
Found in lib/github_api/client/git_data/blobs.rb and 27 other locations - About 15 mins to fix
lib/github_api/client/issues.rb on lines 161..164
lib/github_api/client/issues/comments.rb on lines 140..143
lib/github_api/client/issues/labels.rb on lines 120..123
lib/github_api/client/issues/milestones.rb on lines 66..69
lib/github_api/client/issues/milestones.rb on lines 140..143
lib/github_api/client/orgs/teams.rb on lines 380..383
lib/github_api/client/orgs/teams.rb on lines 400..403
lib/github_api/client/pull_requests.rb on lines 46..49
lib/github_api/client/pull_requests.rb on lines 115..118
lib/github_api/client/pull_requests/comments.rb on lines 121..124
lib/github_api/client/pull_requests/comments.rb on lines 134..137
lib/github_api/client/repos/branches.rb on lines 41..44
lib/github_api/client/repos/collaborators.rb on lines 44..47
lib/github_api/client/repos/collaborators.rb on lines 78..81
lib/github_api/client/repos/comments.rb on lines 56..59
lib/github_api/client/repos/comments.rb on lines 119..122
lib/github_api/client/repos/commits.rb on lines 56..59
lib/github_api/client/repos/contents.rb on lines 73..76
lib/github_api/client/repos/downloads.rb on lines 41..44
lib/github_api/client/repos/downloads.rb on lines 55..58
lib/github_api/client/repos/hooks.rb on lines 64..67
lib/github_api/client/repos/hooks.rb on lines 208..211
lib/github_api/client/repos/invitations.rb on lines 35..38
lib/github_api/client/repos/keys.rb on lines 47..50
lib/github_api/client/repos/keys.rb on lines 97..100
lib/github_api/client/repos/releases.rb on lines 140..143
lib/github_api/client/repos/releases/assets.rb on lines 130..133

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

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