18F/domain-scan

View on GitHub

Showing 65 of 65 total issues

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

def write_rows(rows, domain, base_domain, scanner, csv_writer, meta={}):
Severity: Minor
Found in utils/scan_utils.py - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                                if prefix.endswith('.conformsTo') or prefix.endswith('.conformsto'):
                                    results[page]['opendata_conforms_to'] = ' '.join([value, results[page]['opendata_conforms_to']])
    
                                # see if there is a 'measurementType' field, which indicates that it might
                                # be code.gov compliant.  Taken from https://code.gov/about/compliance/inventory-code
    Severity: Major
    Found in scanners/pagedata.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                                  if prefix.endswith('.measurementType') or prefix.endswith('.measurementtype'):
                                      results[page]['codegov_measurementtype'] = ' '.join([value, results[page]['codegov_measurementtype']])
                                  if prefix.endswith('measurementType.method') or prefix.endswith('measurementtype.method'):
      Severity: Major
      Found in scanners/pagedata.py - About 45 mins to fix

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

        def write_rows(rows, domain, base_domain, scanner, csv_writer, meta=None):
        Severity: Minor
        Found in runner/runner.py - About 45 mins to fix

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

          var scan = async function (domain, environment, options, getBrowser, scanner, callback) {
          Severity: Minor
          Found in scanners/headless/base.js - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                        if prefix.endswith('measurementType.method') or prefix.endswith('measurementtype.method'):
                                            results[page]['codegov_measurementtype'] = ' '.join([value, results[page]['codegov_measurementtype']])
                                        if prefix.endswith('measurementType.ifOther') or prefix.endswith('measurementtype.ifOther'):
            Severity: Major
            Found in scanners/pagedata.py - About 45 mins to fix

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

              def init_domain(domain, environment, options):
                  cache_dir = options.get("_", {}).get("cache_dir", "./cache")
                  # If we have data from pshtt, skip if it's not a live domain.
                  if utils.domain_not_live(domain, cache_dir=cache_dir):
                      logging.debug("\tSkipping, domain not reachable during inspection.")
              Severity: Minor
              Found in scanners/csp.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 init_domain has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

              def init_domain(domain, environment, options):
                  cache_dir = options.get("_", {}).get("cache_dir", "./cache")
                  # If we have data from pshtt, skip if it's not a live domain.
                  if utils.domain_not_live(domain):
                      logging.debug("\tSkipping, domain not reachable during inspection.")
              Severity: Minor
              Found in scanners/third_parties.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 event == 'string':
                                              counter = counter + 1
              
                                          # see if there is a 'conformsTo' field, which indicates that it might
                                          # be open-data compliant.
              Severity: Major
              Found in scanners/pagedata.py - About 45 mins to fix

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

                def run_sslyze(data, environment, options):
                    # Each sslyze worker can use a sync or parallel mode.
                    #
                    # SynchronousScanner can show memory leaks when parsing certs,
                    # so local scanning defaults to using ConcurrentScanner.
                Severity: Minor
                Found in scanners/sslyze.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 prefix.endswith('measurementType.ifOther') or prefix.endswith('measurementtype.ifOther'):
                                                results[page]['codegov_measurementtype'] = ' '.join([value, results[page]['codegov_measurementtype']])
                
                
                Severity: Major
                Found in scanners/pagedata.py - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                      if domain_suffix.startswith("."):
                                          sep = ""
                                      yield "%s%s%s" % (domain, sep, domain_suffix)
                  Severity: Major
                  Found in utils/scan_utils.py - About 45 mins to fix

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

                    def init_domain(domain, environment, options):
                        cache_dir = options.get("_", {}).get("cache_dir", "./cache")
                        # If we have data from pshtt, skip if it's not a live domain.
                        if utils.domain_not_live(domain):
                            logging.debug("\tSkipping, domain not reachable during inspection.")
                    Severity: Minor
                    Found in scanners/uswds.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

                    Consider simplifying this complex logical expression.
                    Open

                        if sslv2 and sslv3 and tlsv1 and tlsv1_1 and tlsv1_2 and tlsv1_3:
                            analyze_protocols_and_ciphers(data, sslv2, sslv3, tlsv1, tlsv1_1, tlsv1_2, tlsv1_3)
                    
                    
                    Severity: Major
                    Found in scanners/sslyze.py - About 40 mins to fix

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

                      def init_sslyze(hostname, port, starttls_smtp, options, sync=False):
                      Severity: Minor
                      Found in scanners/sslyze.py - About 35 mins to fix

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

                            def gather(self):
                                # Defaults to --url, but can be overridden.
                                name = self.extra.get("name", "url")
                                url = self.options.get(name)
                        
                        
                        Severity: Minor
                        Found in gatherers/url.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 configure_logging has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                        Open

                        def configure_logging(options=None):
                            options = {} if not options else options
                            if options.get('debug', False):
                                log_level = "debug"
                            else:
                        Severity: Minor
                        Found in utils/utils.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 callback has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                        Open

                          var callback = function(err, data) {
                            console.log("Done:\n");
                        
                            if (err) {
                              console.log("Error:")
                        Severity: Minor
                        Found in lambda/headless/lambda_handler.js - 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

                        Avoid too many return statements within this function.
                        Open

                                        return False
                        Severity: Major
                        Found in scanners/a11y.py - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                              return True
                          Severity: Major
                          Found in scanners/a11y.py - About 30 mins to fix
                            Severity
                            Category
                            Status
                            Source
                            Language