sscu-budapest/datazimmer

View on GitHub

Showing 32 of 32 total issues

File zenodo.py has 293 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import calendar
import datetime as dt
import json
import os
import re
Severity: Minor
Found in datazimmer/zenodo.py - About 3 hrs to fix

    File typer_commands.py has 256 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import datetime as dt
    import re
    from dataclasses import asdict
    from itertools import chain
    from pathlib import Path
    Severity: Minor
    Found in datazimmer/typer_commands.py - About 2 hrs to fix

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

          dotm_df = dog_of_the_month_table.get_full_df().loc[
              lambda df: df[DogOfTheMonth.winner.cid].isin(dog_df.index), :
      dogshow/projects/cc-dograce/{{cookiecutter.project}}/src/core.py on lines 82..83

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 44.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

          comp_df = competition_table.get_full_df().loc[
              lambda df: df[Competition.champion.cid].isin(dog_df.index), :
      dogshow/projects/cc-dograce/{{cookiecutter.project}}/src/core.py on lines 85..86

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 44.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

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

          def _parse_module(self, module):
              try:
                  base_id = CompleteIdBase.from_module_name(module.__name__, self.name)
              except NotADzObject:
                  return
      Severity: Minor
      Found in datazimmer/project_runtime.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_ns_mappers has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          def _get_ns_mappers(self, data_only=True):
              f_args = (self.runtime, self.sql_meta, self.engine, self._batch_size)
              _mapped = set()
              for ns in self.runtime.metadata.namespaces.values():
                  _mapped.add((self.runtime.name, ns.name))
      Severity: Minor
      Found in datazimmer/sql/loader.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 git_run has 9 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def git_run(
      Severity: Major
      Found in datazimmer/utils.py - About 1 hr to fix

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

        def _ds_cls_to_feat_dicts(ds_cls: Union[EntityClass, CompositeType]):
            feature_dict = get_feature_dict(ds_cls)
            ids = []
            props = []
            for k, cls in feature_dict.items():
        Severity: Minor
        Found in datazimmer/metadata/atoms.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 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def __init__(
                self,
                entity: type[AbstractEntity],
                entity_key_table_map: Optional[dict[str, "ScruTable"]] = None,
                partitioning_cols: Optional[list[str]] = None,
        Severity: Minor
        Found in datazimmer/metadata/scrutable.py - About 1 hr to fix

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

              def add_obj(self, obj):
                  for cls, l in [
                      (ScruTable, self.tables),
                      (SourceUrl, self.source_urls),
                      (PipelineElement, self.pipeline_elements),
          Severity: Minor
          Found in datazimmer/metadata/high_level.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 add_stage has 7 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def add_stage(cmd, name, outs_no_cache, outs, outs_persist, deps, params):
          Severity: Major
          Found in datazimmer/dvc_util.py - About 50 mins to fix

            Function deposit_to_zenodo has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            def deposit_to_zenodo(
            Severity: Minor
            Found in datazimmer/typer_commands.py - About 45 mins to fix

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

                  def get_data_envs(self, project, ns):
                      if project == self.name:
                          return [e.name for e in self.envs]
                      for iaf in self.imported_projects:
                          if iaf.name == project:
              Severity: Minor
              Found in datazimmer/config_loading.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 register has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              def register(
              Severity: Minor
              Found in datazimmer/pipeline_element.py - About 45 mins to fix

                Function __call__ has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    def __call__(self, df, parse=True, verbose=True, env=None, **kwargs):
                Severity: Minor
                Found in datazimmer/metadata/scrutable.py - About 35 mins to fix

                  Function import_dvc has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                  def import_dvc(uri, path, out, rev=None, no_exec=False):
                  Severity: Minor
                  Found in datazimmer/dvc_util.py - About 35 mins to fix

                    Function validate has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                    def validate(
                    Severity: Minor
                    Found in datazimmer/validation_functions.py - About 35 mins to fix

                      Function sql_validation has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                      def sql_validation(constr, env, draw=False, batch_size=2000, verbose=False):
                      Severity: Minor
                      Found in datazimmer/validation_functions.py - About 35 mins to fix

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

                            def __init__(self, title, version, lines, private: bool) -> None:
                        Severity: Minor
                        Found in datazimmer/zenodo.py - About 35 mins to fix

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

                              def __init__(self, conf: Config, private: bool, tag: str, test: bool = True):
                          Severity: Minor
                          Found in datazimmer/zenodo.py - About 35 mins to fix
                            Severity
                            Category
                            Status
                            Source
                            Language