mick-whats/args2-node

View on GitHub

Showing 12 of 12 total issues

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

        if (last) {
          ref = argArray.pop();
          if (!_.isUndefined(ref)) {
            refIndex = _.findLastIndex(this.args, function(o) {
              if (_.isFunction(typingFn)) {
Severity: Major
Found in lib/index.js and 1 other location - About 3 hrs to fix
lib/index.js on lines 88..101

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

        } else {
          ref = argArray.shift();
          if (!_.isUndefined(ref)) {
            refIndex = _.findIndex(this.args, function(o) {
              if (_.isFunction(typingFn)) {
Severity: Major
Found in lib/index.js and 1 other location - About 3 hrs to fix
lib/index.js on lines 75..88

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

File index.js has 291 lines of code (exceeds 250 allowed). Consider refactoring.
Open

// Generated by CoffeeScript 1.12.7
(function() {
  var Args2,
    _,
    slice = [].slice;
Severity: Minor
Found in lib/index.js - About 3 hrs to fix

    Function get has 56 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        Args2.prototype.get = function(
          typingFn,
          argType,
          required,
          defaultValue,
    Severity: Major
    Found in lib/index.js - About 2 hrs to fix

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

            if (this.args.length) {
              ref = this.args[0];
              internalFunction = choiceInternalFunction(ref, true);
              return this[internalFunction]();
            } else {
      Severity: Major
      Found in lib/index.js and 1 other location - About 1 hr to fix
      lib/index.js on lines 253..270

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

      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

            if (this.args.length) {
              ref = _.last(this.args);
              internalFunction = choiceInternalFunction(ref, false);
              return this[internalFunction]();
            } else {
      Severity: Major
      Found in lib/index.js and 1 other location - About 1 hr to fix
      lib/index.js on lines 231..248

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

      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 Args2 has 38 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function Args2(args1) {
            var args, res;
            this.args = args1;
            if (this['arguments'] != null) {
              args = Array.prototype.slice.call(this['arguments'], 0);
      Severity: Minor
      Found in lib/index.js - About 1 hr to fix

        Function assign has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            Args2.assign = function(argu, types) {
              var args, res;
              args = new Args2(argu);
              res = [];
              types.forEach(function(type) {
        Severity: Minor
        Found in lib/index.js - About 1 hr to fix

          Function get has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                typingFn,
                argType,
                required,
                defaultValue,
                last
          Severity: Minor
          Found in lib/index.js - About 35 mins to fix

            Avoid too many return statements within this function.
            Open

                      return res.bools.push(item);
            Severity: Major
            Found in lib/index.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                        return res.funcs.push(item);
              Severity: Major
              Found in lib/index.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                          return res.others.push(item);
                Severity: Major
                Found in lib/index.js - About 30 mins to fix
                  Severity
                  Category
                  Status
                  Source
                  Language