LiberTEM/LiberTEM

View on GitHub

Showing 916 of 916 total issues

Similar blocks of code found in 13 locations. Consider refactoring.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

type DatasetParamsNPYForForm = Omit<DatasetParamsNPY,
    "type"
    | "path"
    | "nav_shape"
    | "sig_shape"> & {
Severity: Major
Found in client/src/dataset/components/NPYParamsForm.tsx and 12 other locations - About 35 mins to fix
client/src/dataset/components/BLOParamsForm.tsx on lines 12..19
client/src/dataset/components/DMParamsForm.tsx on lines 12..19
client/src/dataset/components/EMPADParamsForm.tsx on lines 12..19
client/src/dataset/components/FRMS6ParamsForm.tsx on lines 12..19
client/src/dataset/components/K2ISParamsForm.tsx on lines 12..19
client/src/dataset/components/MIBParamsForm.tsx on lines 12..19
client/src/dataset/components/MRCParamsForm.tsx on lines 11..18
client/src/dataset/components/RawCSRParamsForm.tsx on lines 11..18
client/src/dataset/components/RawFileParamsForm.tsx on lines 12..19
client/src/dataset/components/SEQParamsForm.tsx on lines 12..19
client/src/dataset/components/SERParamsForm.tsx on lines 11..18
client/src/dataset/components/TVIPSParamsForm.tsx on lines 12..19

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 47.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 13 locations. Consider refactoring.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

type DatasetParamsSERForForm = Omit<DatasetParamsSER,
    "type"
    | "path"
    | "nav_shape"
    | "sig_shape"> & {
Severity: Major
Found in client/src/dataset/components/SERParamsForm.tsx and 12 other locations - About 35 mins to fix
client/src/dataset/components/BLOParamsForm.tsx on lines 12..19
client/src/dataset/components/DMParamsForm.tsx on lines 12..19
client/src/dataset/components/EMPADParamsForm.tsx on lines 12..19
client/src/dataset/components/FRMS6ParamsForm.tsx on lines 12..19
client/src/dataset/components/K2ISParamsForm.tsx on lines 12..19
client/src/dataset/components/MIBParamsForm.tsx on lines 12..19
client/src/dataset/components/MRCParamsForm.tsx on lines 11..18
client/src/dataset/components/NPYParamsForm.tsx on lines 12..19
client/src/dataset/components/RawCSRParamsForm.tsx on lines 11..18
client/src/dataset/components/RawFileParamsForm.tsx on lines 12..19
client/src/dataset/components/SEQParamsForm.tsx on lines 12..19
client/src/dataset/components/TVIPSParamsForm.tsx on lines 12..19

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 47.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 13 locations. Consider refactoring.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

type DatasetParamsDMForForm = Omit<DatasetParamsDM,
    "type"
    | "path"
    | "nav_shape"
    | "sig_shape"> & {
Severity: Major
Found in client/src/dataset/components/DMParamsForm.tsx and 12 other locations - About 35 mins to fix
client/src/dataset/components/BLOParamsForm.tsx on lines 12..19
client/src/dataset/components/EMPADParamsForm.tsx on lines 12..19
client/src/dataset/components/FRMS6ParamsForm.tsx on lines 12..19
client/src/dataset/components/K2ISParamsForm.tsx on lines 12..19
client/src/dataset/components/MIBParamsForm.tsx on lines 12..19
client/src/dataset/components/MRCParamsForm.tsx on lines 11..18
client/src/dataset/components/NPYParamsForm.tsx on lines 12..19
client/src/dataset/components/RawCSRParamsForm.tsx on lines 11..18
client/src/dataset/components/RawFileParamsForm.tsx on lines 12..19
client/src/dataset/components/SEQParamsForm.tsx on lines 12..19
client/src/dataset/components/SERParamsForm.tsx on lines 11..18
client/src/dataset/components/TVIPSParamsForm.tsx on lines 12..19

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 47.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 13 locations. Consider refactoring.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

type DatasetParamsRawForForm = Omit<DatasetParamsRaw,
    "type"
    | "path"
    | "nav_shape"
    | "sig_shape"> & {
Severity: Major
Found in client/src/dataset/components/RawFileParamsForm.tsx and 12 other locations - About 35 mins to fix
client/src/dataset/components/BLOParamsForm.tsx on lines 12..19
client/src/dataset/components/DMParamsForm.tsx on lines 12..19
client/src/dataset/components/EMPADParamsForm.tsx on lines 12..19
client/src/dataset/components/FRMS6ParamsForm.tsx on lines 12..19
client/src/dataset/components/K2ISParamsForm.tsx on lines 12..19
client/src/dataset/components/MIBParamsForm.tsx on lines 12..19
client/src/dataset/components/MRCParamsForm.tsx on lines 11..18
client/src/dataset/components/NPYParamsForm.tsx on lines 12..19
client/src/dataset/components/RawCSRParamsForm.tsx on lines 11..18
client/src/dataset/components/SEQParamsForm.tsx on lines 12..19
client/src/dataset/components/SERParamsForm.tsx on lines 11..18
client/src/dataset/components/TVIPSParamsForm.tsx on lines 12..19

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 47.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 13 locations. Consider refactoring.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

type DatasetParamsBLOForForm = Omit<DatasetParamsBLO,
    "type"
    | "path"
    | "nav_shape"
    | "sig_shape"> & {
Severity: Major
Found in client/src/dataset/components/BLOParamsForm.tsx and 12 other locations - About 35 mins to fix
client/src/dataset/components/DMParamsForm.tsx on lines 12..19
client/src/dataset/components/EMPADParamsForm.tsx on lines 12..19
client/src/dataset/components/FRMS6ParamsForm.tsx on lines 12..19
client/src/dataset/components/K2ISParamsForm.tsx on lines 12..19
client/src/dataset/components/MIBParamsForm.tsx on lines 12..19
client/src/dataset/components/MRCParamsForm.tsx on lines 11..18
client/src/dataset/components/NPYParamsForm.tsx on lines 12..19
client/src/dataset/components/RawCSRParamsForm.tsx on lines 11..18
client/src/dataset/components/RawFileParamsForm.tsx on lines 12..19
client/src/dataset/components/SEQParamsForm.tsx on lines 12..19
client/src/dataset/components/SERParamsForm.tsx on lines 11..18
client/src/dataset/components/TVIPSParamsForm.tsx on lines 12..19

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 47.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 13 locations. Consider refactoring.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

type DatasetParamsTVIPSForForm = Omit<DatasetParamsTVIPS,
    "type"
    | "path"
    | "nav_shape"
    | "sig_shape"> & {
Severity: Major
Found in client/src/dataset/components/TVIPSParamsForm.tsx and 12 other locations - About 35 mins to fix
client/src/dataset/components/BLOParamsForm.tsx on lines 12..19
client/src/dataset/components/DMParamsForm.tsx on lines 12..19
client/src/dataset/components/EMPADParamsForm.tsx on lines 12..19
client/src/dataset/components/FRMS6ParamsForm.tsx on lines 12..19
client/src/dataset/components/K2ISParamsForm.tsx on lines 12..19
client/src/dataset/components/MIBParamsForm.tsx on lines 12..19
client/src/dataset/components/MRCParamsForm.tsx on lines 11..18
client/src/dataset/components/NPYParamsForm.tsx on lines 12..19
client/src/dataset/components/RawCSRParamsForm.tsx on lines 11..18
client/src/dataset/components/RawFileParamsForm.tsx on lines 12..19
client/src/dataset/components/SEQParamsForm.tsx on lines 12..19
client/src/dataset/components/SERParamsForm.tsx on lines 11..18

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 47.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

    const localSettings: LocalConfig = {
        cwd: config.cwd,
        lastOpened: config.lastOpened,
        fileHistory: config.fileHistory,
        lastConnection: config.lastConnection,
Severity: Minor
Found in client/src/config/helpers.ts and 1 other location - About 35 mins to fix
client/src/compoundAnalysis/components/Download.tsx on lines 109..115

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 47.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

            setNotebook({
                dependency: CurrentNotebook.dependency,
                initial_setup: CurrentNotebook.initial_setup,
                ctx: CurrentNotebook.ctx,
                dataset: CurrentNotebook.dataset,
Severity: Minor
Found in client/src/compoundAnalysis/components/Download.tsx and 1 other location - About 35 mins to fix
client/src/config/helpers.ts on lines 25..31

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 47.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Function __init__ has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

    def __init__(self, path, tileshape=None, scan_size=None, disable_glob=False,
                 nav_shape=None, sig_shape=None, sync_offset=0, io_backend=None):
        super().__init__(io_backend=io_backend)
        self._sig_dims = 2
        self._path = str(path)
Severity: Minor
Found in src/libertem/io/dataset/mib.py - About 35 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 hologram_frame has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

def hologram_frame(amp, phi,
                   counts=1000.,
                   sampling=5.,
                   visibility=1.,
                   f_angle=30.,
Severity: Minor
Found in src/libertem/utils/generate.py - About 35 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 get_generic_results has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

    def get_generic_results(self, img_sum, img_y, img_x, damage):
        from libertem.viz import rgb_from_2dvector, visualize_simple
        ref_x = self.parameters["cx"]
        ref_y = self.parameters["cy"]
        y_centers_raw, x_centers_raw = center_shifts(img_sum, img_y, img_x, ref_y, ref_x)
Severity: Minor
Found in src/libertem/analysis/com.py - About 35 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 exclude_pixels has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

def exclude_pixels(sig_dims, num_excluded):
    '''
    Generate a list of excluded pixels that
    can be reconstructed faithfully from their neighbors
    in a linear gradient dataset
Severity: Minor
Found in src/libertem/utils/generate.py - About 35 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_dataset_hdr has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

def _read_dataset_hdr(fname):
    if not os.path.exists(fname):
        raise DataSetException(
            "Could not find .hdr file {}".format(
                fname,
Severity: Minor
Found in src/libertem/io/dataset/frms6.py - About 35 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 assign_cudas has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

def assign_cudas(cudas: Union[int, Iterable[int]]) -> Iterable[int]:
    """
    Takes the cudas argument to :code:`cluster_spec` and
    converts it into a properly formatted iterable of CUDA
    device ids
Severity: Minor
Found in src/libertem/executor/utils/__init__.py - About 35 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 monitor_queue has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

    def monitor_queue(self):
        """
        Monitor the queue for messages
        If there are no subscribers this should drain
        messages from the queue as fast as they are recieved
Severity: Minor
Found in src/libertem/common/progress.py - About 35 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 get has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

    def get(self, block: bool = True, timeout: Optional[float] = None):
        """
        Receive a message. Memory of the payload will be cleaned up after the
        context manager scope, so don't keep references outside of it!

Severity: Minor
Found in src/libertem/executor/utils/shmqueue.py - About 35 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 detect_params has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

    def detect_params(cls, path: str, executor):
        pathlow = path.lower()
        if pathlow.endswith(".dm3") or pathlow.endswith(".dm4"):
            array_meta = executor.run_function(cls._read_metadata, path)
            sig_dims = array_meta['sig_dims']
Severity: Minor
Found in src/libertem/io/dataset/dm_single.py - About 35 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 _do_initialize has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

    def _do_initialize(self):
        if self.ds_path is None:
            try:
                datasets = _get_datasets(self.path)
                largest_ds = max(datasets, key=lambda x: prod(x.shape))
Severity: Minor
Found in src/libertem/io/dataset/hdf5.py - About 35 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 __init__ has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

    def __init__(self, files=None, scan_size=None, same_offset=False, nav_shape=None,
                 sig_shape=None, sync_offset=0, io_backend=None):
        super().__init__(io_backend=io_backend)
        self._meta = None
        self._same_offset = same_offset
Severity: Minor
Found in src/libertem/io/dataset/dm.py - About 35 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 readinto has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

    def readinto(self, buf):
        BLOCKSIZE = self.get_blocksize()
        buf_orig = buf
        buf = memoryview(buf)
        to_read = len(buf)
Severity: Minor
Found in src/libertem/io/dataset/base/backend_buffered.py - About 35 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 getUrlAction has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

export const getUrlAction = (): URLAction => {
    const hash = decodeURIComponent(window.location.hash.slice(1));
    const params = parseHashParameters(hash);
    const action = params.action;

Severity: Minor
Found in client/src/browser/helpers.ts - About 35 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 __init__ has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

    def __init__(
        self,
        path: str,
        sig_dims: Optional[int] = 2,
        nav_shape: Optional[tuple[int, int]] = None,
Severity: Minor
Found in src/libertem/io/dataset/npy.py - About 35 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 fetchDirectoryListing has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

function* fetchDirectoryListing(path: string) {
    try {
        const result = (yield call(getDirectoryListing, path)) as DirectoryListingResponse;
        if (result.status === "ok") {
            yield put(browserActions.Actions.dirListing(result.path, result.dirs, result.files, result.drives, result.places));
Severity: Minor
Found in client/src/browser/sagas.ts - About 35 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 _make_buffered_reader_and_decoder has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

def _make_buffered_reader_and_decoder(decode):
    """
    decode: from buffers, in bytes, possibly interpreted as native_dtype, to out_decoded.dtype
    """
    @cached_njit(boundscheck=False, nogil=True)
Severity: Minor
Found in src/libertem/io/dataset/base/backend_buffered.py - About 35 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 _make_mmap_reader_and_decoder has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

def _make_mmap_reader_and_decoder(decode):
    """
    decode: from inp, in bytes, possibly interpreted as native_dtype, to out_decoded.dtype
    """
    @cached_njit(boundscheck=False, cache=True, nogil=True)
Severity: Minor
Found in src/libertem/io/dataset/base/backend_mmap.py - About 35 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 get_task_data has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

    def get_task_data(self):
        sig_shape = tuple(self.meta.dataset_shape.sig)
        com_params = self.get_params()
        if len(sig_shape) != 2:
            raise ValueError('CoMUDF only works with 2D sig shape.')
Severity: Minor
Found in src/libertem/udf/com.py - About 35 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 TupleInput has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

const TupleInput: React.FC<TupleInputProps> = ({
    value, minLen, maxLen, fieldName, setFieldValue, setFieldTouched,
}) => {
  const tupleInputValue = value.split(",");

Severity: Minor
Found in client/src/dataset/components/TupleInput.tsx - About 35 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

Similar blocks of code found in 2 locations. Consider refactoring.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

                         * np.cos(2. * np.pi * y / sampling * np.cos(f_angle)
                                  + 2. * np.pi * x / sampling * np.sin(f_angle)
Severity: Minor
Found in src/libertem/utils/generate.py and 1 other location - About 35 mins to fix
src/libertem/utils/generate.py on lines 103..103

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 33.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

export interface MaskDefRing {
    shape: "ring",
    cx: number,
    cy: number,
    ri: number,
Severity: Minor
Found in client/src/messages.ts and 1 other location - About 35 mins to fix
client/src/messages.ts on lines 482..488

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 46.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

export interface DirectoryListingResponseError {
    status: "error",
    path: string,
    code: string,
    msg: string,
Severity: Minor
Found in client/src/messages.ts and 1 other location - About 35 mins to fix
client/src/messages.ts on lines 735..741

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 46.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

const clusterTypeOptions = clusterTypeKeys.map(t => ({
    text: ClusterTypeMetadata[ClusterTypes[t]].label,
    value: ClusterTypes[t],
}));
Severity: Minor
Found in client/src/cluster/components/ClusterConnectionForm.tsx and 1 other location - About 35 mins to fix
client/src/compoundAnalysis/components/CenterOfMassAnalysis.tsx on lines 37..40

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 46.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

const maskShapeOptions = maskShapeKeys.map(t => ({
    text: MaskShapeMetadata[CoMMaskShapes[t]].label,
    value: CoMMaskShapes[t],
}));
Severity: Minor
Found in client/src/compoundAnalysis/components/CenterOfMassAnalysis.tsx and 1 other location - About 35 mins to fix
client/src/cluster/components/ClusterConnectionForm.tsx on lines 26..29

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 46.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

        case analysisActions.ActionTypes.UPDATED: {
            return updateById(state, action.payload.id, {
                details: action.payload.details,
            });
        }
Severity: Minor
Found in client/src/analysis/reducers.ts and 1 other location - About 35 mins to fix
client/src/job/reducers.ts on lines 42..50

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 46.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

export interface StatResponseError {
    status: "error",
    path: string,
    code: string,
    msg: string,
Severity: Minor
Found in client/src/messages.ts and 1 other location - About 35 mins to fix
client/src/messages.ts on lines 709..715

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 46.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

        case channelActions.ActionTypes.TASK_RESULT: {
            return updateById(
                state,
                action.payload.job,
                {
Severity: Minor
Found in client/src/job/reducers.ts and 1 other location - About 35 mins to fix
client/src/analysis/reducers.ts on lines 24..28

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 46.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

export interface RectRoiParams {
    shape: "rect",
    x: number,
    y: number,
    width: number,
Severity: Minor
Found in client/src/messages.ts and 1 other location - About 35 mins to fix
client/src/messages.ts on lines 413..419

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 46.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

   const onPartChange = (e: React.ChangeEvent<HTMLInputElement>) => {
      tupleInputChangeHandle(tupleKey, e.target.value);
   }
Severity: Minor
Found in client/src/dataset/components/TupleInputPart.tsx and 1 other location - About 30 mins to fix
client/src/dataset/components/TupleInputPart.tsx on lines 20..22

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 45.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

   const handleBlur = (e: React.FocusEvent<HTMLInputElement>) => {
       onBlur(tupleKey, e.target.value);
   }
Severity: Minor
Found in client/src/dataset/components/TupleInputPart.tsx and 1 other location - About 30 mins to fix
client/src/dataset/components/TupleInputPart.tsx on lines 16..18

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 45.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Function initialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

    def initialize(self, executor: "JobExecutor") -> "DataSet":
        self._conf = conf = executor.run_function(load_toml, self._path)
        assert conf is not None
        if conf['params']['filetype'].lower() != 'raw_csr':
            raise ValueError(f"Filetype is not CSR, found {conf['params']['filetype']}")
Severity: Minor
Found in src/libertem/io/dataset/raw_csr.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 decode_r1_swap has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

def decode_r1_swap(inp, out, idx, native_dtype, rr, origin, shape, ds_shape):
    """
    RAW 1bit format: each pixel is actually saved as a single bit. 64 bits
    need to be unpacked together.
    """
Severity: Minor
Found in src/libertem/io/dataset/mib.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 data has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

    def data(self):
        """
        Get the buffer contents in shape that corresponds to the
        original dataset shape. If a ROI is set, embed the result into a new
        array; unset values have NaN value for floating point types,
Severity: Minor
Found in src/libertem/common/buffers.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 _get_alt_path has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

def _get_alt_path(path: str):
    cur_path = Path(path).expanduser()
    try:
        cur_path = cur_path.resolve()
    # Triggered by empty DVD drive or permission denied on Windows
Severity: Minor
Found in src/libertem/io/fs.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 create_com_analysis has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

    def create_com_analysis(self, dataset: DataSet, cx: int = None, cy: int = None,
                            mask_radius: float = None, flip_y: bool = False,
                            mask_radius_inner: float = None,
                            scan_rotation: float = 0.0) -> COMAnalysis:
        """
Severity: Minor
Found in src/libertem/api.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 _get_norm has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

def _get_norm(result, norm_cls=colors.Normalize, vmin=None, vmax=None, damage=None):
    if (vmin is not None) and (vmax is not None):
        return norm_cls(vmin=vmin, vmax=vmax)

    result = result.astype(np.float32)
Severity: Minor
Found in src/libertem/viz/base.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 _validate_resources has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

    def _validate_resources(self, workers, resources):
        # This is set in the constructor of DaskJobExecutor
        if self.lt_resources:
            if not self._resources_available(workers, resources):
                raise ResourceError("Requested resources not available in cluster:", resources)
Severity: Minor
Found in src/libertem/executor/dask.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 _prepare_plots has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

    def _prepare_plots(
        self,
        udfs: list[UDF],
        dataset: DataSet,
        roi: RoiT,
Severity: Minor
Found in src/libertem/api.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 _frms6_read_ranges_tile_block has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

def _frms6_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/frms6.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 main has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

def main():
    BASE_DIR = os.path.abspath(os.path.dirname(__file__))

    with open(os.path.join(BASE_DIR, "../.mypy-checked")) as f:
        files_project = set(f.read().split())
Severity: Minor
Found in scripts/run_mypy.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 flush has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

    def flush(self, debug=False):
        '''
        Write back any cached contiguous copies

        .. versionadded:: 0.5.0
Severity: Minor
Found in src/libertem/common/buffers.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 run_tasks has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

    def run_tasks(
        self,
        tasks: Iterable[TaskProtocol],
        params_handle: Any,
        cancel_id: Any,
Severity: Minor
Found in src/libertem/executor/inline.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