Showing 121 of 349 total issues

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

def query_with_labels(query, schema, sort_columns=False):
    """Create a new query that labels columns according to the SQLAlchemy
    model.  Properties that are excluded by `schema` will be ignored.

    Furthermore, if a "relationships" attribute is set on the schema (via the
Severity: Minor
Found in webservices/tasks/download.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

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

def parse_statutory_citations(statutory_citation, case_id, entity_id):
    citations = []
    if statutory_citation:
        statutory_citation = remove_reclassification_notes(statutory_citation)
        matches = list(STATUTE_REGEX.finditer(statutory_citation))
Severity: Minor
Found in webservices/legal_docs/current_murs.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 fetch_seek_page has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

def fetch_seek_page(query, kwargs, index_column, clear=False, count=None, cap=100, eager=True):
Severity: Major
Found in webservices/utils.py - About 50 mins to fix

    Avoid deeply nested control flow statements.
    Open

                if (this.model.oauth === null) {
                  this.model.oauth = {};
                }
    Severity: Major
    Found in swagger-ui/js/view/OperationView.js - About 45 mins to fix

      Function buildUrl has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        buildUrl: function(base, url){
          if (url.indexOf('/') === 0) {
            var parts = base.split('/');
            base = parts[0] + '//' + parts[2];
            return base + url;
      Severity: Minor
      Found in swagger-ui/js/SwaggerUi.js - About 45 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 build_query has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def build_query(self, **kwargs):
              if kwargs.get('name'):
                  kwargs['q'] = kwargs['name']
      
              query = super().build_query(**kwargs)
      Severity: Minor
      Found in webservices/resources/candidates.py - About 45 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 redis_url has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      def redis_url():
          """
          Retrieves the URL needed to connect to a Redis instance.
          """
      
      
      Severity: Minor
      Found in webservices/tasks/__init__.py - About 45 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 build_query has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def build_query(self, committee_type=None, **kwargs):
              #For this endpoint we now enforce the enpoint specified to map the right model.
              reports_class, reports_schema = reports_schema_map.get(
                  reports_type_map.get(committee_type),
                  default_schemas,
      Severity: Minor
      Found in webservices/resources/reports.py - About 45 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 related has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def related(related_model, id_label, related_id_label=None, cycle_label=None,
      Severity: Minor
      Found in webservices/utils.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                    for (m = 0, len1 = v.length; m < len1; m++) {
                      o = v[m];
                      this.model.oauth.scopes.push(o);
                    }
        Severity: Major
        Found in swagger-ui/js/view/OperationView.js - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                              for child in section.iter():
                                  if child.text:
                                      text += ' %s ' % child.text.strip()
                              heading = section.find(tag_name.format('heading')).text.strip()
          Severity: Major
          Found in webservices/legal_docs/load_legal_docs.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                      if (bull !== b && !(bull.length > 1 && b.length > 1)) {
                        src = cap.slice(i + 1).join('\n') + src;
                        i = l - 1;
                      }
            Severity: Major
            Found in static/swagger-ui/vendor/marked.js - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                  if concurrent:
                                      refresh_command = 'REFRESH MATERIALIZED VIEW CONCURRENTLY {}'.format(mv)
                                  else:
                                      refresh_command = 'REFRESH MATERIALIZED VIEW {}'.format(mv)
              
              
              Severity: Major
              Found in manage.py - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                            if (this.model.oauth.scopes === void 0) {
                              this.model.oauth.scopes = [];
                            }
                Severity: Major
                Found in swagger-ui/js/view/OperationView.js - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                            if (!loose) loose = next;
                  Severity: Major
                  Found in static/swagger-ui/vendor/marked.js - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                        for child in section.iter():
                                            if child.text:
                                                text += ' %s ' % child.text.strip()
                                        heading = section.find(tag_name.format('heading')).text.strip()
                    Severity: Major
                    Found in webservices/legal_docs/load_legal_docs.py - About 45 mins to fix

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

                      def fetch_seek_paginator(query, kwargs, index_column, clear=False, count=None, cap=100):
                      Severity: Minor
                      Found in webservices/utils.py - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                    for (a in this.auths) {
                                      auth = this.auths[a];
                                      if (auth.type === 'oauth2') {
                                        this.model.oauth = {};
                                        this.model.oauth.scopes = [];
                        Severity: Major
                        Found in swagger-ui/js/view/OperationView.js - About 45 mins to fix

                          Function process_mur has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                          Open

                          def process_mur(mur):
                              es = utils.get_elasticsearch_connection()
                              bucket = get_bucket()
                              mur_names = get_mur_names()
                              (mur_no_td, open_date_td, close_date_td, parties_td, subject_td, citations_td)\
                          Severity: Minor
                          Found in webservices/legal_docs/load_legal_docs.py - About 45 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