acutesoftware/AIKIF

View on GitHub

Showing 136 of 361 total issues

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

    def generate_map_from_dataset(self, l_dataset):
        """
        creates a map file (in the standard CSV format) based on 
        columns of a dataset. 
        1. read column names, lookup names in list
Severity: Minor
Found in aikif/mapper.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_file_details_in_line has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def print_file_details_in_line(self, fname, col_headers):
        """
        makes a nice display of filename for printing based on columns passed
        print('{:<30}'.format(f["name"]), '{:,}'.format(f["size"]))
        """
Severity: Minor
Found in aikif/lib/cls_filelist.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 filter_by_program has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def filter_by_program(self, prg, opFile):
        """
        parse the log files and extract entries from all 
        logfiles to one file per program (program is the 
        2nd to last entry each logfile)
Severity: Minor
Found in aikif/cls_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

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

    def get_tool_by_name(self, nme):
        """
        get the tool object by name or file
        """
        for t in self.lstTools:
Severity: Minor
Found in aikif/toolbox/Toolbox.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 compare_values has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

def compare_values(t_old, t_new):
    res = '\n -- compare_values -- \n'
    pass_fail = 'OK'

    for row_num, r in enumerate(t_old.arr):
Severity: Minor
Found in scripts/examples/table_compare.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 _get_all_children has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def _get_all_children(self,):
        """ 
        return the list of children of a node
        """
        res = ''
Severity: Minor
Found in aikif/core_data.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 get_exif_data has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

def get_exif_data(image):
    """
    Returns a dictionary from the exif data of 
    an PIL Image item. Also converts the GPS Tags
    """
Severity: Minor
Found in aikif/toolbox/image_tools.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 consolidate has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def consolidate(ipFile, opFile):
    """
    make a single index file with 1 record per word which shows the word, file and linenums
        # storms, knowledge.csv - 3
        # string, rawData.csv - 1
Severity: Minor
Found in aikif/index.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 process_raw_file has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def process_raw_file(self, raw_file_name, field_names):
        """
        takes the filename to be read and uses the maps setup 
        on class instantiation to process the file.
        This is a top level function and uses self.maps which 
Severity: Minor
Found in aikif/mapper.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 solve has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def solve(m,c):
    """
    run the algorithm to find the path list
    """
    G={ (m,c,1):[] }
Severity: Minor
Found in scripts/examples/puzzle_missions_canninballs.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 agent_color has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def agent_color(self, val):
        """
        gets a colour for agent 0 - 9
        """
        if val == '0': 
Severity: Minor
Found in scripts/examples/gui_view_world.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_plan has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def load_plan(self, fname):    
        """ read the list of thoughts from a text file """
        with open(fname, "r") as f:
            for line in f:
                if line != '': 
Severity: Minor
Found in aikif/lib/cls_plan_BDI.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 _calculate_bias has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def _calculate_bias(self):
        """
        returns a weighting from 0 to 1 based on the sources.
        Due to fractions multiplying resulting in very small 
        numbers, adding 0.5 to bias calculations which means
Severity: Minor
Found in aikif/bias.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 get_lat_lon has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def get_lat_lon(exif_data):
    """
    Returns the latitude and longitude, if available, from the 
    provided exif_data (obtained through get_exif_data above)
    """
Severity: Minor
Found in aikif/toolbox/image_tools.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 show_results has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def show_results(result, missionaries,canniballs):
    print('Took ' + str(len(result)) + ' trips for ' + str(missionaries) + ' missionaries and '  + str(canniballs) + ' canniballs' )
    print(' /-----------|-----------\\')
    print('| Left Bank  | Right Bank |')
    print(' \-----------|-----------/')
Severity: Minor
Found in scripts/examples/puzzle_missions_canninballs.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 document_examples has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

def document_examples(p):
    """
    Document example programs with purpose (and intent)
    """
    p.comment('maths_ml_algorithms.py', 'machine learning algorithms for toolbox in AIKIF')
Severity: Minor
Found in scripts/examples/document_AIKIF.py - About 1 hr to fix

    Function extract_dimension has 8 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def extract_dimension(self, dim_name, dim_cols, dim_key, dim_stag_table, src_table, src_cols, grain_cols, where_clause):
    Severity: Major
    Found in aikif/dataTools/cls_sql_code_generator.py - About 1 hr to fix

      Function end_element has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def end_element(self, name):
              XMLGenerator.end_element(self, name)
              self.context.pop()
              print('end_element:name = ', name, ', self.break_into = ', self.break_into)
              if name == self.break_into:
      Severity: Minor
      Found in aikif/toolbox/xml_tools.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 __str__ has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def __str__(self):
              res = ' /---- Project ------------------------------- \n' 
              res += '|  name = ' + self.nme + '\n'
              res += '|  desc = ' + self.desc + '\n'
              res += '|  fldr = ' + self.fldr + '\n'
      Severity: Minor
      Found in aikif/project.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 reverse_pivot_to_fact has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def reverse_pivot_to_fact(self, staging_table, piv_column, piv_list, from_column, meas_names, meas_values, new_line):
      Severity: Major
      Found in aikif/dataTools/cls_sql_code_generator.py - About 50 mins to fix
        Severity
        Category
        Status
        Source
        Language