sscu-budapest/datazimmer

View on GitHub

Showing 30 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

      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

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

                            def feat_to_cols(feat, proc_fk, wrap, init_prefix=(), open_to_fk=True) -> list:
                            Severity: Minor
                            Found in datazimmer/metadata/atoms.py - About 35 mins to fix

                              Function _get_persistent_state_dependencies has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  def _get_persistent_state_dependencies(self, conf: Config):
                                      for dep in self.dependencies:
                                          if isinstance(dep, type) and (PersistentState in dep.mro()):
                                              base = [CONF_KEYS.persistent_states, dep.get_full_name()]
                                              for k in conf.persistent_states.get(base[-1], {}).keys():
                              Severity: Minor
                              Found in datazimmer/pipeline_element.py - About 35 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