navikt/dataverk

View on GitHub

Showing 27 of 27 total issues

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

def get_schema(df: pd.DataFrame, path: str, dataset_name: str, format: str, dsv_separator: str):
Severity: Minor
Found in src/dataverk/utils/metadata_utils.py - About 35 mins to fix

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

    def _replace_value(df, eval_column, columns, evaluator, replace_by):
    Severity: Minor
    Found in src/dataverk/utils/anonymization.py - About 35 mins to fix

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

          def __init__(
      Severity: Minor
      Found in src/dataverk/resources/json_resource.py - About 35 mins to fix

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

        def get_schema(df: pd.DataFrame, path: str, dataset_name: str, format: str, dsv_separator: str):
            fields = []
        
            for name, dtype in zip(df.columns, df.dtypes):
                # TODO : Bool and others
        Severity: Minor
        Found in src/dataverk/utils/metadata_utils.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 __init__ has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def __init__(self, path: Path = None, env_setter=None):
        
                if env_setter is None:
                    env_setter = environ
        
        
        Severity: Minor
        Found in src/dataverk/context/env_store.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 read_file(Path(base_path).joinpath(resource_name))
        Severity: Major
        Found in src/dataverk/utils/file_functions.py - About 30 mins to fix

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

          def get_resource_object(
              resource_type: str,
              resource: Any,
              datapackage_path: str,
              resource_name: str,
          Severity: Minor
          Found in src/dataverk/resources/factory_resources.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