socketstream/socketstream

View on GitHub

Showing 270 of 270 total issues

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

exports.init = function() {
  return {
    name: 'Ember.js',
    process: function(template, path, id) {
      return '<script type="text/x-handlebars" data-template-name="' + id + '">' + template + '</script>';
Severity: Major
Found in lib/client/template_engines/ember.js and 2 other locations - About 1 hr to fix
lib/client/template_engines/angular.js on lines 6..13
lib/client/template_engines/default.js on lines 6..13

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

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

exports.init = function() {
  return {
    name: 'Angular.js',
    process: function(template, path, id) {
      return '<script type="text/ng-template" id="' + id + '.html">' + template + '</script>';
Severity: Major
Found in lib/client/template_engines/angular.js and 2 other locations - About 1 hr to fix
lib/client/template_engines/default.js on lines 6..13
lib/client/template_engines/ember.js on lines 5..12

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

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 exports has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

module.exports = function (ss, router/*, options*/) {

  ss.bundler.forEach(function(bundler) {

    router.on(bundler.dests.urls.css + '?*', serveCSS);
Severity: Minor
Found in lib/client/serve/dev.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 sourceEdit has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

docsApp.directive.sourceEdit = function(getEmbeddedTemplate) {
  return NG_DOCS.editExample ? {
    template: '<a class="edit-example pull-right" ng-click="plunkr($event)" href>' +
      '<i class="icon-edit"></i> Edit in Plunkr</a>',
    scope: true,
Severity: Minor
Found in docs/js/docs.js - About 1 hr to fix

    Function hasBinary has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function hasBinary (obj) {
          if (!obj || typeof obj !== 'object') {
            return false;
          }
    
    
    Severity: Minor
    Found in lib/websocket/transports/engineio/client.js - About 1 hr to fix

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

      module.exports = function(ss, emitter) {
        var config = {}, transport;
      
        return {
          use: function(nameOrModule, cfg) {
      Severity: Minor
      Found in lib/websocket/transport.js - About 1 hr to fix

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

              ss.defaultTask(bundler.client.name+':pack-js', function(done) {
                ss.bundler.packAssetSet('js', bundler.client, bundler.toMinifiedJS,done);
              });
        Severity: Major
        Found in lib/tasks/defaults.js and 1 other location - About 1 hr to fix
        lib/tasks/defaults.js on lines 132..134

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

        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

              ss.defaultTask(bundler.client.name+':pack-css', function(done) {
                ss.bundler.packAssetSet('css', bundler.client, bundler.toMinifiedCSS,done);
              });
        Severity: Major
        Found in lib/tasks/defaults.js and 1 other location - About 1 hr to fix
        lib/tasks/defaults.js on lines 136..138

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

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

            JSONPPolling.prototype.doPoll = function () {
              var self = this;
              var script = document.createElement('script');
        
              if (this.script) {
        Severity: Minor
        Found in lib/websocket/transports/engineio/client.js - About 1 hr to fix

          Function define has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          require.define = function (filename, fn) {
              //if (filename.substring(0,3) === '/./') { filename = filename.substring(2); }
              var dirname = require._core[filename]
                  ? ''
                  : require.modules.path().dirname(filename)
          Severity: Minor
          Found in lib/client/bundler/browserify.client.js - About 1 hr to fix

            Function init has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                init : function() {
                  this.element = angular.element(
                    '<div class="popover popover-incode top">' +
                      '<div class="arrow"></div>' +
                      '<div class="popover-inner">' +
            Severity: Minor
            Found in docs/js/angular-bootstrap.js - About 1 hr to fix

              Function useLatestsPackedId has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  useLatestsPackedId : function() {
                    if (options.packedAssets) {
                      try {
                        this.latestPackedId = false;
                        var files = fs.readdirSync(path.join(ss.root, options.dirs.assets, this.client.name));
              Severity: Minor
              Found in lib/client/bundler/proto.js - About 1 hr to fix

                Function clientIssue has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                exports.clientIssue = function clientIssue(client,options,err,more) {
                  var info = [''];
                  if (options.serveDebugInfo) {
                    err.userInfo = info;
                  }
                Severity: Minor
                Found in lib/utils/log.js - About 1 hr to fix

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

                        return pushUniqueAsset('libs',{
                          name: name,
                          type: 'lib',
                          dir: pathlib.join(__dirname,'libs'),
                          path: pathlib.join(__dirname,'libs',name + '.js'),
                  Severity: Major
                  Found in lib/client/system/index.js and 1 other location - About 1 hr to fix
                  lib/client/system/index.js on lines 73..80

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

                  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

                          assets.modules[name] = {
                            name: name,
                            type: 'mod',
                            dir: pathlib.join(__dirname,'modules'),
                            path: pathlib.join(__dirname,'modules',name + '.js'),
                  Severity: Major
                  Found in lib/client/system/index.js and 1 other location - About 1 hr to fix
                  lib/client/system/index.js on lines 59..66

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

                  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

                      ss.bundler.loadFile(entry, opts, null, cb, function(err) {
                        ss.log.clientIssue({name:'unknown','id':'unknown'},options,err,entry);
                        cb('console.log("error","'+ err.userInfoText +'")');
                      });
                  Severity: Major
                  Found in lib/client/serve/ondemand.js and 1 other location - About 1 hr to fix
                  lib/client/serve/ondemand.js on lines 54..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 55.

                  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(err) {
                            ss.log.clientIssue({name:'unknown','id':'unknown'},options,err,entry);
                            cb('console.log("error","'+ err.userInfoText +'")');
                          });
                  Severity: Major
                  Found in lib/client/serve/ondemand.js and 1 other location - About 1 hr to fix
                  lib/client/serve/ondemand.js on lines 74..77

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

                  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

                    Object.defineProperty(err, 'userInfoText', {
                      get: function() {
                        return this.userInfo? this.userInfo.join('\n') : ' issue='+number;
                      }
                    });
                  Severity: Minor
                  Found in lib/utils/log.js and 1 other location - About 55 mins to fix
                  lib/utils/log.js on lines 130..134

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

                  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

                    Object.defineProperty(err, 'userInfoHTML', {
                      get: function() {
                        return this.userInfo? this.userInfo.join('<br>') : ' issue='+number;
                      }
                    });
                  Severity: Minor
                  Found in lib/utils/log.js and 1 other location - About 55 mins to fix
                  lib/utils/log.js on lines 135..139

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

                  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 (this.options.gfm) {
                      if (this.options.breaks) {
                        this.rules = inline.breaks;
                      } else {
                        this.rules = inline.gfm;
                  Severity: Minor
                  Found in docs/js/marked.js and 1 other location - About 55 mins to fix
                  docs/js/marked.js on lines 100..106

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

                  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