Showing 30 of 68 total issues
Function get_current_config
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def get_current_config(filepath):
"""Get the value of the #CURRENTCONFIG# variable for the specified path.
Returns None if the path is not in the skins folder
"""
- Read upRead up
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 on_query_completions
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def on_query_completions(self, view, prefix, locations):
"""
Execute if a auto completion is requested.
can be either via typing or manual invoked with ctrl+space.
- Read upRead up
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 make_path
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def make_path(string, filepath):
"""Make the string into an absolute path of an existing file or folder.
Replacing Rainmeter built-in variables relative to the file specified in
filepath (see replace_variables()) will return None if the file or folder
- Read upRead up
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 get_key_context_completion
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def get_key_context_completion(self, prefix, line_content, section, keyvalues):
"""Get a list of keys for the current context."""
if section.casefold() != "Rainmeter".casefold():
return None
- Read upRead up
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 create_skin
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def create_skin(self, name):
"""Callback method executed after the user entered the skin name."""
skinspath = get_cached_skin_path()
if not skinspath or not os.path.exists(skinspath):
sublime.error_message(
- Read upRead up
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 on_query_completions
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def on_query_completions(self, view, _, locations):
"""
Called upon auto completion request.
:param view: current view upon the text buffer
- Read upRead up
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 run
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def run(self, cmd): # pylint: disable=R0201; sublime text API, no need for class reference
"""Called when the command is run."""
# Get Rainmeter exe path
rm_path = get_cached_program_path()
- Read upRead up
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_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")
- Read upRead up
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.
- Read upRead up
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
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 + "'.")
Function calculate_refresh_commands
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def calculate_refresh_commands(rm_exe, config, fil, activate, is_ini):
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:
- Read upRead up
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.
- Read upRead up
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_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()
- Read upRead up
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
Avoid too many return
statements within this function. Open
return self.__autocomplete_value(line_content, section) or \
Avoid too many return
statements within this function. Open
return context_depth, context, context_depth
Avoid too many return
statements within this function. Open
return os.path.dirname(norm)
Function run
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def run(self):
"""Automatically executed upon calling this command."""
# check cache first to determine the default path shown to the user
install_cache_path = os.path.join(sublime.cache_path(), "Rainmeter", "install", "last_entered_folder.cache")
if os.path.exists(install_cache_path) and os.path.isfile(install_cache_path):
- Read upRead up
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 levenshtein
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def levenshtein(top_string, bot_string):
"""
The Levenshtein distance is a string metric for measuring the difference between two sequences.
Informally,
- Read upRead up
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"