henrikrudstrom/oce-wrap

View on GitHub

Showing 52 of 52 total issues

Function exports has 125 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function(gulp) {
  const fs = require('fs');
  const run = require('gulp-run');
  const path = require('path');
  const mkdirp = require('mkdirp');
Severity: Major
Found in tasks/gyp.js - About 5 hrs to fix

    Function dependencyReader has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
    Open

    function dependencyReader(mods) {
      var cache = {};
    
      // return the type names that class member depends on
      function memberDepends(mem) {
    Severity: Minor
    Found in src/dependencies.js - About 4 hrs 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 exports has 91 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    module.exports = function(gulp) {
      const path = require('path');
      const fs = require('fs');
      const mkdirp = require('mkdirp');
      const async = require('async');
    Severity: Major
    Found in tasks/swig.js - About 3 hrs to fix

      Function dependencyReader has 72 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function dependencyReader(mods) {
        var cache = {};
      
        // return the type names that class member depends on
        function memberDepends(mem) {
      Severity: Major
      Found in src/dependencies.js - About 2 hrs to fix

        Function exports has 71 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        module.exports = function(gulp) {
          const runSequence = require('run-sequence').use(gulp);
          const rename = require('gulp-rename');
        
          require('./parse.js')(gulp);
        Severity: Major
        Found in tasks/main.js - About 2 hrs to fix

          Function exports has 68 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          module.exports = function(gulp) {
            const render = require('../src/render.js');
            const settings = require('../src/settings.js');
            const testLib = require('../src/testLib');
          
          
          Severity: Major
          Found in tasks/test.js - About 2 hrs to fix

            Function moduleQuery has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

            function moduleQuery(mods) {
              if (typeof mods === 'string') {
                mods = glob.sync(`${mods}/*.json`).map(file =>
                  JSON.parse(fs.readFileSync(file))
                );
            Severity: Minor
            Found in src/modules.js - About 2 hrs 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 exports has 53 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            module.exports = function(gulp) {
              const fs = require('fs');
              const path = require('path');
              const mkdirp = require('mkdirp');
              const yargs = require('yargs');
            Severity: Major
            Found in tasks/parse.js - About 2 hrs to fix

              Function moduleQuery has 49 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function moduleQuery(mods) {
                if (typeof mods === 'string') {
                  mods = glob.sync(`${mods}/*.json`).map(file =>
                    JSON.parse(fs.readFileSync(file))
                  );
              Severity: Minor
              Found in src/modules.js - About 1 hr to fix

                Function classDepends has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  function classDepends(cls, options, visited) {
                    options = options || {};
                    var firstCall = false;
                    if (visited === undefined) {
                      firstCall = true;
                Severity: Minor
                Found in src/dependencies.js - About 1 hr to fix

                  Function exports has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                  Open

                  module.exports = function(gulp) {
                    const fs = require('fs');
                    const run = require('gulp-run');
                    const path = require('path');
                    const mkdirp = require('mkdirp');
                  Severity: Minor
                  Found in tasks/gyp.js - 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 processInclude has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function processInclude(decl, parent) {
                    var newDecl;
                    if (decl.declarations) {
                      newDecl = new Conf(decl, parent.name);
                      newDecl.key = decl.name; //TODO: get rid of .key
                  Severity: Minor
                  Found in src/conf.js - 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

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

                  function arrayToAppendable(listType, elemType, add) {
                    var deref = isPrimitive(elemType) ? '' : '*';
                    return `\
                      ${listType} * list = new ${listType}();
                      ${elemType} ${deref}argpointer;
                  Severity: Major
                  Found in src/features/collection.js and 1 other location - About 1 hr to fix
                  src/features/collection.js on lines 74..84

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

                  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

                  function arrayToSettable(listType, elemType, setter) {
                    var deref = isPrimitive(elemType) ? '' : '*';
                    return `\
                      ${listType} * list = new ${listType}(1, length);
                      ${elemType} ${deref}argpointer;
                  Severity: Major
                  Found in src/features/collection.js and 1 other location - About 1 hr to fix
                  src/features/collection.js on lines 86..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 66.

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

                  function renderHeaders(decl) {
                    const modules = require('../modules.js')();
                    var reader = require('../dependencies.js')(modules);
                  
                    if (decl.declType !== 'module') return false;
                  Severity: Minor
                  Found in src/features/headers.js - About 1 hr to fix

                    Function includeAsStatic has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function includeAsStatic(expr, template, valueFunc, returnType) {
                      var clsName = expr.split('(')[0];
                      var cls = headers.get(clsName);
                    
                      if (!returnType) {
                    Severity: Minor
                    Found in src/features/asStatic.js - About 1 hr to fix

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

                        function get(name) {
                          var res = find(name);
                          if (res.length === 0) return null;
                          if (res.length === 1) return res[0];
                          throw new Error('headers.get expected one result, got multiple');
                      Severity: Major
                      Found in src/modules.js and 1 other location - About 1 hr to fix
                      src/headers.js on lines 68..75

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

                      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

                      function get(name) {
                        var res = find(name);
                      
                        if (res.length === 0) return null;
                        if (res.length === 1) return res[0];
                      Severity: Major
                      Found in src/headers.js and 1 other location - About 1 hr to fix
                      src/modules.js on lines 52..57

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

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

                      function renderArgouts(decl) {
                        if (!decl.arguments)
                          return false;
                      
                        var argouts = decl.origArguments.filter(arg => arg.outArg);
                      Severity: Minor
                      Found in src/features/argout.js - About 1 hr to fix

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

                          gulp.task('swig-headers', function(done) {
                            async.parallel(
                              settings.build.modules.map((mod) => (cb) => runSwigRuntimeHeader(mod, cb)),
                              done
                            );
                        Severity: Major
                        Found in tasks/swig.js and 1 other location - About 1 hr to fix
                        tasks/swig.js on lines 68..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 59.

                        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

                        Severity
                        Category
                        Status
                        Source
                        Language