navikt/dataverk

View on GitHub

Showing 27 of 27 total issues

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

    def _get_schema(self):
        fields = []

        for name, dtype in zip(self._resource_data.columns, self._resource_data.dtypes):
            if str(dtype) == "object":
Severity: Minor
Found in src/dataverk/resources/dataframe_resource.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_view_object has 12 arguments (exceeds 4 allowed). Consider refactoring.
Open

def get_view_object(name: str, resources: Sequence, title: str = "", description: str = "", attribution: str = "",
Severity: Major
Found in src/dataverk/views/view_factory.py - About 1 hr to fix

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

        def __init__(self, name: str, resources: Sequence, title: str = "", description: str = "", attribution: str = "",
    Severity: Major
    Found in src/dataverk/views/default.py - About 1 hr to fix

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

          def __init__(self, name: str, resources: Sequence, title: str = "", description: str = "", attribution: str = "",
      Severity: Major
      Found in src/dataverk/views/json_spec.py - About 1 hr to fix

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

            def __init__(self, name: str, resources: Sequence, title: str = "", description: str = "", attribution: str = "",
        Severity: Major
        Found in src/dataverk/views/datatable_spec.py - About 1 hr to fix

          Function add_view has 12 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def add_view(self, name: str = None, resources: Sequence = None, title: str = "", description: str = "", attribution: str = "",
          Severity: Major
          Found in src/dataverk/datapackage.py - About 1 hr to fix

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

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

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

                  def __init__(self, name: str, resources: Sequence, title: str = "", description: str = "", attribution: str = "",
              Severity: Major
              Found in src/dataverk/views/remote_spec.py - About 1 hr to fix

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

                def get_package_resource(resource_name: str, base_path: str, http_headers: dict):
                    if os.environ.get("DATAVERK_SETTINGS_PATH", None) is not None:
                        return read_file(Path(os.environ.get("DATAVERK_SETTINGS_PATH")).joinpath(resource_name))
                    else:
                        try:
                Severity: Minor
                Found in src/dataverk/utils/file_functions.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 a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    def __init__(
                        self,
                        name: str,
                        resources: Sequence,
                        title: str = "",
                Severity: Minor
                Found in src/dataverk/views/base.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 to_sql has 7 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    def to_sql(
                Severity: Major
                Found in src/dataverk/dataverk.py - About 50 mins to fix

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

                  def anonymize_replace(df: pd.DataFrame, eval_column, anonymize_columns=None, evaluator=lambda x: x < 4,
                  Severity: Minor
                  Found in src/dataverk/utils/anonymization.py - About 45 mins to fix

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

                    def get_resource_object(
                    Severity: Minor
                    Found in src/dataverk/resources/factory_resources.py - About 45 mins to fix

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

                          def read_sql(
                      Severity: Minor
                      Found in src/dataverk/dataverk.py - About 45 mins to fix

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

                            def execute_sql(
                        Severity: Minor
                        Found in src/dataverk/dataverk.py - About 45 mins to fix

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

                              def anonymize(
                          Severity: Minor
                          Found in src/dataverk/dataverk.py - About 45 mins to fix

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

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

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

                                  def read_kafka(
                              Severity: Minor
                              Found in src/dataverk/dataverk.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/dataframe_resource.py - About 35 mins to fix

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

                                      def add_resource(self, resource: Any, resource_name: str = "",
                                  Severity: Minor
                                  Found in src/dataverk/datapackage.py - About 35 mins to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language