wikimedia/wikimedia-fundraising-tools

View on GitHub

Showing 78 of 108 total issues

Method parseReportResponse has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function parseReportResponse ( $xml_response ) {
        $statusCode = $xml_response->runReportResponse->statusCode;

        switch ( $statusCode ) {
            case 1: // Created
Severity: Minor
Found in audit/payflow/PayflowReports.php - About 1 hr to fix

    Method curl_download has 39 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function curl_download( $url, $cert, $vars = NULL ) {
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_HEADER, 0); 
        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
    Severity: Minor
    Found in Paypal_refunder/go.php - About 1 hr to fix

      Method runSearch has 37 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function runSearch() {
              $xml = $this->runSearchRequest();
              $request = $this->createRequest( $xml );
          
              $rc = $this->sendRequest( $request );
      Severity: Minor
      Found in audit/payflow/PayflowSearch.php - About 1 hr to fix

        Function fetch has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

        def fetch():
            out = csv.DictWriter(sys.stdout, [
                'campaign',
                'banner',
                'start',
        Severity: Minor
        Found in live_analysis/dump_tests.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 should_send has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            def should_send(self, out, queue_name, row, event_type):
                if not queue_name:
                    log.info("-Unknown\t{id}\t{date}\t(Type {type})".format(id=out['gateway_txn_id'], date=out['date'], type=event_type))
                    return False
        
        
        Severity: Minor
        Found in audit/paypal/TrrFile.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 update_gdoc_spec has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

        def update_gdoc_spec(doc=None, spec=None):
            log.info("Updating test specs with latest CentralNotice changes... {url}".format(url=doc))
        
            # FIXME: currently, the spec must have been read with read_gdoc_spec in order to get row numbers
            if not spec:
        Severity: Minor
        Found in fundraising_ab_tests/spec_gdoc.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 import_geonames_file has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

        def import_geonames_file(filename):
            global _geonamesDB
        
            # === Prepare things ===
            try:
        Severity: Minor
        Found in GeonameUpdater/geonames_updater.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 main has 10 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def main(host, port, user, password, database, tablename, delete, autoindex, schema, filename):
        Severity: Major
        Found in CsvToSql/csv2sql.py - About 1 hr to fix

          Function parseReportResponse has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

              public function parseReportResponse ( $xml_response ) {
                  $statusCode = $xml_response->runReportResponse->statusCode;
          
                  switch ( $statusCode ) {
                      case 1: // Created
          Severity: Minor
          Found in audit/payflow/PayflowReports.php - 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 get_totals has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

          def get_totals(wheres=None, query=None, banner=None, campaign=None, country=None, start=None, end=None, **ignore):
              '''
              Note that the column names must match a heading in the results spreadsheet.
              '''
              config = get_config()
          Severity: Minor
          Found in mediawiki/centralnotice/contributions.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 tests_from_entry has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

          def tests_from_entry(entry):
              '''
              Returns a tuple, (test ended, test begun)
          
              Start and end times are fudged quite a bit, all we care about
          Severity: Minor
          Found in fundraising_ab_tests/campaign_log.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

          Method runAudit has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function runAudit( $begin, $end ) {
                  $report = new CustomReport( array ( $begin . ' 00:00:00', $end . ' 23:59:59') );
                  if ( $report->runReport()) {
                      $results = $report->getResults();           
                  } else {
          Severity: Minor
          Found in audit/payflow/PayflowAudit.php - About 1 hr to fix

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

                def pull():
                    '''Pull down new remote files'''
            
                    config = process.globals.get_config()
            
            
            Severity: Minor
            Found in sftp/client.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 main has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

            def main(host, port, user, password, database, tablename, delete, autoindex, schema, filename):
                global colproto
            
                # === Connection to MySQL ===
                db = MySQL.connect(host=host, port=port, user=user, passwd=password, db=database)
            Severity: Minor
            Found in CsvToSql/csv2sql.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 rotate_files has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

            def rotate_files():
                config = process.globals.get_config()
            
                # Clean up after ourselves
                if config.days_to_keep_files:
            Severity: Minor
            Found in silverpop_export/export.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 execute has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

                def execute(self, sql, params=None, timeout=0):
                    cursor = self.db_conn.cursor(cursor=pymysql.cursors.DictCursor)
                    deathClock = None
            
                    if self.debug:
            Severity: Minor
            Found in database/db.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 main has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            def main(host, port, user, password, database, tablename, delete, autoindex, schema, filename):
                global colproto
            
                # === Connection to MySQL ===
                db = MySQL.connect(host=host, port=port, user=user, passwd=password, db=database)
            Severity: Minor
            Found in CsvToSql/csv2sql.py - About 1 hr to fix

              Function updateAll has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              def updateAll():
                  log.info("Loading schema update set ")
                  drop_queries = load_queries('drop_schema.sql')
                  log.info("Loading schema update set ")
                  rebuild_queries = load_queries('rebuild_schema.sql')
              Severity: Minor
              Found in silverpop_export/update.py - About 1 hr to fix

                Method parseSearchResponse has 26 lines of code (exceeds 25 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 1 hr to fix

                  Function main has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  def main():
                      # Extract any command line options
                      parser = OptionParser(usage="usage: %prog [options] <working directory>")
                      parser.add_option("-c", "--config", dest='configFile', default=None, help='Path to configuration file')
                      (options, args) = parser.parse_args()
                  Severity: Minor
                  Found in FundraiserStatisticsGen/fundstatgen.py - About 1 hr to fix
                    Severity
                    Category
                    Status
                    Source
                    Language