thatsIch/sublime-rainmeter

View on GitHub

Showing 68 of 68 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

            if os.path.exists(message):
                # If file is browsed
                # - verify Rainmeter.exe.
                # - reset cache
                # - save new path in settings
Severity: Minor
Found in path_initializer.py and 1 other location - About 50 mins to fix
path_initializer.py on lines 107..133

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

Avoid deeply nested control flow statements.
Open

                    for file in files:
                        probe = os.path.join(root, file)
                        if filecmp.cmp(probe, filepath):
                            config = os.path.relpath(root, skinspath)
                            logger.info("found same file '" + file + "'. Recreate interpreted config '" + config + "'.")
Severity: Major
Found in rainmeter.py - About 45 mins to fix

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    if ADD_EXTS is not None:
        ADD_EXTS = ADD_EXTS.strip().strip(r"|").strip()
    else:
        ADD_EXTS = ""
    Severity: Minor
    Found in rainopen.py and 1 other location - About 45 mins to fix
    rainopen.py on lines 18..21

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

    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

    if DEF_EXTS is not None:
        DEF_EXTS = DEF_EXTS.strip().strip(r"|").strip()
    else:
        DEF_EXTS = ""
    Severity: Minor
    Found in rainopen.py and 1 other location - About 45 mins to fix
    rainopen.py on lines 25..28

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

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

        def __filter_completions_by_sec(self, sections):
            # filter by already existing keys
            completions = []
    
            settings = sublime.load_settings("Rainmeter.sublime-settings")
    Severity: Minor
    Found in completion/section.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 __filter_completions_by_keys has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def __filter_completions_by_keys(self, keyvalues):
            """
            In Rainmeter a key can only be used once in a section statement.
    
            If you declare it twice this is a code smell.
    Severity: Minor
    Found in completion/skin/metadata_section.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 calculate_refresh_commands has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def calculate_refresh_commands(rm_exe, config, fil, activate, is_ini):
    Severity: Minor
    Found in refreshcommands.py - About 35 mins to fix

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

          def __open_enclosed_string(self):
              # 2. String enclosed in double quotes
              # Find the quotes before the current point (if any)
              lastquote = self.__find_prior_quotation_mark()
      
      
      Severity: Minor
      Found in rainopen.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

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

              logger.info("Replacing '" + original_str + "' with '" + output + "'")
      Severity: Minor
      Found in colorpicker.py and 1 other location - About 35 mins to fix
      rainmeter.py on lines 119..119

      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

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

      def open_path(path, transient=False):
          """Try to open a path.
      
          A path could be opened either as:
      
      
      Severity: Minor
      Found in rainopen.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 compile_keys has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      def compile_keys(options):
          """
          Completion can contain lots of duplicate information.
      
          For example the trigger is most of the time also the result.
      Severity: Minor
      Found in completion/compiler.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

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

                                  logger.info("found same file '" + file + "'. Recreate interpreted config '" + config + "'.")
      Severity: Minor
      Found in rainmeter.py and 1 other location - About 35 mins to fix
      colorpicker.py on lines 59..59

      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

      Avoid too many return statements within this function.
      Open

          return context_depth, context, context_depth
      Severity: Major
      Found in indentrainmeter.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                    return os.path.dirname(norm)
        Severity: Major
        Found in rainmeter.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

              return
          Severity: Major
          Found in rainmeter.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                        return self.__autocomplete_value(line_content, section) or \
            Severity: Major
            Found in completion/completion.py - About 30 mins to fix

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

                  def __transform_raw_to_original_fmt(raw, is_dec, has_alpha, is_lower):
                      # cut output from the '#' because Rainmeter does not use # for color codes
                      output = raw[1:]
                      if is_dec:
                          output = converter.convert_hex_str_to_rgba_str(output, has_alpha)
              Severity: Minor
              Found in colorpicker.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 find_resources_folders has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              def find_resources_folders(folder):
                  """
                  Find @Resources folders in the given folder.
              
                  Is case insensitive.
              Severity: Minor
              Found in install/from_folder.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 compile_values has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              def compile_values(options):
                  """
                  Bake completions from the provided YAML options.
              
                  Considers stuff like hints and values.
              Severity: Minor
              Found in completion/compiler.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 __open_whitespaced_region has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def __open_whitespaced_region(self):
                      # 3. Region from last whitespace to next whitespace
              
                      lastspace = self.__find_front_nearest_whitespace()
                      if self.__is_front_space(lastspace):
              Severity: Minor
              Found in rainopen.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