lib/28.js

Summary

Maintainability
D
2 days
Test Coverage

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 $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

    Function sync has 9 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        $28.prototype.sync = function(type, projectEndpoint, projectToken, localProjectPath, overwrite, deleteOrphaned, simulate, ignore, concurrency) {
    Severity: Major
    Found in lib/28.js - About 1 hr to fix

      Function download has 8 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          $28.prototype.download = function(projectEndpoint, projectToken, localProjectPath, overwrite, deleteOrphaned, simulate, ignore, concurrency) {
      Severity: Major
      Found in lib/28.js - About 1 hr to fix

        Function upload has 8 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            $28.prototype.upload = function(projectEndpoint, projectToken, localProjectPath, overwrite, deleteOrphaned, simulate, ignore, concurrency) {
        Severity: Major
        Found in lib/28.js - About 1 hr to fix

          Function updateDefaultMongoDBCredentials has 8 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                  projectName, token, dbType, connString, db, username, password, preDigested
          Severity: Major
          Found in lib/28.js - About 1 hr to fix

            Function updateDatasource has 7 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                $28.prototype.updateDatasource = function(projectEndpoint, name, category, newname, token, difault, credentials){
            Severity: Major
            Found in lib/28.js - About 50 mins to fix

              Function createDatasource has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  $28.prototype.createDatasource = function(projectEndpoint, category, name, token, difault, credentials){
              Severity: Minor
              Found in lib/28.js - About 45 mins to fix

                Function import has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    $28.prototype.import = function(projectEndpoint, projectToken, archive, contentType, root){
                Severity: Minor
                Found in lib/28.js - About 35 mins to fix

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

                      $28.prototype.setCustomRewriteRules = function(projectName, token, customRewrites) {
                          return this.api.Project.setCustomRewriteRules({ projectName: projectName, token: token, customRewrites: customRewrites });
                      };
                  Severity: Major
                  Found in lib/28.js and 1 other location - About 1 hr to fix
                  lib/28.js on lines 61..67

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

                  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

                      $28.prototype.resetPassword = function(email, password, token) {
                          return this.api.Account.updateAccount({
                              email: email,
                              password: password,
                              token: token
                  Severity: Major
                  Found in lib/28.js and 1 other location - About 1 hr to fix
                  lib/28.js on lines 105..107

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

                  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

                      $28.prototype.login = function(email, password) {
                          return this.api.Auth.authenticate({
                              email: email,
                              password: password,
                              grant_type: 'client_credentials'
                  Severity: Major
                  Found in lib/28.js and 1 other location - About 1 hr to fix
                  lib/28.js on lines 45..51

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

                      $28.prototype.refreshTokens = function(email, token){
                          return this.api.Auth.authenticate({
                              email: email,
                              refresh_token: token,
                              grant_type: 'refresh_token'
                  Severity: Major
                  Found in lib/28.js and 1 other location - About 1 hr to fix
                  lib/28.js on lines 53..59

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

                      $28.prototype.upgradeProject = function(name, token) {
                          return this.api.Project.upgradeProject({
                              projectName: name,
                              token: token
                          });
                  Severity: Major
                  Found in lib/28.js and 3 other locations - About 50 mins to fix
                  lib/28.js on lines 90..95
                  lib/28.js on lines 101..103
                  lib/28.js on lines 142..147

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

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

                      $28.prototype.getCustomRewriteRules = function(projectName, token){
                          return this.api.Project.getCustomRewriteRules({ projectName: projectName, token: token });
                      };
                  Severity: Major
                  Found in lib/28.js and 3 other locations - About 50 mins to fix
                  lib/28.js on lines 75..80
                  lib/28.js on lines 90..95
                  lib/28.js on lines 142..147

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

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

                      $28.prototype.deleteProject = function(projectName, token){
                          return this.api.Project.deleteProject({
                              projectName: projectName,
                              token: token
                          });
                  Severity: Major
                  Found in lib/28.js and 3 other locations - About 50 mins to fix
                  lib/28.js on lines 75..80
                  lib/28.js on lines 101..103
                  lib/28.js on lines 142..147

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

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

                      $28.prototype.getDefaultMongoDBCredentials = function(projectName, token){
                          return this.api.Project.getDefaultMongoDBCredentials({
                              projectName: projectName,
                              token: token
                          });
                  Severity: Major
                  Found in lib/28.js and 3 other locations - About 50 mins to fix
                  lib/28.js on lines 75..80
                  lib/28.js on lines 90..95
                  lib/28.js on lines 101..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 52.

                  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

                      $28.prototype.download = function(projectEndpoint, projectToken, localProjectPath, overwrite, deleteOrphaned, simulate, ignore, concurrency) {
                          return this.sync('download', projectEndpoint, projectToken, localProjectPath, overwrite, deleteOrphaned, simulate, ignore, concurrency);
                      };
                  Severity: Minor
                  Found in lib/28.js and 1 other location - About 35 mins to fix
                  lib/28.js on lines 25..27

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

                  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

                      $28.prototype.upload = function(projectEndpoint, projectToken, localProjectPath, overwrite, deleteOrphaned, simulate, ignore, concurrency) {
                          return this.sync('upload', projectEndpoint, projectToken, localProjectPath, overwrite, deleteOrphaned, simulate, ignore, concurrency);
                      };
                  Severity: Minor
                  Found in lib/28.js and 1 other location - About 35 mins to fix
                  lib/28.js on lines 21..23

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

                  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