Showing 25 of 73 total issues

File processing.py has 610 lines of code (exceeds 250 allowed). Consider refactoring.
Open

###
#
# Given, in the data/output/parents/results directory:
#
# * pshtt.csv - domain-scan, based on pshtt
Severity: Major
Found in data/processing.py - About 1 day to fix

    Function https_behavior_for has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
    Open

    def https_behavior_for(name, pshtt, sslyze, parent_preloaded=None):
      report = {
        'hostname': name,
        'eligible': True
      }
    Severity: Minor
    Found in data/processing.py - About 6 hrs 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 load_domain_data has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
    Open

    def load_domain_data():
    
      domain_map = {}
      agency_map = {}
      gathered_subdomain_map = {}
    Severity: Minor
    Found in data/processing.py - About 4 hrs 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 to_csv has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

      def to_csv(domains, report_type):
        output = io.StringIO()
        writer = csv.writer(output, quoting=csv.QUOTE_NONNUMERIC)
    
        def value_for(value):
    Severity: Minor
    Found in app/models.py - About 3 hrs 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 process_domains has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

    def process_domains(domains, agencies, subdomains, parent_scan_data, subdomain_scan_data):
    
      # For each domain, determine eligibility and, if eligible,
      # use the scan data to draw conclusions.
      for domain_name in domains.keys():
    Severity: Minor
    Found in data/processing.py - About 2 hrs 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 load_parent_scan_data has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

    def load_parent_scan_data(domains):
    
      parent_scan_data = {}
      for domain_name in domains.keys():
        parent_scan_data[domain_name] = {}
    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 register has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

    def register(app):
    
        @app.route("/data/")
        def data():
            return render_template("data.html")
    Severity: Minor
    Found in app/views.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 load_subdomain_scan_data has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    def load_subdomain_scan_data(domains, parent_scan_data, gathered_subdomains):
    
      # we'll only create entries if they are in pshtt and "live"
      subdomain_scan_data = {}
    
    
    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 initExpansions has 42 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      var initExpansions = function() {
        $('table.domain').on('click', 'tbody tr.odd, tbody tr.even', function() {
          var row = table.row(this);
    
          // zero in on the parent row, whichever was clicked
    Severity: Minor
    Found in static/js/https/domains.js - About 1 hr to fix

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

      def total_crypto_report(eligible):
        total_report = {
          'eligible': len(eligible),
          'bod_crypto': 0,
          'rc4': 0,
      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 total_https_report has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

      def total_https_report(eligible):
        total_report = {
          'eligible': len(eligible),
          'uses': 0,
          'enforces': 0,
      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 options has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

      def options():
        options = {}
        for arg in sys.argv[1:]:
          if arg.startswith("--"):
      
      
      Severity: Minor
      Found in data/env.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 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

          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
            Severity
            Category
            Status
            Source
            Language