hpbuniat/copy-paste-detector

View on GitHub

Showing 22 of 22 total issues

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

    Math.prototype.div = function (v1, v2)
    {
        v3 = v1 / (v2 + v1);
        if (v3 > 14)
        {
Severity: Major
Found in __fixtures__/js/Math.js and 1 other location - About 2 days to fix
__fixtures__/js/Math.js on lines 101..158

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

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

    Math.prototype.complex = function (v1, v2)
    {
        v3 = v1 / (v2 + v1);
        if (v3 > 14)
        {
Severity: Major
Found in __fixtures__/js/Math.js and 1 other location - About 2 days to fix
__fixtures__/js/Math.js on lines 39..96

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

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

    public function div($v1, $v2)
    {
        $v3 = $v1 / ($v2 + $v1);
        if ($v3 > 14)
        {
Severity: Major
Found in __fixtures__/php/Math.php and 1 other location - About 2 days to fix
__fixtures__/php/Math.php on lines 149..208

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

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

    public function complex($v1, $v2)
    {
        $v3 = $v1 / ($v2 + $v1);
        if ($v3 > 14)
        {
Severity: Major
Found in __fixtures__/php/Math.php and 1 other location - About 2 days to fix
__fixtures__/php/Math.php on lines 85..144

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

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

<?php
// The constant addends indicate the number of not-ignored tokens
// at that point, for easy counting.
$a = 2 + 3;
$a = $a + 6;
Severity: Major
Found in __fixtures__/php/b.php and 3 other locations - About 6 hrs to fix
__fixtures__/php/a.php on lines 1..23
__fixtures__/php/c.php on lines 1..23
__fixtures__/php/d.php on lines 1..23

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

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

<?php
// The constant addends indicate the number of not-ignored tokens
// at that point, for easy counting.
$b = 2 + 3;
$b = $b + 6;
Severity: Major
Found in __fixtures__/php/d.php and 3 other locations - About 6 hrs to fix
__fixtures__/php/a.php on lines 1..23
__fixtures__/php/b.php on lines 1..23
__fixtures__/php/c.php on lines 1..23

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

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

<?php
// The constant addends indicate the number of not-ignored tokens
// at that point, for easy counting.
$a = 2 + 3;
$a = $a + 6;
Severity: Major
Found in __fixtures__/php/c.php and 3 other locations - About 6 hrs to fix
__fixtures__/php/a.php on lines 1..23
__fixtures__/php/b.php on lines 1..23
__fixtures__/php/d.php on lines 1..23

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

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

<?php
// The constant addends indicate the number of not-ignored tokens
// at that point, for easy counting.
$a = 2 + 3;
$a = $a + 6;
Severity: Major
Found in __fixtures__/php/a.php and 3 other locations - About 6 hrs to fix
__fixtures__/php/b.php on lines 1..23
__fixtures__/php/c.php on lines 1..23
__fixtures__/php/d.php on lines 1..23

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

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

  var AbstractParser, ParseCSS, css, path, _,
    __hasProp = {}.hasOwnProperty,
    __extends = 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; };
Severity: Major
Found in lib/parser/css.js and 1 other location - About 5 hrs to fix
lib/parser/coffee.js on lines 2..4

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

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

  var AbstractParser, ParseCoffee, coffee, path, _,
    __hasProp = {}.hasOwnProperty,
    __extends = 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; };
Severity: Major
Found in lib/parser/coffee.js and 1 other location - About 5 hrs to fix
lib/parser/css.js on lines 2..4

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

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

Function collect has 53 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    Collector.prototype.collect = function(directory, depth, include, exclude) {
      var excludes, files, includes;
      files = wrench.readdirSyncRecursive(directory);
      if (!include) {
        include = "*";
Severity: Major
Found in lib/collector.js - About 2 hrs to fix

    Method complex has 47 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function complex($v1, $v2)
        {
            $v3 = $v1 / ($v2 + $v1);
            if ($v3 > 14)
            {
    Severity: Minor
    Found in __fixtures__/php/Math.php - About 1 hr to fix

      Method div has 47 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function div($v1, $v2)
          {
              $v3 = $v1 / ($v2 + $v1);
              if ($v3 > 14)
              {
      Severity: Minor
      Found in __fixtures__/php/Math.php - About 1 hr to fix

        Function div has 45 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            Math.prototype.div = function (v1, v2)
            {
                v3 = v1 / (v2 + v1);
                if (v3 > 14)
                {
        Severity: Minor
        Found in __fixtures__/js/Math.js - About 1 hr to fix

          Function complex has 45 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              Math.prototype.complex = function (v1, v2)
              {
                  v3 = v1 / (v2 + v1);
                  if (v3 > 14)
                  {
          Severity: Minor
          Found in __fixtures__/js/Math.js - About 1 hr to fix

            Function analyze has 36 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                Parser.prototype.analyze = function(result, file, stack, tokens, lines) {
                  var f, firstHash, firstLine, firstToken, hash, i, sig, tokenPos;
                  sig = '';
                  tokenPos = [];
                  _.forEach(stack, function(token, i) {
            Severity: Minor
            Found in lib/parser.js - About 1 hr to fix

              Function recursiveRuleParser has 30 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  ParseCSS.prototype.recursiveRuleParser = function(rules, scope, fuzzy) {
                    _.forEach(rules, (function(_this) {
                      return function(rule) {
                        if (rule.rules != null) {
                          return _this.recursiveRuleParser(rule.rules, rule.type + " ", fuzzy);
              Severity: Minor
              Found in lib/parser/css.js - About 1 hr to fix

                Function addClone has 9 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    Parser.prototype.addClone = function(result, file, tokenPos, lines, tokens, i, firstToken, firstLine, firstHash) {
                Severity: Major
                Found in lib/parser.js - About 1 hr to fix

                  Function complex has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function complex($v1, $v2)
                      {
                          $v3 = $v1 / ($v2 + $v1);
                          if ($v3 > 14)
                          {
                  Severity: Minor
                  Found in __fixtures__/php/Math.php - About 1 hr to fix

                  Cognitive Complexity

                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                  A method's cognitive complexity is based on a few simple rules:

                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                  • Code is considered more complex for each "break in the linear flow of the code"
                  • Code is considered more complex when "flow breaking structures are nested"

                  Further reading

                  Function div has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function div($v1, $v2)
                      {
                          $v3 = $v1 / ($v2 + $v1);
                          if ($v3 > 14)
                          {
                  Severity: Minor
                  Found in __fixtures__/php/Math.php - About 1 hr to fix

                  Cognitive Complexity

                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                  A method's cognitive complexity is based on a few simple rules:

                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                  • Code is considered more complex for each "break in the linear flow of the code"
                  • Code is considered more complex when "flow breaking structures are nested"

                  Further reading

                  Severity
                  Category
                  Status
                  Source
                  Language