rwwarren/door-lock

View on GitHub
web/gulp/JSGulp.js

Summary

Maintainability
C
1 day
Test Coverage

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

  getBundleStream: function() {
    if(!jsBundler) {
      JSGulp._createBundler(false);
    }
    console.log('Bundling JS');
Severity: Minor
Found in web/gulp/JSGulp.js - About 1 hr to fix

    Use path.join() or path.resolve() instead of + to create paths.
    Open

    var outputPath = __dirname + '/../src/root/js';
    Severity: Minor
    Found in web/gulp/JSGulp.js by eslint

    Disallow string concatenation when using __dirname and __filename (no-path-concat)

    In Node.js, the __dirname and __filename global variables contain the directory path and the file path of the currently executing script file, respectively. Sometimes, developers try to use these variables to create paths to other files, such as:

    var fullPath = __dirname + "/foo.js";

    However, there are a few problems with this. First, you can't be sure what type of system the script is running on. Node.js can be run on any computer, including Windows, which uses a different path separator. It's very easy, therefore, to create an invalid path using string concatenation and assuming Unix-style separators. There's also the possibility of having double separators, or otherwise ending up with an invalid path.

    In order to avoid any confusion as to how to create the correct path, Node.js provides the path module. This module uses system-specific information to always return the correct value. So you can rewrite the previous example as:

    var fullPath = path.join(__dirname, "foo.js");

    This example doesn't need to include separators as path.join() will do it in the most appropriate manner. Alternately, you can use path.resolve() to retrieve the fully-qualified path:

    var fullPath = path.resolve(__dirname, "foo.js");

    Both path.join() and path.resolve() are suitable replacements for string concatenation wherever file or directory paths are being created.

    Rule Details

    This rule aims to prevent string concatenation of directory paths in Node.js

    Examples of incorrect code for this rule:

    /*eslint no-path-concat: "error"*/
    
    var fullPath = __dirname + "/foo.js";
    
    var fullPath = __filename + "/foo.js";

    Examples of correct code for this rule:

    /*eslint no-path-concat: "error"*/
    
    var fullPath = dirname + "/foo.js";

    When Not To Use It

    If you want to allow string concatenation of path names. Source: http://eslint.org/docs/rules/

    Use path.join() or path.resolve() instead of + to create paths.
    Open

    var devreact = __dirname + '/../src/inc/react-with-addons-0.13.3.js';
    Severity: Minor
    Found in web/gulp/JSGulp.js by eslint

    Disallow string concatenation when using __dirname and __filename (no-path-concat)

    In Node.js, the __dirname and __filename global variables contain the directory path and the file path of the currently executing script file, respectively. Sometimes, developers try to use these variables to create paths to other files, such as:

    var fullPath = __dirname + "/foo.js";

    However, there are a few problems with this. First, you can't be sure what type of system the script is running on. Node.js can be run on any computer, including Windows, which uses a different path separator. It's very easy, therefore, to create an invalid path using string concatenation and assuming Unix-style separators. There's also the possibility of having double separators, or otherwise ending up with an invalid path.

    In order to avoid any confusion as to how to create the correct path, Node.js provides the path module. This module uses system-specific information to always return the correct value. So you can rewrite the previous example as:

    var fullPath = path.join(__dirname, "foo.js");

    This example doesn't need to include separators as path.join() will do it in the most appropriate manner. Alternately, you can use path.resolve() to retrieve the fully-qualified path:

    var fullPath = path.resolve(__dirname, "foo.js");

    Both path.join() and path.resolve() are suitable replacements for string concatenation wherever file or directory paths are being created.

    Rule Details

    This rule aims to prevent string concatenation of directory paths in Node.js

    Examples of incorrect code for this rule:

    /*eslint no-path-concat: "error"*/
    
    var fullPath = __dirname + "/foo.js";
    
    var fullPath = __filename + "/foo.js";

    Examples of correct code for this rule:

    /*eslint no-path-concat: "error"*/
    
    var fullPath = dirname + "/foo.js";

    When Not To Use It

    If you want to allow string concatenation of path names. Source: http://eslint.org/docs/rules/

    Use path.join() or path.resolve() instead of + to create paths.
    Open

    var prodreact = __dirname + '/../src/inc/react-with-addons-0.13.3.min.js';
    Severity: Minor
    Found in web/gulp/JSGulp.js by eslint

    Disallow string concatenation when using __dirname and __filename (no-path-concat)

    In Node.js, the __dirname and __filename global variables contain the directory path and the file path of the currently executing script file, respectively. Sometimes, developers try to use these variables to create paths to other files, such as:

    var fullPath = __dirname + "/foo.js";

    However, there are a few problems with this. First, you can't be sure what type of system the script is running on. Node.js can be run on any computer, including Windows, which uses a different path separator. It's very easy, therefore, to create an invalid path using string concatenation and assuming Unix-style separators. There's also the possibility of having double separators, or otherwise ending up with an invalid path.

    In order to avoid any confusion as to how to create the correct path, Node.js provides the path module. This module uses system-specific information to always return the correct value. So you can rewrite the previous example as:

    var fullPath = path.join(__dirname, "foo.js");

    This example doesn't need to include separators as path.join() will do it in the most appropriate manner. Alternately, you can use path.resolve() to retrieve the fully-qualified path:

    var fullPath = path.resolve(__dirname, "foo.js");

    Both path.join() and path.resolve() are suitable replacements for string concatenation wherever file or directory paths are being created.

    Rule Details

    This rule aims to prevent string concatenation of directory paths in Node.js

    Examples of incorrect code for this rule:

    /*eslint no-path-concat: "error"*/
    
    var fullPath = __dirname + "/foo.js";
    
    var fullPath = __filename + "/foo.js";

    Examples of correct code for this rule:

    /*eslint no-path-concat: "error"*/
    
    var fullPath = dirname + "/foo.js";

    When Not To Use It

    If you want to allow string concatenation of path names. Source: http://eslint.org/docs/rules/

    Use path.join() or path.resolve() instead of + to create paths.
    Open

    var rootJSPath = __dirname + '/../src/inc/appRouter.js';
    Severity: Minor
    Found in web/gulp/JSGulp.js by eslint

    Disallow string concatenation when using __dirname and __filename (no-path-concat)

    In Node.js, the __dirname and __filename global variables contain the directory path and the file path of the currently executing script file, respectively. Sometimes, developers try to use these variables to create paths to other files, such as:

    var fullPath = __dirname + "/foo.js";

    However, there are a few problems with this. First, you can't be sure what type of system the script is running on. Node.js can be run on any computer, including Windows, which uses a different path separator. It's very easy, therefore, to create an invalid path using string concatenation and assuming Unix-style separators. There's also the possibility of having double separators, or otherwise ending up with an invalid path.

    In order to avoid any confusion as to how to create the correct path, Node.js provides the path module. This module uses system-specific information to always return the correct value. So you can rewrite the previous example as:

    var fullPath = path.join(__dirname, "foo.js");

    This example doesn't need to include separators as path.join() will do it in the most appropriate manner. Alternately, you can use path.resolve() to retrieve the fully-qualified path:

    var fullPath = path.resolve(__dirname, "foo.js");

    Both path.join() and path.resolve() are suitable replacements for string concatenation wherever file or directory paths are being created.

    Rule Details

    This rule aims to prevent string concatenation of directory paths in Node.js

    Examples of incorrect code for this rule:

    /*eslint no-path-concat: "error"*/
    
    var fullPath = __dirname + "/foo.js";
    
    var fullPath = __filename + "/foo.js";

    Examples of correct code for this rule:

    /*eslint no-path-concat: "error"*/
    
    var fullPath = dirname + "/foo.js";

    When Not To Use It

    If you want to allow string concatenation of path names. Source: http://eslint.org/docs/rules/

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

      _createBundler: function(watch) {
        var bundler = browserify({
          basedir: __dirname,
          bundleExternal: false,
          cache: {},
    Severity: Major
    Found in web/gulp/JSGulp.js and 1 other location - About 5 hrs to fix
    mobile/web/gulp/JSGulp.js on lines 28..46

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

    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

        del([outputPath + '/' + buildFile], function(err, paths) {
          if(err) {
            console.error('Error cleaning JS: ' + err.toString());
            return;
          }
    Severity: Major
    Found in web/gulp/JSGulp.js and 1 other location - About 1 hr to fix
    web/gulp/JSGulp.js on lines 104..110

    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

        del([outputPath + '/' + reactFile], function(err, paths) {
          if(err) {
            console.error('Error cleaning JS: ' + err.toString());
            return;
          }
    Severity: Major
    Found in web/gulp/JSGulp.js and 1 other location - About 1 hr to fix
    web/gulp/JSGulp.js on lines 97..103

    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

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

        stream.on('end', function() {
          var time = Date.now() - start;
          console.log('Bundled JS (' + time + ' ms)');
        });
    Severity: Minor
    Found in web/gulp/JSGulp.js and 1 other location - About 55 mins to fix
    mobile/web/gulp/JSGulp.js on lines 62..65

    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

      watch: function() {
        JSGulp._createBundler(true);
        var stream = JSGulp.getBundleStream();
        stream.read();
      },
    Severity: Minor
    Found in web/gulp/JSGulp.js and 1 other location - About 30 mins to fix
    mobile/web/gulp/JSGulp.js on lines 77..81

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

    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