sscu-budapest/datazimmer

View on GitHub

Showing 30 of 32 total issues

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

    def _get_data_envs(self):
        arg_set = set()
        for env in self.config.envs:
            for project_name, data_env in env.import_envs.items():
                a_imp = self.config.get_import(project_name)
Severity: Minor
Found in datazimmer/project_runtime.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

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

def _parse_elem(elem, env: str) -> str:
    if isinstance(elem, ReportFile):
        return [elem.env_posix(env)]
    if isinstance(elem, ScruTable):
        with elem.env_ctx(env):
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

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

    def _validate_table(self, table: ScruTable):
        dt_map = {}
        table_id = table.id_.sql_id
        logger.info("validating table", table=table_id)
        if not is_postgres(self.engine):
Severity: Minor
Found in datazimmer/sql/loader.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

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

def get_raw_data_path(leaf_name: str, project: Optional[str] = None) -> Path:
    """if project is None, raw data output path is given, otherwise imported"""
    loc = Path.cwd()
    for _ in range(MAX_LEVELS):
        if is_dz_project(loc):
Severity: Minor
Found in datazimmer/raw_data.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

Avoid too many return statements within this function.
Open

        return _type_or_fun_elem(elem)
Severity: Major
Found in datazimmer/pipeline_element.py - About 30 mins to fix

    Function _fill_projects has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def _fill_projects(self):
            for base_id, ns_meta in self._ns_meta_dic.items():
                proj_id = base_id.project
                if proj_id not in self.metadata_dic.keys():
                    proj_v = _get_v_of_ext_project(proj_id)
    Severity: Minor
    Found in datazimmer/project_runtime.py - About 25 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 zid_from_readme has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def zid_from_readme(self):
            zid = None
            for readme_line in README_PATH.read_text().split("\n"):
                if readme_line == CITE_HEADER:
                    break
    Severity: Minor
    Found in datazimmer/zenodo.py - About 25 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 feat_to_cols has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    def feat_to_cols(feat, proc_fk, wrap, init_prefix=(), open_to_fk=True) -> list:
        new_open_to_fk = True
        fk_to = None
        if isinstance(feat, PrimitiveFeature):
            name = PREFIX_SEP.join([*init_prefix, feat.name])
    Severity: Minor
    Found in datazimmer/metadata/atoms.py - About 25 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 deposit_to_zenodo has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    def deposit_to_zenodo(
        env: str = "",
        publish: bool = False,
        test: bool = False,
        path_filter: str = "",
    Severity: Minor
    Found in datazimmer/typer_commands.py - About 25 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 get_table_for_entity has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def get_table_for_entity(
            self, ec: EntityClass, base_table: ScruTable, feat_elems
        ) -> ScruTable:
            fixed = base_table.key_map.get(feat_elems)
            if fixed is not None:
    Severity: Minor
    Found in datazimmer/project_runtime.py - About 25 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