Showing 349 of 349 total issues

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

    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

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

          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 === null) {
                          this.model.oauth = {};
                        }
            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

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

              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

                            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

                  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

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

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

                      @doc(
                          tags=['filings'],
                          description=docs.FILINGS,
                          params={
                              'candidate_id': {'description': docs.CANDIDATE_ID},
                      Severity: Major
                      Found in webservices/resources/filings.py and 2 other locations - About 45 mins to fix
                      webservices/resources/candidates.py on lines 113..118
                      webservices/resources/committees.py on lines 101..106

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

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

                      @doc(
                          tags=['committee'],
                          description=docs.COMMITTEE_DETAIL,
                          params={
                              'candidate_id': {'description': docs.CANDIDATE_ID},
                      Severity: Major
                      Found in webservices/resources/committees.py and 2 other locations - About 45 mins to fix
                      webservices/resources/candidates.py on lines 113..118
                      webservices/resources/filings.py on lines 12..17

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

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

                      @doc(
                          tags=['candidate'],
                          description=docs.CANDIDATE_DETAIL,
                          params={
                              'candidate_id': {'description': docs.CANDIDATE_ID},
                      Severity: Major
                      Found in webservices/resources/candidates.py and 2 other locations - About 45 mins to fix
                      webservices/resources/committees.py on lines 101..106
                      webservices/resources/filings.py on lines 12..17

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

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

                              if kwargs.get('full_election'):
                                  query = query.filter(totals_class.full_election == kwargs['full_election'])
                      Severity: Major
                      Found in webservices/resources/totals.py and 2 other locations - About 45 mins to fix
                      webservices/resources/elections.py on lines 295..296
                      webservices/resources/elections.py on lines 297..298

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

                      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

                          def __call__(self, value):
                              if value.lstrip('-') not in self.values:
                                  raise ValidationError(
                                      'Cannot sort on value "{0}"'.format(value),
                      Severity: Minor
                      Found in webservices/args.py and 1 other location - About 45 mins to fix
                      webservices/args.py on lines 110..113

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

                      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