piotrmurach/github

View on GitHub
lib/github_api/client/issues/labels.rb

Summary

Maintainability
A
2 hrs
Test Coverage

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

    def replace(*args)
      arguments(args, required: [:user, :repo, :number])
      params = arguments.params
      params['data'] = arguments.remaining unless arguments.remaining.empty?

Severity: Minor
Found in lib/github_api/client/issues/labels.rb and 1 other location - About 40 mins to fix
lib/github_api/client/issues/labels.rb on lines 134..139

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

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 add(*args)
      arguments(args, required: [:user, :repo, :number])
      params = arguments.params
      params['data'] = arguments.remaining unless arguments.remaining.empty?

Severity: Minor
Found in lib/github_api/client/issues/labels.rb and 1 other location - About 40 mins to fix
lib/github_api/client/issues/labels.rb on lines 181..186

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

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

    def get(*args)
      arguments(args, required: [:user, :repo, :label_name])
      params = arguments.params

      get_request("/repos/#{arguments.user}/#{arguments.repo}/labels/#{arguments.label_name}", params)
Severity: Minor
Found in lib/github_api/client/issues/labels.rb and 5 other locations - About 20 mins to fix
lib/github_api/client/git_data/commits.rb on lines 36..40
lib/github_api/client/git_data/references.rb on lines 130..134
lib/github_api/client/git_data/tags.rb on lines 33..37
lib/github_api/client/issues/comments.rb on lines 62..66
lib/github_api/client/issues/events.rb on lines 42..46

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

    def create(*args)
      arguments(args, required: [:user, :repo]) do
        permit VALID_LABEL_INPUTS
        assert_required VALID_LABEL_INPUTS
      end
Severity: Minor
Found in lib/github_api/client/issues/labels.rb and 4 other locations - About 20 mins to fix
lib/github_api/client/git_data/blobs.rb on lines 42..48
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/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 delete(*args)
      arguments(args, required: [:user, :repo, :label_name])

      delete_request("/repos/#{arguments.user}/#{arguments.repo}/labels/#{arguments.label_name}", arguments.params)
Severity: Major
Found in lib/github_api/client/issues/labels.rb and 27 other locations - About 15 mins to fix
lib/github_api/client/git_data/blobs.rb on lines 20..23
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/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