helium/helium-commander

View on GitHub

Showing 12 of 36 total issues

Function cli has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

def cli(cls, singleton=False, history=True, writable=True, live=True, device=True):
    group = click.Group(name='timeseries',
                        short_help="Commands on timeseries readings.")
    resource_type = cls._resource_type()

Severity: Minor
Found in helium_commander/commands/timeseries.py - About 3 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function cli has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def cli(cls, singleton=False):
    group = click.Group(name='metadata',
                        short_help="Commands on metadata.")
    resource_type = cls._resource_type()

Severity: Minor
Found in helium_commander/commands/metadata.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 resource_lookup has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

def resource_lookup(cls, client, id_rep,
Severity: Major
Found in helium_commander/resource.py - About 50 mins to fix

    Function cli has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def cli(cls, singleton=False, history=True, writable=True, live=True, device=True):
    Severity: Minor
    Found in helium_commander/commands/timeseries.py - About 45 mins to fix

      Function update has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def update(client, config, add, remove, type, mac):
      Severity: Minor
      Found in helium_commander/commands/configuration.py - About 45 mins to fix

        Function resource_filter has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def resource_filter(cls, client, value,
        Severity: Minor
        Found in helium_commander/resource.py - About 45 mins to fix

          Function display_map has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

          def display_map(cls, client, uuid=False, include=None):
              def _trim_id(res):
                  return res.id if uuid or client.uuid else res.short_id
          
              def _config(self):
          Severity: Minor
          Found in helium_commander/device_configuration.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 update has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def update(client, sensor, name, mac, **kwargs):
          Severity: Minor
          Found in helium_commander/commands/sensor.py - About 35 mins to fix

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

            def update(client, element, name, mac, **kwargs):
            Severity: Minor
            Found in helium_commander/commands/element.py - About 35 mins to fix

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

              def filter_oneof(lookup_filters):
                  def id_func(id_rep):
                      resource_filters = [f(id_rep) for f in lookup_filters]
              
                      def func(resource):
              Severity: Minor
              Found in helium_commander/resource.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 convert has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def convert(self, value, param, ctx):
                      def collect_resources(acc, resource_rep):
                          if resource_rep.startswith('@'):
                              for line in click.open_file(resource_rep[1:]):
                                  acc.append(line.strip())
              Severity: Minor
              Found in helium_commander/options.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_wrapper has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              def main_wrapper(cmd, args, **kwargs):
                  if args is None:
                      args = sys.argv[1:]
              
                  def decorator():
              Severity: Minor
              Found in helium_commander/cli.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