benbaror/replotlib

View on GitHub

Showing 6 of 12 total issues

Function save has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    def save(self, name, plot_object):
        """Save a plot object to the hdf5 file."""
        with h5py.File(self.data_file) as h5_file:
            plot_object_group = h5_file.require_group(name)
            if name == 'rcParams':
Severity: Minor
Found in src/replotlib/replot.py - About 1 hr 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 save has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def save(self, name, dct_obj):
        if name not in ('style', 'rcParams'):
            for key, value in dct_obj['args'].items():
                try:
                    dct_obj['args'][key] = value.tolist()
Severity: Minor
Found in src/replotlib/replot.py - About 1 hr 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 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def __init__(self, data_file, ax=None, file_type='json', style=None,
Severity: Minor
Found in src/replotlib/replot.py - About 45 mins to fix

    Function main has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def main(file_name, savefig, file_type, style_file, bb):
    Severity: Minor
    Found in src/replotlib/cli.py - About 35 mins to fix

      Function replot has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def replot(file_name, file_type, style=None, savefig=False, **kargs):
      Severity: Minor
      Found in src/replotlib/cli.py - About 35 mins to fix

        Function replot has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def replot(self):
                """Replot using the recorded ploting funtions."""
                for key, plot_object in self.io.read().items():
                    if key not in ('style', 'rcParams'):
                        attr = '_'.join(key.split('_')[1:])
        Severity: Minor
        Found in src/replotlib/replot.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