wikimedia/wikimedia-fundraising-tools

View on GitHub

Showing 78 of 108 total issues

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

def getData(host, port, username, password, database):
Severity: Minor
Found in FundraiserStatisticsGen/mediumgen.py - About 35 mins to fix

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

    def getPerYearData(host, port, username, password, database):
    Severity: Minor
    Found in FundraiserStatisticsGen/fundstatgen.py - About 35 mins to fix

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

          public function parseSearchResponse ( $xml_response ) {
              $responseCode = $xml_response->baseResponse->responseCode; // if xml fails its statusCode
              
              switch ( $responseCode ) {
                  case 100:
      Severity: Minor
      Found in audit/payflow/PayflowSearch.php - 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 parseSearchResponse has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          public function parseSearchResponse ( $xml_response ) {
              $responseCode = $xml_response->baseResponse->responseCode; // if xml fails its statusCode
              
              switch ( $responseCode ) {
                  case 100:
      Severity: Minor
      Found in audit/payflow/PayflowSearch.php - 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 import_altnames_file has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      def import_altnames_file(filename):
          global _geonamesDB
      
          # === Prepare things ===
          try:
      Severity: Minor
      Found in GeonameUpdater/geonames_updater.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 loadPybal has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      def loadPybal(pattern):
          files = []
          for root, dirnames, filenames in os.walk('pybal'):
              for filename in fnmatch.filter(filenames, pattern):
                  files.append(os.path.join(root, filename))
      Severity: Minor
      Found in SquidRipper/squidder.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 main has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      def main():
          # === Extract options ===
          parser = OptionParser(usage="usage: %prog [options]")
          parser.add_option("-p", "--project", dest='project', default='wikipedia', help='')
          parser.add_option("-l", "--language", dest='language', default='en', help='')
      Severity: Minor
      Found in SquidRipper/squidder.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 update_row has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def update_row(self, props, index=None, matching=None):
              if matching:
                  # TODO
                  # if len(matches) > 1:
                  #   raise Exception
      Severity: Minor
      Found in google/gdocs.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

      Avoid too many return statements within this function.
      Open

              return True
      Severity: Major
      Found in audit/paypal/TrrFile.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                    return
        Severity: Major
        Found in audit/paypal/TrrFile.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                          return
          Severity: Major
          Found in audit/paypal/TrrFile.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                        return False
            Severity: Major
            Found in audit/paypal/TrrFile.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                      return paramiko.ECDSAKey(data=base64.b64decode(keystr.split(' ')[1]))
              Severity: Major
              Found in sftp/client.py - About 30 mins to fix

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

                def load_queries(script_path):
                    '''
                    Helper to parse queries out of a SQL file.  Requires that each statement
                    ends in ;
                    '''
                Severity: Minor
                Found in database/db.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 load_results has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    def load_results(self):
                        if self.is_banner_test and self.banners:
                            cases = []
                            for name in self.banners:
                                test_case = self.get_case(
                Severity: Minor
                Found in fundraising_ab_tests/fundraising_experiment.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 iterated_test has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    def iterated_test(self, num_tests, coverage_alpha, improvement_only=False):
                        """
                        Compute a p-value testing null hypothesis H0: p_baseline == p_variation against alternative
                        hypothesis H1: p_baseline != p_variation by summing p-values conditioned on individual
                        baseline success counts. This provides a more accurate correction for multiple testing but
                Severity: Minor
                Found in stats/stats_abba.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 is_reject has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    def is_reject(self, row):
                        if not hasattr(self.config, 'rejects') or not isinstance(self.config.rejects, dict):
                            return False
                        for key in self.config.rejects:
                            config_val = self.config.rejects[key]
                Severity: Minor
                Found in audit/paypal/TrrFile.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 load_queries has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                def load_queries(file):
                    # TODO: Reuse database.db.load_queries
                
                    config = process.globals.get_config()
                
                
                Severity: Minor
                Found in silverpop_export/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

                Severity
                Category
                Status
                Source
                Language