Showing 2,238 of 2,238 total issues

Function best_average_two_metrics has 8 arguments (exceeds 5 allowed). Consider refactoring.
Open

def best_average_two_metrics(
Severity: Major
Found in src/triage/component/audition/selection_rules.py - About 50 mins to fix

    Function add_predictions has 7 arguments (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):
    Severity: Major
    Found in src/triage/component/postmodeling/utils/add_predictions.py - About 45 mins to fix

      Function make_entity_date_table has 7 arguments (exceeds 5 allowed). Consider refactoring.
      Open

          def make_entity_date_table(
      Severity: Major
      Found in src/triage/component/architect/builders.py - About 45 mins to fix

        Function matrix_with_sorted_columns has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def matrix_with_sorted_columns(self, columns):
                """Return the matrix with columns sorted in the given column order
        
                Args:
                    columns (list) The order of column names to return.
        Severity: Minor
        Found in src/triage/component/catwalk/storage.py - About 45 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 7 arguments (exceeds 5 allowed). Consider refactoring.
        Open

            def __init__(
        Severity: Major
        Found in src/triage/component/architect/builders.py - About 45 mins to fix

          Function _validate_keys has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def _validate_keys(self, aggregation_config):
                  logger.spam("Validating feature aggregation keys")
                  for key in [
                      "from_obj",
                      "intervals",
          Severity: Minor
          Found in src/triage/experiments/validate.py - About 45 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 7 arguments (exceeds 5 allowed). Consider refactoring.
          Open

              def __init__(self, config, db_engine, *args, n_processes=1, n_bigtrain_processes=1, n_db_processes=1, **kwargs):
          Severity: Major
          Found in src/triage/experiments/multicore.py - About 45 mins to fix

            Function get_aequitas_results has 7 arguments (exceeds 5 allowed). Consider refactoring.
            Open

            def get_aequitas_results(engine, parameter, schema="test_results", table="aequitas", model_id=None,  subset_hash="", tie_breaker="worst"):
            Severity: Major
            Found in src/triage/component/postmodeling/fairness/aequitas_utils.py - About 45 mins to fix

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

                  def __init__(self, db_engine, from_obj, attribute_columns, entity_id_column, knowledge_date_column, protected_groups_table_name, replace=True):
              Severity: Major
              Found in src/triage/component/catwalk/protected_groups_generators.py - About 45 mins to fix

                Function plot_feature_importances_std_err has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    def plot_feature_importances_std_err(self,
                                                         path,
                                                         bar=True,
                                                         n_features_plots=30,
                                                         figsize=(16,21),
                Severity: Minor
                Found in src/triage/component/postmodeling/contrast/model_evaluator.py - About 45 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 scores_align_with_ranks has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                def scores_align_with_ranks(expected_ranks, returned_scores):
                    '''
                    Helper function to check that scores align with ranks
                    correctly for the ranking baselines (e.g., higher ranks
                    get higher scores and ties have the same score)
                Severity: Minor
                Found in src/tests/catwalk_tests/test_baselines.py - About 45 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 remove_entity_id_and_knowledge_dates has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                def remove_entity_id_and_knowledge_dates(filenames, matrix_uuid):
                    """drop entity id and knowledge date from all features and label files but one""" 
                    correct_filenames = []
                
                    for i in range(len(filenames)):
                Severity: Minor
                Found in src/triage/component/architect/utils.py - About 45 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

                Avoid deeply nested control flow statements.
                Open

                                        if col.name in lookup:
                                            raise ValueError("Duplicate feature column name found: ", col.name)
                                        lookup[col.name] = agg
                Severity: Major
                Found in src/triage/component/collate/spacetime.py - About 45 mins to fix

                  Function process_task has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def process_task(self, test_store, train_store, train_kwargs):
                          logger.verbose(f"Training {train_kwargs.get('class_path')}({train_kwargs.get('parameters')}) [{train_kwargs.get('model_hash')}] on train matrix {train_store.uuid}")
                  
                          # If the matrices and train labels are OK, train and test the model!
                          with self.model_trainer.cache_models(), test_store.cache(), train_store.cache():
                  Severity: Minor
                  Found in src/triage/component/catwalk/__init__.py - About 45 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

                  Avoid deeply nested control flow statements.
                  Open

                                      if (
                                          feat in exp_imp_cols
                                          and coltype != "categorical"
                                          and imp != "zero_noflag"
                                      ):
                  Severity: Major
                  Found in src/tests/collate_tests/test_imputation_output.py - About 45 mins to fix

                    Function make_metadata has 7 arguments (exceeds 5 allowed). Consider refactoring.
                    Open

                        def make_metadata( 
                    Severity: Major
                    Found in src/triage/component/architect/planner.py - About 45 mins to fix

                      Function build_matrix has 7 arguments (exceeds 5 allowed). Consider refactoring.
                      Open

                          def build_matrix(
                      Severity: Major
                      Found in src/triage/component/architect/builders.py - About 45 mins to fix

                        Function __init__ has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def __init__(
                                self,
                                col,
                                op,
                                choices,
                        Severity: Minor
                        Found in src/triage/component/collate/collate.py - About 45 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 generate_matrix_definitions has 7 arguments (exceeds 5 allowed). Consider refactoring.
                        Open

                            def generate_matrix_definitions(
                        Severity: Major
                        Found in src/triage/component/timechop/timechop.py - About 45 mins to fix

                          Function best_avg_var_penalized has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                          Open

                          def best_avg_var_penalized(df, train_end_time, metric, parameter, stdev_penalty, n=1):
                              """Pick the model with the highest
                               average metric value so far, placing less weight in older
                               results. You need to specify two parameters: the shape of how the
                               weight affects points (decay_type, linear or exponential) and the relative
                          Severity: Minor
                          Found in src/triage/component/audition/selection_rules.py - About 45 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