Showing 2,238 of 2,238 total issues

Function __init__ has 11 arguments (exceeds 5 allowed). Consider refactoring.
Open

    def __init__(
Severity: Major
Found in src/triage/component/collate/collate.py - About 1 hr to fix

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

        def get_columns(self, when=None, prefix=None, format_kwargs=None):
            """
            Args:
                when: used in a case statement to filter the rows going into the
                    aggregation function
    Severity: Minor
    Found in src/triage/component/collate/collate.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_train_task has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def process_train_task(
            self, matrix_store, class_path, parameters, model_hash, misc_db_parameters, random_seed=None, retrain=False, model_group_id=None, 
        ):
            """Trains and stores a model, or skips it and returns the existing id
    
    
    Severity: Minor
    Found in src/triage/component/catwalk/model_trainers.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 __init__ has 11 arguments (exceeds 5 allowed). Consider refactoring.
    Open

        def __init__(
    Severity: Major
    Found in src/triage/component/timechop/timechop.py - About 1 hr to fix

      Function test_compare_lists has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      def test_compare_lists():
          d = Compare("col", "=", ["a", "b", "c"], [], {}, include_null=True).quantities
          assert len(d) == 4
          assert len(set(d.values())) == len(d)
          assert len(set(d.keys())) == len(d)
      Severity: Minor
      Found in src/tests/collate_tests/test_helpers.py - About 1 hr to fix

        Function build_matrix has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def build_matrix(
                self,
                as_of_times,
                label_name,
                label_type,
        Severity: Minor
        Found in src/triage/component/architect/builders.py - About 1 hr to fix

          Function test_experiment_tracker has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          def test_experiment_tracker(test_engine, project_path):
              with mock.patch("triage.util.conf.open", side_effect=open_side_effect) as mock_file:
                  experiment = MultiCoreExperiment(
                      config=sample_config(),
                      db_engine=test_engine,
          Severity: Minor
          Found in src/tests/test_tracking_experiments.py - About 1 hr to fix

            Function _write_audit_to_db has 10 arguments (exceeds 5 allowed). Consider refactoring.
            Open

                def _write_audit_to_db(
            Severity: Major
            Found in src/triage/component/catwalk/evaluation.py - About 1 hr to fix

              Function populate_crosstabs_table has 10 arguments (exceeds 5 allowed). Consider refactoring.
              Open

              def populate_crosstabs_table(
              Severity: Major
              Found in src/triage/component/postmodeling/crosstabs.py - About 1 hr to fix

                Function __init__ has 10 arguments (exceeds 5 allowed). Consider refactoring.
                Open

                    def __init__(
                Severity: Major
                Found in src/triage/component/catwalk/__init__.py - About 1 hr to fix

                  Function _config_axes has 10 arguments (exceeds 5 allowed). Consider refactoring.
                  Open

                  def _config_axes(
                  Severity: Major
                  Found in src/triage/component/audition/plotting.py - About 1 hr to fix

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

                        def feature_loi_loo(self,
                                            model_subset=None,
                                            param_type=None,
                                            param=None,
                                            metric=None,
                    Severity: Minor
                    Found in src/triage/component/postmodeling/contrast/model_group_evaluator.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 plot_ranked_correlation_features has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def plot_ranked_correlation_features(self,
                                                             model_subset=None,
                                                             temporal_comparison=False,
                                                             figsize=(12, 16),
                                                             fontsize=20,
                    Severity: Minor
                    Found in src/triage/component/postmodeling/contrast/model_group_evaluator.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 add_predictions has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def add_predictions(db_engine, model_groups, project_path, experiment_hashes=None, train_end_times_range=None, rank_order='worst', replace=True):
                        """ For a set of modl_groups generate test predictions and write to DB
                            Args:
                                db_engine: Sqlalchemy engine
                                model_groups (list): The list of model group ids we are interested in (ideally, chosen through audition)
                    Severity: Minor
                    Found in src/triage/component/postmodeling/utils/add_predictions.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 check_entity_ids_in_files has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def check_entity_ids_in_files(filenames, matrix_uuid):
                        """Verifies if all the files in features and label have the same exact entity ids and knowledge dates"""
                        # get first 2 columns on each file (entity_id, knowledge_date)
                        for element in filenames: 
                            logging.debug(f"getting entity id and knowledge date from features {element}")
                    Severity: Minor
                    Found in src/triage/component/architect/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 _run has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def _run(self, bias_audit_config):
                            logger.spam("Validating bias audit configuration")
                            if not bias_audit_config:
                                # if empty, that's fine, shortcut out
                                return
                    Severity: Minor
                    Found in src/triage/experiments/validate.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 colname_aggregate_lookup has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def colname_aggregate_lookup(self):
                            """A reverse lookup from column name to the source collate.Aggregate
                    
                            Will error if the Aggregation contains duplicate column names
                            """
                    Severity: Minor
                    Found in src/triage/component/collate/collate.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 stitch_csvs has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def stitch_csvs(self, features_queries, label_query, matrix_store, matrix_uuid):
                            """
                            Get all features related this matrix_uuid as CSV files, as well as the labels. 
                            Join all the csv elements columnwise and create the final matrix. 
                            The last column is the label. 
                    Severity: Minor
                    Found in src/triage/component/architect/builders.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 column_imputation_lookup has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def column_imputation_lookup(self, prefix=None):
                            """
                            Args:
                                prefix: prefix for column names
                            Returns:
                    Severity: Minor
                    Found in src/triage/component/collate/collate.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 test_join_with_cohort_table has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    def test_join_with_cohort_table(db_engine):
                        # if we specify joining with the cohort table
                        # only entity_id/date pairs in the cohort table should show up
                        db_engine.execute("create table events (entity_id int, date date, outcome bool)")
                        for event in events_data:
                    Severity: Minor
                    Found in src/tests/collate_tests/test_spacetime.py - About 1 hr to fix
                      Severity
                      Category
                      Status
                      Source
                      Language