Showing 121 of 349 total issues

Avoid too many return statements within this function.
Open

      return this.renderer.html(html);
Severity: Major
Found in static/swagger-ui/vendor/marked.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

        return Parser.parse(Lexer.lex(src, opt), opt);
    Severity: Major
    Found in static/swagger-ui/vendor/marked.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

            return this.renderer.listitem(body);
      Severity: Major
      Found in static/swagger-ui/vendor/marked.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

              return this.renderer.listitem(body);
        Severity: Major
        Found in static/swagger-ui/vendor/marked.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                return this.renderer.table(header, body);
          Severity: Major
          Found in static/swagger-ui/vendor/marked.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                  return this.renderer.paragraph(this.parseText());
            Severity: Major
            Found in static/swagger-ui/vendor/marked.js - About 30 mins to fix

              Function fetch_seek_page has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              def fetch_seek_page(query, kwargs, index_column, clear=False, count=None, cap=100, eager=True):
                  paginator = fetch_seek_paginator(query, kwargs, index_column, clear=clear, count=count, cap=cap)
                  if paginator.sort_column is not None:
                      sort_index = kwargs['last_{0}'.format(paginator.sort_column[2])]
                      null_sort_by = paginator.sort_column[0]
              Severity: Minor
              Found in webservices/utils.py - About 25 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 getParamByName has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                getParamByName: function(name) {
                  var i;
                  if (this.model.parameters) {
                    for(i = 0; i < this.model.parameters.length; i++) {
                      if (this.model.parameters[i].name === name) {
              Severity: Minor
              Found in swagger-ui/js/view/OperationView.js - About 25 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 deploy has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              def deploy(ctx, space=None, branch=None, login=None, yes=False):
                  """Deploy app to Cloud Foundry. Log in using credentials stored per environment
                  like `FEC_CF_USERNAME_DEV` and `FEC_CF_PASSWORD_DEV`; push to either `space` or t
                  he space detected from the name and tags of the current branch. Note: Must pass `space`
                  or `branch` if repo is in detached HEAD mode, e.g. when running on Travis.
              Severity: Minor
              Found in tasks.py - About 25 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_ao_citations has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              def parse_ao_citations(text, ao_component_to_name_map):
                  matches = set()
              
                  if text:
                      for citation in AO_CITATION_REGEX.finditer(text):
              Severity: Minor
              Found in webservices/legal_docs/advisory_opinions.py - About 25 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 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def build_query(self, **kwargs):
                      query = super().build_query(**kwargs)
              
                      if {'receipts', '-receipts'}.intersection(kwargs.get('sort', [])) and 'q' not in kwargs:
                          raise exceptions.ApiError(
              Severity: Minor
              Found in webservices/resources/committees.py - About 25 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 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def build_query(self, committee_id=None, candidate_id=None, cycle=None, **kwargs):
                      query = models.CommitteeHistory.query
              
                      if committee_id:
                          query = query.filter(models.CommitteeHistory.committee_id == committee_id)
              Severity: Minor
              Found in webservices/resources/committees.py - About 25 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 a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              def related(related_model, id_label, related_id_label=None, cycle_label=None,
                          related_cycle_label=None, use_modulus=True):
                  from webservices.common.models import db
                  related_model = get_model(related_model)
                  related_id_label = related_id_label or id_label
              Severity: Minor
              Found in webservices/utils.py - About 25 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 get_citations has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              def get_citations(ao_names):
                  ao_component_to_name_map = {tuple(map(int, a.split('-'))): a for a in ao_names}
              
                  logger.info("Getting citations...")
              
              
              Severity: Minor
              Found in webservices/legal_docs/advisory_opinions.py - About 25 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 limit_remote_addr has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              def limit_remote_addr():
                  """If `FEC_API_WHITELIST_IPS` is set, reject all requests that are not
                  routed through the API Umbrella.
                  """
                  falses = (False, 'False', 'false', 'f')
              Severity: Minor
              Found in webservices/rest.py - About 25 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 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def build_query(self, committee_id=None, **kwargs):
                      query = super().build_query(committee_id=committee_id, **kwargs)
                      election_full = kwargs.get('election_full')
                      if election_full and not (kwargs.get('candidate_id') or kwargs.get('office')):
                          raise exceptions.ApiError(
              Severity: Minor
              Found in webservices/resources/aggregates.py - About 25 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 _get_index_values has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def _get_index_values(self, result):
                      """Get index values from last result, to be used in seeking to the next
                      page. Optionally include sort values, if any.
                      """
                      ret = {
              Severity: Minor
              Found in webservices/utils.py - About 25 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 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def build_query(self, committee_id=None, committee_type=None, **kwargs):
                      reports_class, reports_schema = reports_schema_map.get(
                          self._resolve_committee_type(
                              committee_id=committee_id,
                              committee_type=committee_type,
              Severity: Minor
              Found in webservices/resources/reports.py - About 25 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 check_election_arguments has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              def check_election_arguments(kwargs):
                  for arg in office_args_required:
                      if kwargs.get(arg) is None:
                          raise exceptions.ApiError(
                              'Required parameter "{0}" not found.'.format(arg),
              Severity: Minor
              Found in webservices/utils.py - About 25 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 render_ical has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              def render_ical(rows, schema):
                  calendar = Calendar()
                  for row in rows:
                      event = Event()
                      for key, value in row.items():
              Severity: Minor
              Found in webservices/calendar.py - About 25 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