lewisamarshall/emigrate

View on GitHub

Showing 36 of 36 total issues

Similar blocks of code found in 3 locations. Consider refactoring.
Open

        savename = os.path.splitext(ctx.obj['path'])[0]+'_field.mp4'
Severity: Minor
Found in emigrate/__main__.py and 2 other locations - About 35 mins to fix
emigrate/__main__.py on lines 142..142
emigrate/__main__.py on lines 176..176

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 3 locations. Consider refactoring.
Open

    savename = os.path.splitext(ctx.obj['path'])[0]+'.mp4'
Severity: Minor
Found in emigrate/__main__.py and 2 other locations - About 35 mins to fix
emigrate/__main__.py on lines 126..126
emigrate/__main__.py on lines 176..176

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

        if self.method == '6th-Order':
            internal_function = [2./11., 1., 2./11.]
            boundary_functions = [[1., 137./13.], [1./10., 1., -7./20.]]
            self.A2 = self.construct_matrix(boundary_functions,
                                            internal_function)
Severity: Minor
Found in emigrate/flux_schemes/Differentiate.py and 1 other location - About 35 mins to fix
emigrate/flux_schemes/Differentiate.py on lines 54..60

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

Function _create_concentrations has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def _create_concentrations(self, constructor):
        self.concentrations = []

        for ion in self.ions:
            ion_concentration = np.zeros(self.nodes.shape)
Severity: Minor
Found in emigrate/Frame.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 iterate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def iterate(self, path='default.hdf5', interval=1., max_time=None):
        with Sequence(path, mode='w') as sequence:
            sequence.append(self.state)
            self._initialize_solver()
            while self.solver.successful():
Severity: Minor
Found in emigrate/Solver.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 __init__ has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def __init__(self, state):
        """Initialize the compact flux solver."""
        self.state = state

        # Prepare the grid points from the state nodes
Severity: Minor
Found in emigrate/flux_schemes/Fluxer.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 __getitem__ has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def __getitem__(self, idx):
        if not isinstance(idx, int):
            raise IndexError('Sequence index must be an integer.')

        if idx < 0: idx = len(self) + idx
Severity: Minor
Found in emigrate/Sequence.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 gram has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def gram(ctx, location):
    sequence = ctx.obj['sequence']
    frame0 = sequence[0]
    times = [f.time for f in sequence]
    # nodes = np.linspace(frame0.nodes[0], frame0.nodes[-1], n)
Severity: Minor
Found in emigrate/__main__.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 _ensure_positive has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def _ensure_positive(self, roots, polys):
        if self.enforce_positive:
            for idx, value in enumerate(roots < 0):
                if value:
                    roots[idx] = self._1d_analytical_solve(polys[:, idx])
Severity: Minor
Found in emigrate/equilibration_schemes/Multiroot.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

TODO found
Open

        # TODO: Check if this works for low ionization fraction

TODO found
Open

    # #TODO:0 Change implimentation
Severity: Minor
Found in emigrate/flux_schemes/Fluxer.py by fixme

TODO found
Open

        # #TODO:20 Change this implementation.
Severity: Minor
Found in emigrate/Solver.py by fixme

TODO found
Open

    # #TODO:60 hide internal functions
Severity: Minor
Found in emigrate/flux_schemes/SLIP.py by fixme

TODO found
Open

# #TODO:40 Fix boundary characteristics
Severity: Minor
Found in emigrate/flux_schemes/Fluxer.py by fixme

TODO found
Open

# TODO: Pull constants from ionize.

TODO found
Open

TODO
Severity: Minor
Found in TODO.md by fixme
Severity
Category
Status
Source
Language