LiberTEM/LiberTEM

View on GitHub

Showing 214 of 744 total issues

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

from collections import defaultdict
from enum import Enum
from typing import (
    Any, AsyncGenerator, Dict, Generator, Iterator, Mapping, Optional, List,
    Tuple, Type, Iterable, TypeVar, Union, Set, TYPE_CHECKING
Severity: Major
Found in src/libertem/udf/base.py - About 4 days to fix

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

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

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

      import re
      import os
      from glob import glob, escape
      import logging
      from typing import TYPE_CHECKING, Generator, List, Optional, Sequence, Tuple, Union
      Severity: Major
      Found in src/libertem/io/dataset/mib.py - About 1 day to fix

        File k2is.py has 843 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

          Function DatasetOpen has a Cognitive Complexity of 47 (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 7 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 _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/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 hdf5.py has 594 lines of code (exceeds 400 allowed). Consider refactoring.
          Open

          import contextlib
          from typing import Optional
          import warnings
          import logging
          import time
          Severity: Major
          Found in src/libertem/io/dataset/hdf5.py - About 6 hrs to fix

            File frms6.py has 589 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 seq.py has 558 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

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

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

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

                  from typing import Any, Iterable, Optional, Tuple, Union, TYPE_CHECKING
                  from typing_extensions import Literal
                  import mmap
                  import math
                  from contextlib import contextmanager
                  Severity: Major
                  Found in src/libertem/common/buffers.py - About 5 hrs to fix

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

                    import contextlib
                    from copy import deepcopy
                    import functools
                    import logging
                    import signal
                    Severity: Major
                    Found in src/libertem/executor/dask.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 com.py has 481 lines of code (exceeds 400 allowed). Consider refactoring.
                      Open

                      import logging
                      import inspect
                      from typing import Dict, NamedTuple, Optional, Tuple, Type, Union, TYPE_CHECKING
                      
                      import numpy as np
                      Severity: Minor
                      Found in src/libertem/analysis/com.py - About 3 hrs to fix

                        BufferWrapper has 30 functions (exceeds 20 allowed). Consider refactoring.
                        Open

                        class BufferWrapper:
                            """
                            Helper class to automatically allocate buffers, either for partitions or
                            the whole dataset, and create views for partitions or single frames.
                        
                        
                        Severity: Minor
                        Found in src/libertem/common/buffers.py - About 3 hrs to fix

                          Function make_get_read_ranges has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
                          Open

                          def make_get_read_ranges(
                              px_to_bytes=_default_px_to_bytes,
                              read_ranges_tile_block=_default_read_ranges_tile_block,
                          ):
                              """
                          Severity: Minor
                          Found in src/libertem/io/dataset/base/tiling.py - About 3 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 prime_numba_cache has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
                          Open

                          def prime_numba_cache(ds):
                              dtypes = (np.float32, None)
                              for dtype in dtypes:
                                  roi = np.zeros(ds.shape.nav, dtype=bool).reshape((-1,))
                                  roi[max(-ds._meta.sync_offset, 0)] = True
                          Severity: Minor
                          Found in src/libertem/common/numba/cache.py - About 3 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 89 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 3 hrs to fix

                            DataSet has 28 functions (exceeds 20 allowed). Consider refactoring.
                            Open

                            class DataSet:
                                # The default partition size in bytes
                                MAX_PARTITION_SIZE = 512*1024*1024
                            
                                def __init__(self, io_backend: Optional["IOBackend"] = None):
                            Severity: Minor
                            Found in src/libertem/io/dataset/base/dataset.py - About 3 hrs to fix

                              File cached.py has 454 lines of code (exceeds 400 allowed). Consider refactoring.
                              Open

                              import os
                              import json
                              import hashlib
                              import sqlite3
                              import time
                              Severity: Minor
                              Found in src/libertem/io/dataset/cached.py - About 3 hrs to fix
                                Severity
                                Category
                                Status
                                Source
                                Language