EventGhost/EventGhost

View on GitHub
plugins/Weather/__init__.py

Summary

Maintainability
C
7 hrs
Test Coverage

File __init__.py has 255 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
#
# plugins/Weather/__init__.py
#
# Copyright (C) 2009 Peter
Severity: Minor
Found in plugins/Weather/__init__.py - About 2 hrs to fix

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

        def Configure(self, parameter_name1="", parameter_name2="", parameter_name3=0):
    
            text=self.text
    
            dialog = eg.ConfigPanel(self)
    Severity: Minor
    Found in plugins/Weather/__init__.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 Configure has 37 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def Configure(self, parameter_name1="", parameter_name2="", parameter_name3=0):
    
            text=self.text
    
            dialog = eg.ConfigPanel(self)
    Severity: Minor
    Found in plugins/Weather/__init__.py - About 1 hr to fix

      Function Configure has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def Configure(self, location_id = "Antwerp, Belgium", hl=''):
      
              text=self.text
      
              dialog = eg.ConfigPanel(self)
      Severity: Minor
      Found in plugins/Weather/__init__.py - About 1 hr to fix

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

            def __call__(self, parameter_name1, parameter_name2, parameter_name3):
                if self.plugin.weather_data is None:
                     return None
                elif parameter_name1 == "" and parameter_name2 == "":
                     return self.plugin.weather_data
        Severity: Minor
        Found in plugins/Weather/__init__.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

        Avoid too many return statements within this function.
        Open

                         return self.plugin.weather_data[parameter_name1][parameter_name2]
        Severity: Major
        Found in plugins/Weather/__init__.py - About 30 mins to fix

          There are no issues that match your filters.

          Category
          Status