RocketChat/Rocket.Chat.Ops

View on GitHub
hubots/hubot-gitsy/src/gitlab/lib/Models/ProjectHooks.js

Summary

Maintainability
F
3 days
Test Coverage

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

  var BaseModel, ProjectHooks, Utils,
    bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
    extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
    hasProp = {}.hasOwnProperty;
Severity: Major
Found in hubots/hubot-gitsy/src/gitlab/lib/Models/ProjectHooks.js and 11 other locations - About 6 hrs to fix
hubots/hubot-gitsy/src/gitlab/lib/Models/IssueNotes.js on lines 2..5
hubots/hubot-gitsy/src/gitlab/lib/Models/Labels.js on lines 2..5
hubots/hubot-gitsy/src/gitlab/lib/Models/Notes.js on lines 2..5
hubots/hubot-gitsy/src/gitlab/lib/Models/ProjectDeployKeys.js on lines 2..5
hubots/hubot-gitsy/src/gitlab/lib/Models/ProjectIssues.js on lines 2..5
hubots/hubot-gitsy/src/gitlab/lib/Models/ProjectLabels.js on lines 2..5
hubots/hubot-gitsy/src/gitlab/lib/Models/ProjectMembers.js on lines 2..5
hubots/hubot-gitsy/src/gitlab/lib/Models/ProjectMergeRequests.js on lines 2..5
hubots/hubot-gitsy/src/gitlab/lib/Models/ProjectMilestones.js on lines 2..5
hubots/hubot-gitsy/src/gitlab/lib/Models/ProjectRepository.js on lines 2..5
hubots/hubot-gitsy/src/gitlab/lib/Models/Projects.js on lines 2..5

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

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

    function ProjectHooks() {
      this.remove = bind(this.remove, this);
      this.update = bind(this.update, this);
      this.add = bind(this.add, this);
      this.show = bind(this.show, this);
Severity: Major
Found in hubots/hubot-gitsy/src/gitlab/lib/Models/ProjectHooks.js and 2 other locations - About 4 hrs to fix
hubots/hubot-gitsy/src/gitlab/lib/Models/ProjectMembers.js on lines 14..21
hubots/hubot-gitsy/src/gitlab/lib/Models/ProjectMergeRequests.js on lines 14..21

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

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

    ProjectHooks.prototype.remove = function(projectId, hookId, fn) {
      if (fn == null) {
        fn = null;
      }
      this.debug("Projects::removeHook()");
Severity: Major
Found in hubots/hubot-gitsy/src/gitlab/lib/Models/ProjectHooks.js and 2 other locations - About 4 hrs to fix
hubots/hubot-gitsy/src/gitlab/lib/Models/ProjectMembers.js on lines 94..106
hubots/hubot-gitsy/src/gitlab/lib/Models/ProjectRepository.js on lines 105..117

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

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

    ProjectHooks.prototype.show = function(projectId, hookId, fn) {
      if (fn == null) {
        fn = null;
      }
      this.debug("Projects::hook()");
Severity: Major
Found in hubots/hubot-gitsy/src/gitlab/lib/Models/ProjectHooks.js and 6 other locations - About 4 hrs to fix
hubots/hubot-gitsy/src/gitlab/lib/Models/ProjectDeployKeys.js on lines 35..47
hubots/hubot-gitsy/src/gitlab/lib/Models/ProjectMembers.js on lines 37..49
hubots/hubot-gitsy/src/gitlab/lib/Models/ProjectMergeRequests.js on lines 50..62
hubots/hubot-gitsy/src/gitlab/lib/Models/ProjectMilestones.js on lines 68..80
hubots/hubot-gitsy/src/gitlab/lib/Models/ProjectRepository.js on lines 46..58
hubots/hubot-gitsy/src/gitlab/lib/Models/ProjectRepository.js on lines 147..159

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

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

    ProjectHooks.prototype.list = function(projectId, fn) {
      if (fn == null) {
        fn = null;
      }
      this.debug("Projects::hooks()");
Severity: Major
Found in hubots/hubot-gitsy/src/gitlab/lib/Models/ProjectHooks.js and 5 other locations - About 3 hrs to fix
hubots/hubot-gitsy/src/gitlab/lib/Models/ProjectDeployKeys.js on lines 21..33
hubots/hubot-gitsy/src/gitlab/lib/Models/ProjectMembers.js on lines 23..35
hubots/hubot-gitsy/src/gitlab/lib/Models/ProjectRepository.js on lines 32..44
hubots/hubot-gitsy/src/gitlab/lib/Models/ProjectRepository.js on lines 119..131
hubots/hubot-gitsy/src/gitlab/lib/Models/ProjectRepository.js on lines 133..145

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

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

      return this.put("projects/" + (Utils.parseProjectId(projectId)) + "/hooks/" + (parseInt(hookId)), params, (function(_this) {
        return function(data) {
          if (fn) {
            return fn(data);
          }
Severity: Major
Found in hubots/hubot-gitsy/src/gitlab/lib/Models/ProjectHooks.js and 3 other locations - About 1 hr to fix
hubots/hubot-gitsy/src/gitlab/lib/Models/ProjectMembers.js on lines 85..91
hubots/hubot-gitsy/src/gitlab/lib/Models/ProjectMergeRequests.js on lines 93..99
hubots/hubot-gitsy/src/gitlab/lib/Models/ProjectMilestones.js on lines 116..122

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

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

      return this.post("projects/" + (Utils.parseProjectId(projectId)) + "/hooks", params, (function(_this) {
        return function(data) {
          if (fn) {
            return fn(data);
          }
Severity: Major
Found in hubots/hubot-gitsy/src/gitlab/lib/Models/ProjectHooks.js and 6 other locations - About 1 hr to fix
hubots/hubot-gitsy/src/gitlab/lib/Models/ProjectDeployKeys.js on lines 57..63
hubots/hubot-gitsy/src/gitlab/lib/Models/ProjectMembers.js on lines 64..70
hubots/hubot-gitsy/src/gitlab/lib/Models/ProjectMergeRequests.js on lines 41..47
hubots/hubot-gitsy/src/gitlab/lib/Models/ProjectMergeRequests.js on lines 77..83
hubots/hubot-gitsy/src/gitlab/lib/Models/ProjectMilestones.js on lines 94..100
hubots/hubot-gitsy/src/gitlab/lib/Models/ProjectRepository.js on lines 187..193

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

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