syntheticore/declaire

View on GitHub

Showing 76 of 76 total issues

Avoid deeply nested control flow statements.
Open

                        if(!newItems) newItems = _.clone(items.items);
Severity: Major
Found in src/evaluator.js - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                  if(_.last(expr) == '!') {
                    expr = expr.slice(0, -1);
                    save = true;
                  }
    Severity: Major
    Found in src/evaluator.js - About 45 mins to fix

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

              dataInterface.create({serialize: function() { return req.body }}, function(err, item) {
                if(err) {
                  res.status(404).send(err);
                } else {
                  res.json(item);
      Severity: Minor
      Found in src/REST.js and 1 other location - About 40 mins to fix
      src/REST.js on lines 48..54

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

      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

              dataInterface.update(req.params.id, req.body, function(err, updatedValues) {
                if(err) {
                  res.status(404).send(err);
                } else {
                  res.json(updatedValues);
      Severity: Minor
      Found in src/REST.js and 1 other location - About 40 mins to fix
      src/REST.js on lines 37..43

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

      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 Evaluator has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      var Evaluator = function(topNode, viewModels, parseTrees, interface, mainModel) {
      Severity: Minor
      Found in src/evaluator.js - About 35 mins to fix

        Function DOMInterface has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        var DOMInterface = function() {
          return {
            createFragment: function() {
              return document.createDocumentFragment();
            },
        Severity: Minor
        Found in src/clientDOMInterface.js - About 35 mins 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 ViewModel has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        var ViewModel = function(name, reference, constructor) {
          var model = Model('_view', reference);
          return {
            klass: 'ViewModel',
            name: name,
        Severity: Minor
        Found in src/viewModel.js - About 35 mins 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 separateMethods has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        var separateMethods = function(reference) {
          var ret = {
            defaults: {},
            methods: {},
            collections: {},
        Severity: Minor
        Found in src/model.js - About 35 mins 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 parseAttribute has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

          parseAttribute: function(str) {
            var attr = {type: 'static', value: str};
            // Dynamic attribute
            if(str[0] == '{') {
              // Trim off curlies
        Severity: Minor
        Found in src/parser.js - About 35 mins 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

        Avoid too many return statements within this function.
        Open

                  if(op == '<=') return a <= b;
        Severity: Major
        Found in src/evaluator.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                    if(op == '>=') return a >= b;
          Severity: Major
          Found in src/evaluator.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                      return obj[seg];
            Severity: Major
            Found in src/scope.js - About 30 mins to fix

              Function Model has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              var Model = function(dbCollection, reference, constructor) {
                var ref = separateMethods(reference);
                var model = {
                  klass: 'Model',
                  name: dbCollection,
              Severity: Minor
              Found in src/model.js - About 25 mins 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 makeCollections has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              Collection.makeCollections = function(data, inst) {
                return _.map(data, function(value, key) {
                  if(Array.isArray(value)) {
                    var col = Collection(value);
                    if(inst) col.on('change', function() {
              Severity: Minor
              Found in src/collection.js - About 25 mins 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 UndoManager has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              var UndoManager = function(items) {
                var milestones = [{}];
                var reverseIndex = 0;
                var dontRecord = false;
              
              
              Severity: Minor
              Found in src/undoManager.js - About 25 mins 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 Router has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              var Router = function() {
                var listeners = {};
                var suppressNextPopstate = false;
              
                var scrollTo = function(id) {
              Severity: Minor
              Found in src/clientRouter.js - About 25 mins 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