Aigeruth/docker-private-registry

View on GitHub

Showing 66 of 66 total issues

File swagger.js has 1430 lines of code (exceeds 250 allowed). Consider refactoring.
Open

// swagger.js
// version 2.0.37

var __bind = function(fn, me){
  return function(){
Severity: Major
Found in public/js/lib/swagger.js - About 3 days to fix

    Function SwaggerOperation has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.
    Open

    var SwaggerOperation = function(nickname, path, method, parameters, summary, notes, type, responseMessages, resource, consumes, produces, authorizations) {
      var _this = this;
    
      var errors = [];
      this.nickname = (nickname||errors.push("SwaggerOperations must have a nickname."));
    Severity: Minor
    Found in public/js/lib/swagger.js - About 7 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 SwaggerRequest has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
    Open

    var SwaggerRequest = function(type, url, params, opts, successCallback, errorCallback, operation, execution) {
      var _this = this;
      var errors = [];
      this.useJQuery = (typeof operation.resource.useJQuery !== 'undefined' ? operation.resource.useJQuery : null);
      this.type = (type||errors.push("SwaggerRequest type is required (get/post/put/delete/patch/options)."));
    Severity: Minor
    Found in public/js/lib/swagger.js - About 6 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 execute has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
    Open

    JQueryHttpClient.prototype.execute = function(obj) {
      var cb = obj.on;
      var request = obj;
    
      obj.type = obj.method;
    Severity: Minor
    Found in public/js/lib/swagger.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 setHeaders has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
    Open

    SwaggerRequest.prototype.setHeaders = function(params, operation) {
      // default type
      var accepts = "application/json";
      var consumes = "application/json";
    
    
    Severity: Minor
    Found in public/js/lib/swagger.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 addOperations has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
    Open

    SwaggerResource.prototype.addOperations = function(resource_path, ops, consumes, produces) {
      if (ops) {
        output = [];
        for (var i = 0; i < ops.length; i++) {
          o = ops[i];
    Severity: Minor
    Found in public/js/lib/swagger.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 SwaggerRequest has 97 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    var SwaggerRequest = function(type, url, params, opts, successCallback, errorCallback, operation, execution) {
      var _this = this;
      var errors = [];
      this.useJQuery = (typeof operation.resource.useJQuery !== 'undefined' ? operation.resource.useJQuery : null);
      this.type = (type||errors.push("SwaggerRequest type is required (get/post/put/delete/patch/options)."));
    Severity: Major
    Found in public/js/lib/swagger.js - About 3 hrs to fix

      Function SwaggerOperation has 95 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      var SwaggerOperation = function(nickname, path, method, parameters, summary, notes, type, responseMessages, resource, consumes, produces, authorizations) {
        var _this = this;
      
        var errors = [];
        this.nickname = (nickname||errors.push("SwaggerOperations must have a nickname."));
      Severity: Major
      Found in public/js/lib/swagger.js - About 3 hrs to fix

        Function handleLogin has 91 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function handleLogin() {
          var scopes = [];
        
          if(window.swaggerUi.api.authSchemes 
            && window.swaggerUi.api.authSchemes.oauth2
        Severity: Major
        Found in public/js/lib/swagger-oauth.js - About 3 hrs to fix

          Function apply has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
          Open

          SwaggerAuthorizations.prototype.apply = function(obj, authorizations) {
            var status = null;
            var key;
          
            // if the "authorizations" key is undefined, or has an empty array, add all keys
          Severity: Minor
          Found in public/js/lib/swagger.js - About 3 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

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

                      if(param.defaultValue != null) {
                        param.allowableValues.descriptiveValues.push ({
                          value: String(v),
                          isDefault: (v === param.defaultValue)
                        });
          Severity: Major
          Found in public/js/lib/swagger.js and 1 other location - About 3 hrs to fix
          public/js/lib/swagger.js on lines 731..742

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

          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(param.defaultValue != null) {
                    param.allowableValues.descriptiveValues.push ({
                      value: String(v),
                      isDefault: (v === param.defaultValue)
                    });
          Severity: Major
          Found in public/js/lib/swagger.js and 1 other location - About 3 hrs to fix
          public/js/lib/swagger.js on lines 755..766

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

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

          SwaggerOperation.prototype.formatXml = function(xml) {
            var contexp, formatted, indent, lastType, lines, ln, pad, reg, transitions, wsexp, _fn, _i, _len;
            reg = /(>)(<)(\/*)/g;
            wsexp = /[ ]*(.*)[ ]+\n/g;
            contexp = /(<.+>)(.+\n)/g;
          Severity: Major
          Found in public/js/lib/swagger.js - About 2 hrs to fix

            Function execute has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
            Open

            ShredHttpClient.prototype.execute = function(obj) {
              if(!this.isInitialized)
                this.initShred();
            
              var cb = obj.on, res;
            Severity: Minor
            Found in public/js/lib/swagger.js - About 2 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

            Class LocalStorageImage has 24 methods (exceeds 20 allowed). Consider refactoring.
            Open

                class LocalStorageImage < BaseImage
                  PREFIX = 'images'
            
                  def path
                    File.join LocalStorageBackend.storage_path, PREFIX, id
            Severity: Minor
            Found in backends/local_storage/image.rb - About 2 hrs to fix

              Function getSampleJSON has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
              Open

              SwaggerOperation.prototype.getSampleJSON = function(type, models) {
                var isPrimitive, listType, val;
                listType = this.isListType(type);
                isPrimitive = ((listType != null) && models[listType]) || (models[type] != null) ? false : true;
                val = isPrimitive ? void 0 : (listType != null ? models[listType].createJSONSample() : models[type].createJSONSample());
              Severity: Minor
              Found in public/js/lib/swagger.js - About 2 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 execute has 63 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              JQueryHttpClient.prototype.execute = function(obj) {
                var cb = obj.on;
                var request = obj;
              
                obj.type = obj.method;
              Severity: Major
              Found in public/js/lib/swagger.js - About 2 hrs to fix

                Function setHeaders has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                SwaggerRequest.prototype.setHeaders = function(params, operation) {
                  // default type
                  var accepts = "application/json";
                  var consumes = "application/json";
                
                
                Severity: Major
                Found in public/js/lib/swagger.js - About 2 hrs to fix

                  Function urlify has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                  Open

                  SwaggerOperation.prototype.urlify = function(args) {
                    var url = this.resource.basePath + this.pathJson();
                    var params = this.parameters;
                    for(var i = 0; i < params.length; i ++){
                      var param = params[i];
                  Severity: Minor
                  Found in public/js/lib/swagger.js - About 2 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 buildFrom1_1Spec has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                  Open

                  SwaggerApi.prototype.buildFrom1_1Spec = function(response) {
                    log("This API is using a deprecated version of Swagger!  Please see http://github.com/wordnik/swagger-core/wiki for more info");
                    if (response.apiVersion != null)
                      this.apiVersion = response.apiVersion;
                    this.apis = {};
                  Severity: Minor
                  Found in public/js/lib/swagger.js - About 2 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

                  Severity
                  Category
                  Status
                  Source
                  Language