Showing 73 of 73 total issues

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

  for flag in ["cache", "serial", "lambda"]:
    value = options.get(flag)
    if value:
      full_command += ["--%s" % flag]
Severity: Major
Found in data/update.py and 1 other location - About 1 hr to fix
data/update.py on lines 276..279

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

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

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

  for flag in ["cache", "serial", "lambda"]:
    value = options.get(flag)
    if value:
      full_command += ["--%s" % flag]
Severity: Major
Found in data/update.py and 1 other location - About 1 hr to fix
data/update.py on lines 210..213

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

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

  var loadHostData = function(tr, base_domain, hosts) {
    var all = [];
    var number = hosts.length;

    if (number > 1) {
Severity: Minor
Found in static/js/https/domains.js - About 1 hr to fix

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

    def run(options):
      # If this is just being used to download production data, do that.
      if options.get("just-download", False):
        download_s3()
        return
    Severity: Minor
    Found in data/update.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 print_report has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    def print_report(report):
    
      for report_type in report.keys():
        # The a11y report has a very different use than the others
        if report_type == "report_date" or report_type == "a11y":
    Severity: Minor
    Found in data/processing.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 run has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    def run(date, options):
      if date is None:
        date = datetime.datetime.strftime(datetime.datetime.now(), "%Y-%m-%d")
    
      # Read in domains and agencies from domains.csv.
    Severity: Minor
    Found in data/processing.py - About 1 hr to fix

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

        def add_report(slug, report_name, report):
          return db.table('agencies').update(
            {
              report_name: report
            },
      Severity: Major
      Found in app/models.py and 1 other location - About 1 hr to fix
      app/models.py on lines 89..94

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

      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 add_report(domain_name, report_name, report):
          return db.table('domains').update(
            {
              report_name: report
            },
      Severity: Major
      Found in app/models.py and 1 other location - About 1 hr to fix
      app/models.py on lines 216..221

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

      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 run has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

      def run(date, options):
        if date is None:
          date = datetime.datetime.strftime(datetime.datetime.now(), "%Y-%m-%d")
      
        # Read in domains and agencies from domains.csv.
      Severity: Minor
      Found in data/processing.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 update_agency_totals has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      def update_agency_totals(agencies, domains, subdomains):
      
        # For each agency, update their report counts for every domain they have.
        for agency_slug in agencies.keys():
          agency = agencies[agency_slug]
      Severity: Minor
      Found in data/processing.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 scan_subdomains has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      def scan_subdomains(options):
        LOGGER.info("[scan] Scanning subdomains.")
      
        subdomains = os.path.join(SUBDOMAIN_DATA_GATHERED, "results", "gathered.csv")
      
      
      Severity: Minor
      Found in data/update.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 boolean_for(row[i+2]):
                  sources.append(source)
      
      
      Severity: Major
      Found in data/processing.py - About 45 mins to fix

        Function process_domains has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def process_domains(domains, agencies, subdomains, parent_scan_data, subdomain_scan_data):
        Severity: Minor
        Found in data/processing.py - About 35 mins to fix

          Function a11y_report_for has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

          def a11y_report_for(domain_name, domain, parent_scan_data):
            if parent_scan_data[domain_name].get('a11y') is None:
              return None
          
            a11y_report = {
          Severity: Minor
          Found in data/processing.py - About 35 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 scan_parents has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          def scan_parents(options):
            scanners = "--scan=%s" % (str.join(",", SCANNERS))
            analytics = "--analytics=%s" % ANALYTICS_URL
            output = "--output=%s" % PARENTS_DATA
            a11y_redirects = "--a11y-redirects=%s" % A11Y_REDIRECTS
          Severity: Minor
          Found in data/update.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 total_preloading_report has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          def total_preloading_report(eligible):
            total_report = {
              'eligible': len(eligible),
              'preloaded': 0,
              'preload_ready': 0
          Severity: Minor
          Found in data/processing.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 init has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

            init: function(data, options) {
              // assign data
              if (!options.data) options.data = data;
          
              // add common options to all renderTables requests
          Severity: Minor
          Found in static/js/tables.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

          TODO found
          Open

                      pass # TODO: 404
          Severity: Minor
          Found in app/views.py by fixme

          TODO found
          Open

              // TODO: Disabled because this callback runs on table init,
          Severity: Minor
          Found in static/js/tables.js by fixme

          TODO found
          Open

                    // TODO: Use Tables.percent once the participating/eligible
          Severity
          Category
          Status
          Source
          Language