LiberTEM/LiberTEM

View on GitHub

Showing 269 of 913 total issues

Function get_scheme has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def get_scheme(
            self,
            udfs: Sequence[UDFProtocol],
            dataset,
            read_dtype: "nt.DTypeLike",
Severity: Minor
Found in src/libertem/io/dataset/base/tiling_scheme.py - About 1 hr to fix

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

    def mitigations():
        '''
        Enable known work-arounds to run in a threaded executor.
    
        * Disable pyFFTW interface cache:
    Severity: Minor
    Found in src/libertem/common/threading.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 _shape_for_kind has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def _shape_for_kind(self, kind, orig_shape, roi_count=None):
            """
            :meta private:
            """
            if self._kind == "nav":
    Severity: Minor
    Found in src/libertem/common/buffers.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 run has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    def run(
        host, port, browser, local_directory, numeric_level,
        token, preload, strict_port, executor_spec, open_ds,
        snooze_timeout: Optional[float] = None,
    ):
    Severity: Minor
    Found in src/libertem/web/server.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 xml_generate_map_size has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    def xml_generate_map_size(exc_rows, exc_cols, exc_pix, size, metadata):
        """
        This function will be responsible for generating new size based on the parameters.
        returns an np array with the excluded pixels as True
    
    
    Severity: Minor
    Found in src/libertem/io/dataset/seq.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 rebuild_nested has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    def rebuild_nested(flat: list[Any],
                       flat_mapping: list[list[tuple[type, Any]]],
                       merge_functions=None):
        """
        Using the flattened version of a structure built by flatten_nested
    Severity: Minor
    Found in src/libertem/executor/utils/delayed_unpack.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 encode_r1 has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    def encode_r1(inp, out):
        for y in range(out.shape[0]):
            row_out = out[y]
            row_in = inp[y]
            for stripe in range(row_out.shape[0] // 8):
    Severity: Minor
    Found in src/libertem/io/dataset/mib.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_dask_integration_executor has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    def get_dask_integration_executor():
        '''
        Query the current Dask scheduler and return a :class:`~libertem.common.executor.JobExecutor`
        that is compatible with it. See https://docs.dask.org/en/stable/scheduling.html
        for the meaning of the different scheduler types.
    Severity: Minor
    Found in src/libertem/executor/integration.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 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def __init__(
            self,
            path: str,
            scan_size: Optional[tuple[int, ...]] = None,
            nav_shape: Optional[tuple[int, ...]] = None,
    Severity: Minor
    Found in src/libertem/io/dataset/seq.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 flatten_nested has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    def flatten_nested(el: Any,
                       unpackable_types: dict[type, Callable[[Iterable],
                                                             Iterable[tuple[Any, Any]]]] = None,
                       ignore_types: Optional[tuple[type, ...]] = None) -> list[Any]:
        """
    Severity: Minor
    Found in src/libertem/executor/utils/delayed_unpack.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 _k2is_read_ranges_tile_block has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    def _k2is_read_ranges_tile_block(
        slices_arr, fileset_arr, slice_sig_sizes, sig_origins,
        inner_indices_start, inner_indices_stop, frame_indices, sig_size,
        px_to_bytes, bpp, frame_header_bytes, frame_footer_bytes, file_idxs,
        slice_offset, extra, sig_shape,
    Severity: Minor
    Found in src/libertem/io/dataset/k2is.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 createOrUpdate has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    export function* createOrUpdate(
        compoundAnalysis: CompoundAnalysisState, analysisId: string | undefined,
        analysisIndex: number, details: AnalysisDetails
    ): Generator<unknown, string, any> {
        if (analysisId) {
    Severity: Minor
    Found in client/src/compoundAnalysis/sagas.ts - 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 run_for_partition has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def run_for_partition(
            self,
            partition: Partition,
            params: UDFParams,
            env: Environment,
    Severity: Minor
    Found in src/libertem/udf/base.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 run_for_dataset_sync has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def run_for_dataset_sync(
            self,
            dataset: DataSet,
            executor: JobExecutor,
            roi: Optional[np.ndarray] = None,
    Severity: Minor
    Found in src/libertem/udf/base.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 createCompoundAnalysisSaga has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function* createCompoundAnalysisSaga(action: ReturnType<typeof compoundAnalysisActions.Actions.create>) {
        try {
            const datasetState = (yield select(selectDataset, action.payload.dataset)) as DatasetState;
            if (datasetState.status !== DatasetStatus.OPEN) {
                throw new Error("invalid dataset status");
    Severity: Minor
    Found in client/src/compoundAnalysis/sagas.ts - About 1 hr to fix

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

          def __init__(
      Severity: Major
      Found in src/libertem/analysis/fullmatch.py - About 1 hr to fix

        Function main has 12 arguments (exceeds 8 allowed). Consider refactoring.
        Open

        def main(port, local_directory, browser, cpus, gpus, open_ds, log_level,
        Severity: Major
        Found in src/libertem/web/cli.py - About 1 hr to fix

          Function _get_read_ranges_inner has 12 arguments (exceeds 8 allowed). Consider refactoring.
          Open

              def _get_read_ranges_inner(
          Severity: Major
          Found in src/libertem/io/dataset/base/tiling.py - About 1 hr to fix

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

                def __init__(self, path, dtype, scan_size=None, detector_size=None, enable_direct=False,
            Severity: Major
            Found in src/libertem/io/dataset/raw.py - About 1 hr to fix

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

                  def __init__(
              Severity: Major
              Found in src/libertem/udf/base.py - About 1 hr to fix
                Severity
                Category
                Status
                Source
                Language