HajimeKawahara/exojax

View on GitHub

Showing 30 of 30 total issues

Similar blocks of code found in 4 locations. Consider refactoring.
Confirmed

Severity: Major
Found in src/exojax/data/__init__.py and 3 other locations - About 50 mins to fix
src/exojax/atm/__init__.py on lines 0..8
src/exojax/utils/__init__.py on lines 0..8
src/exojax/__init__.py on lines 0..8

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 36.

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 4 locations. Consider refactoring.
Confirmed

Severity: Major
Found in src/exojax/atm/__init__.py and 3 other locations - About 50 mins to fix
src/exojax/data/__init__.py on lines 0..8
src/exojax/utils/__init__.py on lines 0..8
src/exojax/__init__.py on lines 0..8

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 36.

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 _nsol_aag21 has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Confirmed

def _nsol_aag21():
    """provides solar abundance dictionary from AAG21.

    Args:
        database: name of database.
Severity: Minor
Found in src/exojax/utils/zsol.py - About 45 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 split_simple has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

def split_simple(molname_simple):
    """splits simple molname.

    Args:
        molname_simple: simple molname
Severity: Minor
Found in src/exojax/utils/molname.py - About 45 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 plotcf has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

def plotcf(
    nus,
    dtauM,
    Tarr,
    Parr,
Severity: Minor
Found in src/exojax/plot/atmplot.py - About 45 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 premodit_devmemory_use has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def premodit_devmemory_use(
    ngrid_nu_grid,
    ngrid_broadpar,
    ngrid_elower,
    nlayer=None,
Severity: Minor
Found in src/exojax/utils/memuse.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 molmass_hitran has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def molmass_hitran():
    """molar mass info from HITRAN_molparam.txt


    Returns:
Severity: Minor
Found in src/exojax/utils/isotopes.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 plot_dgm has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def plot_dgm(dgm_sigmaD, dgm_gammaL, sigmaDM, gammaLM, js=0, je=10):
    """plot DIT grid matrix (dgm)

    Args:
       dgm_sigmaD: DIT grid matrix of sigmaD (Nlayer x Ngrid)
Severity: Minor
Found in src/exojax/plot/ditplot.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 device_memory_use has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def device_memory_use(opa, art=None, nfree=None, print_summary=True):
    """device memory use given opa and art (optional), n free parameters (optional)

    Args:
        opa (opa): opa instance
Severity: Minor
Found in src/exojax/utils/memuse.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 plot_dgmn has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def plot_dgmn(Parr, dgm_ngammaL, ngammaLM, js, je):
    """plot MODIT grid matrix (dgm)

    Args:
       Parr: pressure layer (Nlayer)
Severity: Minor
Found in src/exojax/plot/ditplot.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
Status
Source
Language