Showing 121 of 349 total issues

Function initialize has 47 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  initialize: function(opts){
    var sorterOption, sorterFn, key, value;
    opts = opts || {};

    this.router = opts.router;
Severity: Minor
Found in swagger-ui/js/view/MainView.js - About 1 hr to fix

    Function template has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

      template: function(){
        if (this.model.isList) {
          return Handlebars.templates.param_list;
        } else {
          if (this.options.readOnly) {
    Severity: Minor
    Found in swagger-ui/js/view/ParameterView.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 render has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

      render: function(){
        if (this.model.securityDefinitions) {
          for (var name in this.model.securityDefinitions) {
            var auth = this.model.securityDefinitions[name];
            var button;
    Severity: Minor
    Found in swagger-ui/js/view/MainView.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 initialize has 39 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      initialize: function(options) {
        options = options || {};
        if(!options.highlightSizeThreshold) {
          options.highlightSizeThreshold = 100000;
        }
    Severity: Minor
    Found in swagger-ui/js/SwaggerUi.js - About 1 hr to fix

      Function getTextAreaValue has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

        getTextAreaValue: function(textArea) {
          var param, parsed, result, i;
          if (textArea.value === null || jQuery.trim(textArea.value).length === 0) {
            return null;
          }
      Severity: Minor
      Found in swagger-ui/js/view/OperationView.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 refresh_materialized has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

      def refresh_materialized(concurrent=True):
          """Refresh materialized views in dependency order
             We usually want to refresh them concurrently so that we don't block other
             connections that use the DB. In the case of tests, we cannot refresh concurrently as the
             tables are not initially populated.
      Severity: Minor
      Found in manage.py - 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 _fetch has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          def _fetch(self, last_index, sort_index=None, limit=None, eager=True):
              cursor = self.cursor
              direction = self.sort_column[1] if self.sort_column else sa.asc
              lhs, rhs = (), ()
      
      
      Severity: Minor
      Found in webservices/utils.py - 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 parse_summary_rows has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          def parse_summary_rows(self, obj):
              line_list = {}
              state_map = {}
      
              keys = zip(decoders.f3p_col_a, decoders.f3p_col_b)
      Severity: Minor
      Found in webservices/schemas.py - 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 remove_reclassification_notes has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

      def remove_reclassification_notes(statutory_citation):
          """ Statutory citations include notes on reclassification of the form
          "30120 (formerly 441d)" and "30120 (formerly 432(e)(1))". These need to be
          removed as we explicitly perform the necessary reclassifications.
          """
      Severity: Minor
      Found in webservices/legal_docs/current_murs.py - 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 render has 34 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        render: function(){
          if (this.model.securityDefinitions) {
            for (var name in this.model.securityDefinitions) {
              var auth = this.model.securityDefinitions[name];
              var button;
      Severity: Minor
      Found in swagger-ui/js/view/MainView.js - About 1 hr to fix

        Consider simplifying this complex logical expression.
        Open

            } else if (headers['Content-Disposition'] && (/attachment/).test(headers['Content-Disposition']) ||
                       headers['content-disposition'] && (/attachment/).test(headers['content-disposition']) ||
                       headers['Content-Description'] && (/File Transfer/).test(headers['Content-Description']) ||
                       headers['content-description'] && (/File Transfer/).test(headers['content-description'])) {
        
        
        Severity: Critical
        Found in swagger-ui/js/view/OperationView.js - About 1 hr to fix

          Function apply_mur_specific_query_params has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

          def apply_mur_specific_query_params(query, **kwargs):
              must_clauses = []
              if kwargs.get('mur_no'):
                  must_clauses.append(Q('terms', no=kwargs.get('mur_no')))
              if kwargs.get('mur_respondents'):
          Severity: Minor
          Found in webservices/resources/legal.py - 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 fetch_page has 10 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def fetch_page(query, kwargs, model=None, aliases=None, join_columns=None, clear=False,
          Severity: Major
          Found in webservices/utils.py - About 1 hr to fix

            Function sort has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

            def sort(query, key, model, aliases=None, join_columns=None, clear=False,
                     hide_null=False, index_column=None):
                """Sort query using string-formatted columns.
            
                :param query: Original query
            Severity: Minor
            Found in webservices/sorting.py - 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 getSelectedValue has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

              getSelectedValue: function(select) {
                if (!select.multiple) {
                  return select.value;
                } else {
                  var options = [];
            Severity: Minor
            Found in swagger-ui/js/view/OperationView.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 mouseEnter has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              mouseEnter: function(e) {
                var elem = $(this.el).find('.content');
                var x = e.pageX;
                var y = e.pageY;
                var scX = $(window).scrollLeft();
            Severity: Minor
            Found in swagger-ui/js/view/OperationView.js - About 1 hr to fix

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

              def multi_sort(query, keys, model, aliases=None, join_columns=None, clear=False,
              Severity: Major
              Found in webservices/sorting.py - About 1 hr to fix

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

                def sort(query, key, model, aliases=None, join_columns=None, clear=False,
                Severity: Major
                Found in webservices/sorting.py - About 1 hr to fix

                  Function filter_multi has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def filter_multi(query, kwargs, fields):
                      for key, column in fields:
                          if kwargs.get(key):
                              # handle combination exclude/include lists
                              exclude_list = [parse_exclude_arg(value) for value in kwargs[key] if is_exclude_arg(value)]
                  Severity: Minor
                  Found in webservices/filters.py - About 55 mins 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 filter_fulltext has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def filter_fulltext(query, kwargs, fields):
                      for key, column in fields:
                          if kwargs.get(key):
                              exclude_list = [parse_exclude_arg(value) for value in kwargs[key] if is_exclude_arg(value)]
                              include_list = [value for value in kwargs[key] if not is_exclude_arg(value)]
                  Severity: Minor
                  Found in webservices/filters.py - About 55 mins 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