Showing 56 of 56 total issues

Function Client has 209 lines of code (exceeds 25 allowed). Consider refactoring.
Open

var Client = (function(){

    var Options = {
        OVERWRITE_ALWAYS: 0,
        OVERWRITE_NEVER: 1,
Severity: Major
Found in lib/sync.js - About 1 day to fix

    Function VFS has 173 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    var VFS = (function(){
    
        var isModule = function(path) {
            return path.substring(0, 'modules'.length) === 'modules';
        };
    Severity: Major
    Found in lib/vfs.js - About 6 hrs to fix

      Function Config has 167 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      var Config = (function(){
      
          // Settings
          var defaultSettings = {
              'access_token': '',
      Severity: Major
      Found in lib/config.js - About 6 hrs to fix

        Function $28 has 157 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        var $28 = (function() {
        
            function $28(apiEndpoint){
                this.api = require('28.io-nodejs').$28(apiEndpoint);
                this.Options = Options;
        Severity: Major
        Found in lib/28.js - About 6 hrs to fix

          Function Config has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
          Open

          var Config = (function(){
          
              // Settings
              var defaultSettings = {
                  'access_token': '',
          Severity: Minor
          Found in lib/config.js - About 5 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 Client has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
          Open

          var Client = (function(){
          
              var Options = {
                  OVERWRITE_ALWAYS: 0,
                  OVERWRITE_NEVER: 1,
          Severity: Minor
          Found in lib/sync.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 syncImpl has 58 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              Client.prototype.syncImpl = function(localQueries, remoteQueries, overwrite, deleteOrphaned, simulate, isOriginRemote){
                  var that = this;
                  var promises = [];
                  var origin = isOriginRemote ? remoteQueries : localQueries;
                  var target = isOriginRemote ? localQueries : remoteQueries;
          Severity: Major
          Found in lib/sync.js - About 2 hrs to fix

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

                var encodeLocalPath = function(path) {
                    var segments = path.split('/');
                    var result = [];
                    segments.forEach(function(segment){
                        result.push(encodeURIComponent(segment));
            Severity: Major
            Found in lib/vfs.js and 1 other location - About 2 hrs to fix
            lib/vfs.js on lines 37..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 79.

            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

                var encodeRemotePath = function(path) {
                    var segments = path.split('/');
                    var result = [];
                    segments.forEach(function(segment){
                        result.push(decodeURIComponent(segment));
            Severity: Major
            Found in lib/vfs.js and 1 other location - About 2 hrs to fix
            lib/vfs.js on lines 28..35

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

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

                Client.prototype.commit = function(simulate, diffs){
                    var that = this;
                    var modulePromises = [];
                    var queryPromises = [];
                    diffs.forEach(function(diff){
            Severity: Minor
            Found in lib/sync.js - About 1 hr to fix

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

                          } else {
                              if(diff.isOriginRemote) {
                                  container.push(function(){ return that.deleteLocalQuery(diff); });
                              } else {
                                  container.push(function(){ return that.deleteRemoteQuery(diff); });
              Severity: Major
              Found in lib/sync.js and 1 other location - About 1 hr to fix
              lib/sync.js on lines 155..161

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

              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

                          } else if(diff.type === 'write'){
                              if(diff.isOriginRemote) {
                                  container.push(function(){ return that.writeLocalQuery(diff); });
                              } else {
                                  container.push(function(){ return that.writeRemoteQuery(diff); });
              Severity: Major
              Found in lib/sync.js and 1 other location - About 1 hr to fix
              lib/sync.js on lines 161..167

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

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

              var $28 = (function() {
              
                  function $28(apiEndpoint){
                      this.api = require('28.io-nodejs').$28(apiEndpoint);
                      this.Options = Options;
              Severity: Minor
              Found in lib/28.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(){
                              var promises = [];
                              modulePromises.forEach(function(promise){
                                  promises.push(promise());
                              });
              Severity: Major
              Found in lib/sync.js and 1 other location - About 1 hr to fix
              lib/sync.js on lines 191..197

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

              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(){
                              var promises = [];
                              queryPromises.forEach(function(promise){
                                  promises.push(promise());
                              });
              Severity: Major
              Found in lib/sync.js and 1 other location - About 1 hr to fix
              lib/sync.js on lines 184..190

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

              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(u.protocol === null) {
                              u = URL.parse(Config.getProjectEndpoint(projectName) + '/_queries' + (path[0] === '/' ? '' : '/') + path);
                          }
              Severity: Major
              Found in lib/commands/run.js and 1 other location - About 1 hr to fix
              lib/commands/run.js on lines 45..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 64.

              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(u.protocol === null) {
                              u = URL.parse(Config.getProjectEndpoint(projectName) + '/_queries' + (path[0] === '/' ? '' : '/') + path);
                          }
              Severity: Major
              Found in lib/commands/run.js and 1 other location - About 1 hr to fix
              lib/commands/run.js on lines 18..20

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

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

                  VFS.prototype.getRemoteQueries = function(){
                      return Q.all([
                          //Modules need to be listed/uploaded first,
                          //so compilation errors on main queries can make sense.
                          this.$28.Modules(this.projectEndpoint).listModules({
              Severity: Minor
              Found in lib/vfs.js - About 1 hr to fix

                Function writeRemoteQuery has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    VFS.prototype.writeRemoteQuery = function(query, reportErrors){
                        var that = this;
                        var defered = Q.defer();
                        ffs.readFile(this.localProjectPath + query, { encoding: 'utf-8' }).then(function(source){
                            source = source.toString();
                Severity: Minor
                Found in lib/vfs.js - About 1 hr to fix

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

                      Client.prototype.deleteRemoteQuery = function(diff){
                          return this.vfs.deleteRemoteQuery(diff.query).then(function(){ logDiff(diff); });
                      };
                  Severity: Major
                  Found in lib/sync.js and 2 other locations - About 1 hr to fix
                  lib/sync.js on lines 124..126
                  lib/sync.js on lines 139..141

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

                  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