Showing 2,238 of 2,238 total issues

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

    def __init__(
        self,
        config,
        db_engine,
        project_path=None,
Severity: Minor
Found in src/triage/experiments/base.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_jaccard_features has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    def plot_jaccard_features(self,
                              top_n_features=10,
                              model_subset=None,
                              temporal_comparison=False,
                              figsize=(30, 10),
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 __init__ has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def __init__(
        self,
        config,
        db_engine,
        project_path=None,
Severity: Minor
Found in src/triage/experiments/base.py - About 1 hr to fix

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

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

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

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

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

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

          Function _run has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

              def _run(self, feature_group_definition, feature_aggregation_config):
                  logger.spam("Validating of feature group definitions")
                  if not isinstance(feature_group_definition, dict):
                      raise ValueError(
                          dedent(
          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 plot_ranked_correlation_preds has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

              def plot_ranked_correlation_preds(self,
                                                 model_subset=None,
                                                 temporal_comparison=False,
                                                 figsize=(24, 10),
                                                 fontsize=12,
          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 predict_forward_with_existed_model has 38 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          def predict_forward_with_existed_model(db_engine, project_path, model_id, as_of_date):
              """Predict forward given model_id and as_of_date and store the prediction in database
          
              Args:
                      db_engine (sqlalchemy.db.engine)
          Severity: Minor
          Found in src/triage/predictlist/__init__.py - About 1 hr to fix

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

                def subsets(self, feature_dictionary):
                    """Generate subsets of a feature dict
            
                    Args:
                        feature_dictionary (dict) tables and the features contained in each
            Severity: Minor
            Found in src/triage/component/architect/feature_group_creator.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 12 (exceeds 5 allowed). Consider refactoring.
            Open

                def _run(self, temporal_config):
                    logger.spam("Validating temporal configuration")
            
                    def dt_from_str(dt_str):
                        return datetime.strptime(dt_str, "%Y-%m-%d")
            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 generate_all_dates has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

                def generate_all_dates(self, as_of_dates, cohort_table_name, cohort_hash):
                    logger.spam("Creating protected groups table")
                    table_is_new = False
                    if not table_exists(self.protected_groups_table_name, self.db_engine):
                        self.db_engine.execute(
            Severity: Minor
            Found in src/triage/component/catwalk/protected_groups_generators.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 rules has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

                def rules(self, rules):
                    """ Validates the rules passed by the user and converts them to the
                    internal representation. Can be used to validate rules before running an
                    experiment.
            
            
            Severity: Minor
            Found in src/triage/component/catwalk/baselines/thresholders.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 initialize_components has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

                def initialize_components(self):
                    split_config = self.config["temporal_config"]
            
                    self.chopper = Timechop(**split_config)
            
            
            Severity: Minor
            Found in src/triage/experiments/base.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 generate_all_labels has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

                def generate_all_labels(self, labels_table, as_of_dates, label_timespans):
                    self._create_labels_table(labels_table)
                    logger.spam(f"Creating labels for {len(as_of_dates)} as of dates and {len(label_timespans)} label timespans")
                    for as_of_date in as_of_dates:
                        for label_timespan in label_timespans:
            Severity: Minor
            Found in src/triage/component/architect/label_generators.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 model_grid_preset has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

            def model_grid_preset(grid_type, grid_config=None):
                """Load a preset model grid.
            
                   Args:
                        grid_type (string) The type of preset grid to load. May
            Severity: Minor
            Found in src/triage/experiments/defaults.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_compare_dicts has 34 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

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

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

                  def _run(self, grid_config):
                      logger.spam("Validating grid configuration")
                      if not grid_config:
                          raise ValueError(
                              dedent(
              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 _validate_categoricals has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                  def _validate_categoricals(self, categoricals):
                      logger.spam("Validating categoricals")
                      conn = self.db_engine.connect()
                      for categorical in categoricals:
                          if "choice_query" in categorical and "choices" in categorical:
              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 _compute_evaluations has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                  def _compute_evaluations(self, predictions_proba, labels, metric_definitions):
                      """Compute evaluations for a set of predictions and labels
              
                      Args:
                          predictions_proba (np.array) predictions, sorted by score descending
              Severity: Minor
              Found in src/triage/component/catwalk/evaluation.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