acutesoftware/AIKIF

View on GitHub

Showing 136 of 361 total issues

Function select_where has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    def select_where(self, where_col_list, where_value_list, col_name=''):
        """ 
        selects rows from the array where col_list == val_list
        """
        res = []        # list of rows to be returned
Severity: Minor
Found in aikif/dataTools/cls_datatable.py - About 2 hrs 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

File cls_datatable.py has 274 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#!/usr/bin/python3
# -*- coding: utf-8 -*-
# cls_datatable.py

#from cls_dataset import DataSet
Severity: Minor
Found in aikif/dataTools/cls_datatable.py - About 2 hrs to fix

    File cls_sql_code_generator.py has 271 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    # cls_sql_code_generator.py written by Duncan Murray June 2014
    
    class SQLCodeGenerator(object):
        """ generates SQL based on a table  """
        def __init__(self, fact_table):
    Severity: Minor
    Found in aikif/dataTools/cls_sql_code_generator.py - About 2 hrs to fix

      Function _get_links has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

          def _get_links(self,):
              """ 
              return the list of links of a node
              """
              res = ''
      Severity: Minor
      Found in aikif/core_data.py - About 2 hrs 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 18 (exceeds 5 allowed). Consider refactoring.
      Open

      def main():
          allWords = []
          for f in files:
              numLines = 0
              print('Reading WordNet file - ', f)
      Severity: Minor
      Found in aikif/ontology/read_wordnet.py - About 2 hrs 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_core_programs has 57 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      def document_core_programs(p):
          """
          Document a subset of core programs with purpose (and intent)
          """
          
      Severity: Major
      Found in scripts/examples/document_AIKIF.py - About 2 hrs to fix

        Function create_roadmap_doc has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

        def create_roadmap_doc(dat, opFile):
            """
            takes a dictionary read from a yaml file and converts
            it to the roadmap documentation
            """
        Severity: Minor
        Found in scripts/examples/doc_roadmap.py - About 2 hrs 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 data_to_links has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

            def data_to_links(self, id_col_num, link_col_num, include_links_self='Y'):
                """
                This takes a table of data conaining a person identifier (Name or ID)
                and returns a table showing all links based on a common column 
                Ip table                  Links by Location  Links by Job 
        Severity: Minor
        Found in aikif/transpose.py - About 2 hrs 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 has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

            def process(self, txt, mode):
                """
                Top level function to process the command, mainly
                depending on mode.
                This should work by using the function name defined
        Severity: Minor
        Found in scripts/AI_CLI.py - About 2 hrs 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 extract_dimension has 50 lines of code (exceeds 25 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):
                """
                selects the src_cols from src_table and groups by dim_grain
                then inserts into newly created table dim_name the columns as 'dim_cols
                """
        Severity: Minor
        Found in aikif/dataTools/cls_sql_code_generator.py - About 2 hrs to fix

          Function inspect_phone has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
          Open

              def inspect_phone(self, gps_lat_long = [137.0000,100.0000], moving = False, move_dist_2_mn = 4, on_charge = True, screen_saver = False):
                  """
                  FUNCTION STUB - TODO
                  The intention is to get data from the mobile in the format:
                      gps_lat         = 137.000
          Severity: Minor
          Found in aikif/lib/cls_context.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 44 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          def main():
              p = mod_prj.Project('Allen_AI', tpe='Software', fldr=op_folder , desc='Kaggle competetion entry for Allen_AI')
          
              p.add_detail('kaggle_url', 'https://www.kaggle.com/c/the-allen-ai-science-challenge')
              p.add_detail('files_root_folder', root_folder)
          Severity: Minor
          Found in scripts/examples/allen_AI_run.py - About 1 hr to fix

            Function distinct_values has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

            def distinct_values(t_old, t_new):   
                """
                for all columns, check which values are not in 
                the other table
                """
            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 load_data has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

            def load_data(fname):
                """ loads previously exported CSV file to redis database """
                print('Loading ' + fname + ' to redis')
                r = redis.StrictRedis(host = '127.0.0.1', port = 6379, db = 0);
                with open(fname, 'r') as f:
            Severity: Minor
            Found in aikif/ontology/read_opencyc.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_as_csv has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

                def print_file_details_as_csv(self, fname, col_headers):
                    """ saves as csv format """
                    line = ''
                    qu = '"'
                    d = ','
            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 read_csv_to_html_table has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

            def read_csv_to_html_table(csvFile, hasHeader='N'):
                """
                reads a CSV file and converts it to HTML
                """
                txt = '<table class="as-table as-table-zebra as-table-horizontal">'
            Severity: Minor
            Found in aikif/web_app/web_utils.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 has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

            def show(title, lst, full=-1):
                """
                for testing, simply shows a list details
                """
                txt = title + ' (' + str(len(lst)) + ') items :\n '
            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 summarise_events has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

                def summarise_events(self):
                    """
                    takes the logfiles and produces an event summary matrix
                        date        command result  process source
                        20140421    9       40      178     9
            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 main has 38 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            def main():
                """
                This is an example of project documentation using AIKIF
                It documents the project itself, including requirements, 
                design, test, goals, 
            Severity: Minor
            Found in scripts/examples/AIKIF_project/AIKIF_project.py - About 1 hr to fix

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

                  def eight_neighbors(self, row, col):
                      """
                      Returns horiz/vert neighbors of cell (row, col) as well as
                      diagonal neighbors
                      """
              Severity: Minor
              Found in aikif/toolbox/cls_grid.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

              Severity
              Category
              Status
              Source
              Language