tobspr/RenderPipeline

View on GitHub
toolkit/plugin_configurator/main.py

Summary

Maintainability
D
1 day
Test Coverage

File main.py has 345 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""

RenderPipeline

Copyright (c) 2014-2016 tobspr <tobias.springer1@gmail.com>
Severity: Minor
Found in toolkit/plugin_configurator/main.py - About 4 hrs to fix

    Function _get_widget_for_setting has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
    Open

        def _get_widget_for_setting(self, setting_id, setting):
            """ Returns an appropriate widget to control the given setting """
    
            widget = QWidget()
            layout = QHBoxLayout()
    Severity: Minor
    Found in toolkit/plugin_configurator/main.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

    PluginConfigurator has 21 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class PluginConfigurator(QMainWindow, Ui_MainWindow):
    
        """ Interface to change the plugin settings """
    
        def __init__(self):
    Severity: Minor
    Found in toolkit/plugin_configurator/main.py - About 2 hrs to fix

      Function update_thread has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

          def update_thread(self):
              """ Internal update thread """
              while True:
                  if len(self._update_queue) > 0:
                      item = self._update_queue.pop(-1)
      Severity: Minor
      Found in toolkit/plugin_configurator/main.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 _render_current_settings has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def _render_current_settings(self):
              """ Renders the current plugin settings """
              settings = self._plugin_mgr.settings[self._current_plugin]
      
              # remove all rows
      Severity: Minor
      Found in toolkit/plugin_configurator/main.py - About 55 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 deeply nested control flow statements.
      Open

                              if entry.split()[1] == setting_id:
                                  self._update_queue.remove(entry)
                  time.sleep(0.2)
      Severity: Major
      Found in toolkit/plugin_configurator/main.py - About 45 mins to fix

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

            def _do_update_setting(self, setting_id, value):
                """ Updates a setting of the current plugin """
        
                # Check whether the setting is a runtime setting
                setting_handle = self._plugin_mgr.get_setting_handle(
        Severity: Minor
        Found in toolkit/plugin_configurator/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

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

        os.chdir(os.path.join(os.path.dirname(os.path.realpath(__file__))))
        Severity: Minor
        Found in toolkit/plugin_configurator/main.py and 2 other locations - About 35 mins to fix
        toolkit/day_time_editor/main.py on lines 38..38
        toolkit/material_editor/main.py on lines 41..41

        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

            def _set_settings_visible(self, flag):
                """ Sets whether the settings panel is visible or not """
                if flag:
                    self.frame_details.show()
                else:
        Severity: Minor
        Found in toolkit/plugin_configurator/main.py and 1 other location - About 35 mins to fix
        rpcore/gui/debugger.py on lines 161..166

        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

        There are no issues that match your filters.

        Category
        Status