mohayonao/SCScript

View on GitHub
src/sc/classlib/Math/Integer.js

Summary

Maintainability
F
4 days
Test Coverage

File Integer.js has 300 lines of code (exceeds 250 allowed). Consider refactoring.
Open

SCScript.install(function(sc) {
  "use strict";

  require("./SimpleNumber");

Severity: Minor
Found in src/sc/classlib/Math/Integer.js - About 3 hrs to fix

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

        builder.addMethod("fold", {
          args: "lo; hi"
        }, function($lo, $hi) {
          // <-- _FoldInt -->
          if ($lo.__tag === sc.TAG_SYM) {
    Severity: Major
    Found in src/sc/classlib/Math/Integer.js and 2 other locations - About 7 hrs to fix
    src/sc/classlib/Math/Integer.js on lines 119..138
    src/sc/classlib/Math/Integer.js on lines 140..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 185.

    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

        builder.addMethod("wrap", {
          args: "lo; hi"
        }, function($lo, $hi) {
          // <-- _WrapInt -->
          if ($lo.__tag === sc.TAG_SYM) {
    Severity: Major
    Found in src/sc/classlib/Math/Integer.js and 2 other locations - About 7 hrs to fix
    src/sc/classlib/Math/Integer.js on lines 119..138
    src/sc/classlib/Math/Integer.js on lines 161..180

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

    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

        builder.addMethod("clip", {
          args: "lo; hi"
        }, function($lo, $hi) {
          // <-- _ClipInt -->
          if ($lo.__tag === sc.TAG_SYM) {
    Severity: Major
    Found in src/sc/classlib/Math/Integer.js and 2 other locations - About 7 hrs to fix
    src/sc/classlib/Math/Integer.js on lines 140..159
    src/sc/classlib/Math/Integer.js on lines 161..180

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

    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

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

      var bop = function(selector, type1, type2) {
        var func = mathlib[selector];
    
        return function($aNumber, $adverb) {
          var tag = $aNumber.__tag;
    Severity: Major
    Found in src/sc/classlib/Math/Integer.js and 1 other location - About 4 hrs to fix
    src/sc/classlib/Math/Float.js on lines 9..26

    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

        builder.addMethod("forBy", {
          args: "endval; stepval; function"
        }, function($endval, $stepval, $function) {
          sc.lang.iterator.execute(
            sc.lang.iterator.integer$forBy(this, $endval, $stepval),
    Severity: Major
    Found in src/sc/classlib/Math/Integer.js and 2 other locations - About 1 hr to fix
    src/sc/classlib/Math/Number.js on lines 55..63
    src/sc/classlib/Math/Number.js on lines 65..73

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

    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

        builder.addMethod("for", {
          args: "endval; function"
        }, function($endval, $function) {
          sc.lang.iterator.execute(
            sc.lang.iterator.integer$for(this, $endval),
    Severity: Major
    Found in src/sc/classlib/Math/Integer.js and 1 other location - About 1 hr to fix
    src/sc/classlib/Math/Number.js on lines 45..53

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

    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

        builder.addMethod("reverseDo", function($function) {
          sc.lang.iterator.execute(
            sc.lang.iterator.integer$reverseDo(this),
            $function
          );
    Severity: Major
    Found in src/sc/classlib/Math/Integer.js and 6 other locations - About 1 hr to fix
    src/sc/classlib/Collections/ArrayedCollection.js on lines 638..644
    src/sc/classlib/Collections/ArrayedCollection.js on lines 646..652
    src/sc/classlib/Collections/Set.js on lines 41..47
    src/sc/classlib/Core/Object.js on lines 97..103
    src/sc/classlib/Math/Float.js on lines 191..197
    src/sc/classlib/Math/Integer.js on lines 217..223

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

    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

        builder.addMethod("do", function($function) {
          sc.lang.iterator.execute(
            sc.lang.iterator.integer$do(this),
            $function
          );
    Severity: Major
    Found in src/sc/classlib/Math/Integer.js and 6 other locations - About 1 hr to fix
    src/sc/classlib/Collections/ArrayedCollection.js on lines 638..644
    src/sc/classlib/Collections/ArrayedCollection.js on lines 646..652
    src/sc/classlib/Collections/Set.js on lines 41..47
    src/sc/classlib/Core/Object.js on lines 97..103
    src/sc/classlib/Math/Float.js on lines 191..197
    src/sc/classlib/Math/Integer.js on lines 252..258

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

    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