appsflare/ludicrum-api

View on GitHub

Showing 78 of 78 total issues

File socket.io.js has 1660 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*! Socket.IO.js build:0.9.16, development. Copyright(c) 2011 LearnBoost <dev@learnboost.com> MIT Licensed */

var io = ('undefined' === typeof module ? {} : module.exports);
(function () {

Severity: Major
Found in assets/js/socket.io.js - About 4 days to fix

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

    module.exports = function forbidden (data, options) {
    
      // Get access to `req`, `res`, & `sails`
      var req = this.req;
      var res = this.res;
    Severity: Major
    Found in api/responses/forbidden.js and 2 other locations - About 2 days to fix
    api/responses/notFound.js on lines 20..81
    api/responses/serverError.js on lines 15..76

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

    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

    module.exports = function notFound (data, options) {
    
      // Get access to `req`, `res`, & `sails`
      var req = this.req;
      var res = this.res;
    Severity: Major
    Found in api/responses/notFound.js and 2 other locations - About 2 days to fix
    api/responses/forbidden.js on lines 15..76
    api/responses/serverError.js on lines 15..76

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

    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

    module.exports = function serverError (data, options) {
    
      // Get access to `req`, `res`, & `sails`
      var req = this.req;
      var res = this.res;
    Severity: Major
    Found in api/responses/serverError.js and 2 other locations - About 2 days to fix
    api/responses/forbidden.js on lines 15..76
    api/responses/notFound.js on lines 20..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 379.

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

    module.exports = function(grunt) {
    
        grunt.config.set('sails-linker', {
            devJs: {
                options: {
    Severity: Major
    Found in tasks/config/sails-linker.js - About 7 hrs to fix

      Function str has 65 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function str(key, holder) {
      
      // Produce a string from holder[key].
      
            var i,          // The loop counter.
      Severity: Major
      Found in assets/js/socket.io.js - About 2 hrs to fix

        Function perform has 63 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          perform: function (job, done, context) {
            let fileName = job.data.fileName;
            let retryCounter = job.data.retryCounter || 0;
        
            let _vPath = '';
        Severity: Major
        Found in api/workers/ThumbnailerWorker.js - About 2 hrs to fix

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

            GetChildren: function (req, res) {
              Category.find({
                parent: req.param('id')
              }).then((categories, err) => {
                if (err) {
          Severity: Major
          Found in api/controllers/CategoryController.js and 1 other location - About 2 hrs to fix
          api/controllers/CategoryController.js on lines 42..52

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

          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

            GetChildrenByName: function (req, res) {
              Category.find({
                name: req.param('name')
              }).then((categories, err) => {
                if (err) {
          Severity: Major
          Found in api/controllers/CategoryController.js and 1 other location - About 2 hrs to fix
          api/controllers/CategoryController.js on lines 31..41

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

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

              parser.decodePacket = function (data) {
                var pieces = data.match(regexp);
          
                if (!pieces) return {};
          
          
          Severity: Major
          Found in assets/js/socket.io.js - About 2 hrs to fix

            Function reconnect has 61 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                Socket.prototype.reconnect = function () {
                  this.reconnecting = true;
                  this.reconnectionAttempts = 0;
                  this.reconnectionDelay = this.options['reconnection delay'];
            
            
            Severity: Major
            Found in assets/js/socket.io.js - About 2 hrs to fix

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

              exports.uid = function (len) {
                let buf = [];
              
              
                for (var i = 0; i < len; ++i) {
              Severity: Major
              Found in api/services/UtilsService.js and 1 other location - About 2 hrs to fix
              api/services/UtilsService.js on lines 43..52

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

              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

              exports.uidLight = function (len) {
                let buf = [];
              
              
                for (var i = 0; i < len; ++i) {
              Severity: Major
              Found in api/services/UtilsService.js and 1 other location - About 2 hrs to fix
              api/services/UtilsService.js on lines 32..41

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

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

                  JSONPPolling.prototype.post = function (data) {
                    var self = this
                      , query = io.util.query(
                        this.socket.options.query
                        , 't=' + (+new Date) + '&i=' + this.index
              Severity: Major
              Found in assets/js/socket.io.js - About 2 hrs to fix

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

                        devJsRelative: {
                            options: {
                                startTag: '<!--SCRIPTS-->',
                                endTag: '<!--SCRIPTS END-->',
                                fileTmpl: '<script src="%s"></script>',
                Severity: Major
                Found in tasks/config/sails-linker.js and 1 other location - About 2 hrs to fix
                tasks/config/sails-linker.js on lines 90..104

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

                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

                        devStylesRelative: {
                            options: {
                                startTag: '<!--STYLES-->',
                                endTag: '<!--STYLES END-->',
                                fileTmpl: '<link rel="stylesheet" href="%s">',
                Severity: Major
                Found in tasks/config/sails-linker.js and 1 other location - About 2 hrs to fix
                tasks/config/sails-linker.js on lines 31..44

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

                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

                  if (options.view) {
                    return res.view(options.view, { data: data });
                  }
                
                  // If no second argument provided, try to serve the implied view,
                Severity: Major
                Found in api/responses/badRequest.js and 1 other location - About 2 hrs to fix
                api/responses/ok.js on lines 38..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 80.

                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

                  if (options.view) {
                    return res.view(options.view, { data: data });
                  }
                
                  // If no second argument provided, try to serve the implied view,
                Severity: Major
                Found in api/responses/ok.js and 1 other location - About 2 hrs to fix
                api/responses/badRequest.js on lines 53..61

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

                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

                          v = partial.length === 0 ? '{}' : gap ?
                          '{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}' :
                          '{' + partial.join(',') + '}';
                Severity: Major
                Found in assets/js/socket.io.js and 1 other location - About 2 hrs to fix
                assets/js/socket.io.js on lines 804..806

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

                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

                            v = partial.length === 0 ? '[]' : gap ?
                            '[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']' :
                            '[' + partial.join(',') + ']';
                Severity: Major
                Found in assets/js/socket.io.js and 1 other location - About 2 hrs to fix
                assets/js/socket.io.js on lines 841..843

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

                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