acutesoftware/rawdata

View on GitHub

Showing 34 of 73 total issues

Avoid deeply nested control flow statements.
Open

                    if r[2] == row_loc:
                        amt += get_num_from_curr(r[4])
            tbl_agg.append([row_worker, row_loc, amt])
Severity: Major
Found in scripts/multigrain_data_generator.py - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                            if lst['name'] != 'INT':
                                if lst['name'] == self.colTypes[c]:
                                    txt = get_rand_text_from_list(lst['lst'])
                    thisRow.append(txt)
    Severity: Major
    Found in rawdata/generate.py - About 45 mins to fix

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

      def save_table(tbl, hdr, fname, delim=',', qu='"'):
      Severity: Minor
      Found in scripts/multigrain_data_generator.py - About 35 mins to fix

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

        def rebuild_index():
            """
            scans rawdata\data\ folders to create lookups
            of all tables, column names
            """
        Severity: Minor
        Found in scripts/install.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():
            """
            run in a loop and log the caption of the 
            active window every second. Save to disk
            each minute
        Severity: Minor
        Found in scripts/gather/sys_PC_usage.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 identify_grain_csv has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        def identify_grain_csv(fname):
            """
            get counts in all columns until matched count(*)
            to guess the grain of the current table
            """
        Severity: Minor
        Found in scripts/identify_grain.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 __str__ has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def __str__(self):
                res = ''
                res += 'name  = ' +  self.trend_dict['name'] + '\n'
                res += 'scale = ' + self.trend_dict['scale'] + '\n'
                res += 'trend = ' 
        Severity: Minor
        Found in rawdata/events.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 __init__ has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def __init__(self, root_path):
                self.sample_list = []      # filelist = [shortname, fullpath]
                self.samples = []          # list of Sample objects
                self.root_path = root_path # os.getcwd() + os.sep + 'samples'
                for root, _, files in os.walk(self.root_path):
        Severity: Minor
        Found in rawdata/content.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_from_file has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def load_from_file(self, fname, delim=',', quote='"'):
                """
                recreates the internal table tbl from an external file
                Use this for sample data generation based on existing 
                data or for extracting unique lists (ie categories from
        Severity: Minor
        Found in rawdata/errors.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 agg_3 has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        def agg_3(tbl, colLabel):    
            # Table 3 - grain_year.csv
            # has one record for every year
            tbl_agg = []
            for row_year in years:
        Severity: Minor
        Found in scripts/multigrain_data_generator.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 get_dual_col_counts has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        def get_dual_col_counts(tbl):
            """
            get counts by 2 cols of a table
                Grain of grain_year.csv is :  DATE, Total Amount,
                dual col: DATE,Total Amount
        Severity: Minor
        Found in scripts/identify_grain.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

            def __init__(self, mult_range, exp_range, num_terms=3):
                self.num_terms = num_terms
                self.equation = ''
                self.mult = [random.randint(mult_range[0], mult_range[1] ) for _ in range(self.num_terms + 1)]
                self.expt = [random.randint(exp_range[0], exp_range[1]) for _ in range(self.num_terms + 1)]
        Severity: Minor
        Found in rawdata/generate.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 agg_2 has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        def agg_2(tbl, colLabel):    
            # Table 2 - grain_person_year.csv
            # has one record for every person per year
            tbl_agg = []
            for row_worker in workers:
        Severity: Minor
        Found in scripts/multigrain_data_generator.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 get_index_terms has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        def get_index_terms(fname):
            """
            reads the file 'fname' and returns all index values
            for it in terms of fname.col_name, e.g.
            finance_transactions.transaction_type
        Severity: Minor
        Found in scripts/install.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