LiberTEM/LiberTEM

View on GitHub

Showing 270 of 903 total issues

File base.py has 2244 lines of code (exceeds 400 allowed). Consider refactoring.
Open

from collections import defaultdict, OrderedDict
from contextlib import contextmanager
import typing
from typing import (
    Any, Optional,
Severity: Major
Found in src/libertem/udf/base.py - About 5 days to fix

    File api.py has 1483 lines of code (exceeds 400 allowed). Consider refactoring.
    Open

    from typing import (
        TYPE_CHECKING, Any, Optional, Union, overload
    )
    from collections.abc import Iterable, Generator, Coroutine
    from typing_extensions import Literal
    Severity: Major
    Found in src/libertem/api.py - About 3 days to fix

      File mib.py has 1005 lines of code (exceeds 400 allowed). Consider refactoring.
      Open

      import re
      import os
      import platform
      from glob import glob, escape
      import logging
      Severity: Major
      Found in src/libertem/io/dataset/mib.py - About 2 days to fix

        File pipelined.py has 1005 lines of code (exceeds 400 allowed). Consider refactoring.
        Open

        import itertools
        import os
        import sys
        import logging
        import functools
        Severity: Major
        Found in src/libertem/executor/pipelined.py - About 2 days to fix

          File k2is.py has 849 lines of code (exceeds 400 allowed). Consider refactoring.
          Open

          import os
          import re
          import glob
          import math
          import typing
          Severity: Major
          Found in src/libertem/io/dataset/k2is.py - About 1 day to fix

            File buffers.py has 825 lines of code (exceeds 400 allowed). Consider refactoring.
            Open

            from typing import Any, Optional, Union, TYPE_CHECKING, Generic, TypeVar
            from collections.abc import Iterable
            from typing_extensions import Literal
            import mmap
            import math
            Severity: Major
            Found in src/libertem/common/buffers.py - About 1 day to fix

              Function _execution_plan has a Cognitive Complexity of 64 (exceeds 5 allowed). Consider refactoring.
              Open

              def _execution_plan(
                  udfs, ds: Union[DataSet, DataSetMeta], device_class: Optional[DeviceClass] = None,
                  available_backends: Iterable[ArrayBackend] = BACKENDS
              ) -> tuple[ArrayBackend, ExecutionPlan]:
                  '''
              Severity: Minor
              Found in src/libertem/udf/base.py - About 1 day 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

              File hdf5.py has 729 lines of code (exceeds 400 allowed). Consider refactoring.
              Open

              import os
              import contextlib
              import typing
              from typing import Optional
              import warnings
              Severity: Major
              Found in src/libertem/io/dataset/hdf5.py - About 1 day to fix

                Function DatasetOpen has a Cognitive Complexity of 59 (exceeds 5 allowed). Consider refactoring.
                Open

                const DatasetOpen = () => {
                    const dispatch = useDispatch();
                    const openState = useSelector((state: RootReducer) => state.openDataset);
                
                    const [didReset, setReset] = React.useState(false);
                Severity: Minor
                Found in client/src/dataset/components/DatasetOpen.tsx - About 1 day 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

                File dask.py has 693 lines of code (exceeds 400 allowed). Consider refactoring.
                Open

                import os
                import contextlib
                from copy import deepcopy
                import functools
                import logging
                Severity: Major
                Found in src/libertem/executor/dask.py - About 1 day to fix

                  File messages.ts has 609 lines of code (exceeds 400 allowed). Consider refactoring.
                  Open

                  import { JobList } from "./analysis/types"
                  
                  /*
                   * Common
                   */
                  Severity: Major
                  Found in client/src/messages.ts - About 7 hrs to fix

                    Function _correct_numba_inplace has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def _correct_numba_inplace(buffer, dark_image, gain_map, exclude_pixels, repair_environments,
                            repair_counts):
                        '''
                        Numerical work horse to perform detector corrections
                    
                    
                    Severity: Minor
                    Found in src/libertem/io/corrections/detector.py - About 6 hrs 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

                    File frms6.py has 596 lines of code (exceeds 400 allowed). Consider refactoring.
                    Open

                    import os
                    import re
                    import csv
                    from glob import glob, escape
                    import typing
                    Severity: Major
                    Found in src/libertem/io/dataset/frms6.py - About 6 hrs to fix

                      File com.py has 595 lines of code (exceeds 400 allowed). Consider refactoring.
                      Open

                      from enum import IntEnum
                      from typing import NamedTuple, Optional, Union
                      from typing_extensions import Literal
                      
                      import numpy as np
                      Severity: Major
                      Found in src/libertem/udf/com.py - About 6 hrs to fix

                        File executor.py has 567 lines of code (exceeds 400 allowed). Consider refactoring.
                        Open

                        import queue
                        from typing import (
                            Callable, Optional, Any, TYPE_CHECKING,
                            TypeVar,
                        )
                        Severity: Major
                        Found in src/libertem/common/executor.py - About 6 hrs to fix

                          File seq.py has 565 lines of code (exceeds 400 allowed). Consider refactoring.
                          Open

                          # Based on the SEQ reader of the PIMS project, with the following license:
                          #
                          #    Copyright (c) 2013-2014 PIMS contributors
                          #    https://github.com/soft-matter/pims
                          #    All rights reserved
                          Severity: Major
                          Found in src/libertem/io/dataset/seq.py - About 5 hrs to fix

                            Function radial_bins has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
                            Open

                            def radial_bins(centerX, centerY, imageSizeX, imageSizeY,
                                    radius=None, radius_inner=0, n_bins=None, normalize=False, use_sparse=None, dtype=None):
                                '''
                                Generate antialiased rings
                                '''
                            Severity: Minor
                            Found in src/libertem/masks.py - About 4 hrs 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

                            File raw_csr.py has 511 lines of code (exceeds 400 allowed). Consider refactoring.
                            Open

                            import typing
                            import os
                            
                            import scipy.sparse
                            import numpy as np
                            Severity: Major
                            Found in src/libertem/io/dataset/raw_csr.py - About 4 hrs to fix

                              Function _read_metadata has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  def _read_metadata(cls, path, use_ds=None):
                                      with ncempy.io.dm.fileDM(path, on_memory=True) as fp:
                                          tags = fp.allTags
                                          array_map = {}
                                          start_from = 1 if fp.thumbnail else 0
                              Severity: Minor
                              Found in src/libertem/io/dataset/dm_single.py - About 4 hrs 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 DatasetOpen has 104 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              const DatasetOpen = () => {
                                  const dispatch = useDispatch();
                                  const openState = useSelector((state: RootReducer) => state.openDataset);
                              
                                  const [didReset, setReset] = React.useState(false);
                              Severity: Major
                              Found in client/src/dataset/components/DatasetOpen.tsx - About 4 hrs to fix
                                Severity
                                Category
                                Status
                                Source
                                Language