endremborza/parquetranger

View on GitHub

Showing 8 of 8 total issues

File core.py has 444 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import json
import pickle
import warnings
from contextlib import contextmanager
from dataclasses import dataclass, field
Severity: Minor
Found in parquetranger/core.py - About 6 hrs to fix

    TableRepo has 47 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class TableRepo:
        """helps with storing, extending and reading tabular data in parquet format
    
        tries dividing based on group_cols, if that is None
        tries dividing based on max_records, if max records is 0
    Severity: Minor
    Found in parquetranger/core.py - About 6 hrs to fix

      Function ingest has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          def ingest(self, obj, parents=(), parent_id=None):
              if isinstance(obj, list):
                  for e in obj:
                      self.ingest(e, (*parents, LISTDIR), parent_id)
                  return
      Severity: Minor
      Found in parquetranger/ingestor.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 _inner_meta_dict has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          def _inner_meta_dict(self, new_schema: pa.Schema):
              new_dict = _schema_to_dic(new_schema)
              if self._fixed_meta is not None:
                  old_dict = self._fixed_meta
              else:
      Severity: Minor
      Found in parquetranger/core.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 9 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def __init__(
      Severity: Major
      Found in parquetranger/core.py - About 1 hr to fix

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

            def extend(self, df: pd.DataFrame):
                if self._is_grouped:
                    return self._gb_handle(df, self.extend)
        
                resolved_table = self._resolve_metadata(df)
        Severity: Minor
        Found in parquetranger/core.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 read_table_from_path has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def read_table_from_path(
                self, path, lock: Optional[Lock] = None, release=True
            ) -> pa.Table:
                assert release or (lock is not None)
                if lock is None:
        Severity: Minor
        Found in parquetranger/core.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 _cast_table has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        def _cast_table(table: pa.Table, dic: dict[str, pa.DataType]):
            arrs = []
            for k, v in dic.items():
                try:
                    arrs.append(table[k].cast(v))
        Severity: Minor
        Found in parquetranger/core.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