dcodeIO/webassembly

View on GitHub

Showing 31 of 31 total issues

File build.js has 609 lines of code (exceeds 250 allowed). Consider refactoring.
Open

// This is a custom build script that compiles a statically linkable object file of the underlying
// libc (musl) and this package's functionality to LLVM bitcode.

// This is super experimental, doesn't cover all of musl and will probably require a lot of tweaks
// in the future. If you need something special from libc, feel free to send a PR, but beware that
Severity: Major
Found in lib/build.js - About 1 day to fix

    Function main has 145 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    exports.main = (argv, callback) => {
    
        if (!callback)
            callback = util.defaultCallback;
    
    
    Severity: Major
    Found in cli/compiler.js - About 5 hrs to fix

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

          if (files.length !== 1) {
              util.printLogo("Linker");
              process.stderr.write([
                  chalk.bold.white("Links multiple WebAssembly modules to one."),
                  "",
      Severity: Major
      Found in cli/linker.js and 1 other location - About 5 hrs to fix
      cli/assembler.js on lines 25..45

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

      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

          if (files.length !== 1) {
              util.printLogo("Assembler");
              process.stderr.write([
                  chalk.bold.white("Assembles WebAssembly text format to a module."),
                  "",
      Severity: Major
      Found in cli/assembler.js and 1 other location - About 5 hrs to fix
      cli/linker.js on lines 27..47

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

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

      function load(file, options) {
      
          /**
           * Options as used by {@link load}.
           * @interface LoadOptions
      Severity: Major
      Found in src/index.js - About 3 hrs to fix

        Function main has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
        Open

        exports.main = (argv, callback) => {
        
            if (!callback)
                callback = util.defaultCallback;
        
        
        Severity: Minor
        Found in cli/compiler.js - About 3 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 load has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

        function load(file, options) {
        
            /**
             * Options as used by {@link load}.
             * @interface LoadOptions
        Severity: Minor
        Found in src/index.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 main has 52 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        exports.main = (argv, callback) => {
        
            if (!callback)
                callback = util.defaultCallback;
        
        
        Severity: Major
        Found in cli/linker.js - About 2 hrs to fix

          Function main has 52 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          exports.main = (argv, callback) => {
          
              if (!callback)
                  callback = util.defaultCallback;
          
          
          Severity: Major
          Found in cli/assembler.js - About 2 hrs to fix

            Function main has 47 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            exports.main = (argv, callback) => {
            
                if (!callback)
                    callback = util.defaultCallback;
            
            
            Severity: Minor
            Found in cli/disassembler.js - About 1 hr to fix

              Function main has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

              exports.main = (argv, callback) => {
              
                  if (!callback)
                      callback = util.defaultCallback;
              
              
              Severity: Minor
              Found in cli/assembler.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 main has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

              exports.main = (argv, callback) => {
              
                  if (!callback)
                      callback = util.defaultCallback;
              
              
              Severity: Minor
              Found in cli/linker.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 run has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

              exports.run = function run(cmd, argv, options) {
                  if (!argv)
                      argv = [];
                  if (!options)
                      options = {};
              Severity: Minor
              Found in cli/util.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 run has 32 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              exports.run = function run(cmd, argv, options) {
                  if (!argv)
                      argv = [];
                  if (!options)
                      options = {};
              Severity: Minor
              Found in cli/util.js - About 1 hr to fix

                Function download has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function download(callback) {
                    var req = https.get("https://github.com/dcodeIO/webassembly/releases/download/" + pkg.tools + "/" + archive, res => {
                        if (res.statusCode !== 200) {
                            req.abort();
                            callback(Error("no prebuilt binaries available for " + platform + " (code " + res.statusCode + ")"));
                Severity: Minor
                Found in scripts/setup.js - About 1 hr to fix

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

                  exports.main = (argv, callback) => {
                  
                      if (!callback)
                          callback = util.defaultCallback;
                  
                  
                  Severity: Minor
                  Found in cli/disassembler.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 req has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      var req = https.get("https://github.com/dcodeIO/webassembly/releases/download/" + pkg.tools + "/" + archive, res => {
                          if (res.statusCode !== 200) {
                              req.abort();
                              callback(Error("no prebuilt binaries available for " + platform + " (code " + res.statusCode + ")"));
                              return;
                  Severity: Minor
                  Found in scripts/setup.js - About 1 hr to fix

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

                         argv = minimist(argv, {
                            alias: {
                                out: "o",
                                debug: "d",
                                quiet: "q",
                    Severity: Minor
                    Found in cli/linker.js and 1 other location - About 55 mins to fix
                    cli/assembler.js on lines 13..22

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

                    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

                         argv = minimist(argv, {
                            alias: {
                                out: "o",
                                debug: "d",
                                quiet: "q",
                    Severity: Minor
                    Found in cli/assembler.js and 1 other location - About 55 mins to fix
                    cli/linker.js on lines 13..22

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

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

                        var file = path.normalize(files[0]),
                            out = argv.out && path.normalize(argv.out) || undefined;
                    Severity: Minor
                    Found in cli/disassembler.js and 2 other locations - About 40 mins to fix
                    cli/assembler.js on lines 54..55
                    cli/compiler.js on lines 81..82

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

                    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