saltstack/salt

View on GitHub

Showing 9,400 of 17,590 total issues

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

    def run(self):
        '''
        Load and start all available api modules
        '''
        if not len(self.netapi):
Severity: Minor
Found in salt/client/netapi.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 value_present has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def value_present(name, xpath, value, **kwargs):
    '''
    .. versionadded:: Neon

    Manages a given XML file
Severity: Minor
Found in salt/states/xml.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 _check_and_uninstall_ruby has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def _check_and_uninstall_ruby(ret, ruby, user=None):
    '''
    Verify that ruby is uninstalled
    '''
    ret = _ruby_installed(ret, ruby, user=user)
Severity: Minor
Found in salt/states/rbenv.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 ignores_kwargs has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def ignores_kwargs(*kwarg_names):
    '''
    Decorator to filter out unexpected keyword arguments from the call

    kwarg_names:
Severity: Minor
Found in salt/utils/decorators/__init__.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 get_settings has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def get_settings(profile, section, store='local'):
    '''
    Get the firewall property from the specified profile in the specified store
    as returned by ``netsh advfirewall``.

Severity: Minor
Found in salt/utils/win_lgpo_netsh.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 format_graylog_v0 has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def format_graylog_v0(self, record):
        '''
        Graylog 'raw' format is essentially the raw record, minimally munged to provide
        the bare minimum that td-agent requires to accept and route the event.  This is
        well suited to a config where the client td-agents log directly to Graylog.
Severity: Minor
Found in salt/log/handlers/fluent_mod.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 _handle_sigusr2 has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def _handle_sigusr2(sig, stack):
    '''
    Signal handler for SIGUSR2, only available on Unix-like systems
    '''
    try:
Severity: Minor
Found in salt/utils/debug.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 format_gelf_v1_1 has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def format_gelf_v1_1(self, record):
        '''
        If your agent is (or can be) configured to forward pre-formed GELF to Graylog
        with ZERO fluent processing, this function is for YOU, pal...
        '''
Severity: Minor
Found in salt/log/handlers/fluent_mod.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 process_output_file has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def process_output_file(self):
        if self.options.output_file is not None and self.options.output_file_append is False:
            if os.path.isfile(self.options.output_file):
                try:
                    with salt.utils.files.fopen(self.options.output_file, 'w'):
Severity: Minor
Found in salt/utils/parsers.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 sync_with_handlers has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def sync_with_handlers(self, handlers=()):
        '''
        Sync the stored log records to the provided log handlers.
        '''
        if not handlers:
Severity: Minor
Found in salt/log/handlers/__init__.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 local_keys has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def local_keys(self):
        '''
        Return a dict of local keys
        '''
        ret = {'local': []}
Severity: Minor
Found in salt/key.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 _mixin_after_parsed has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def _mixin_after_parsed(self):
        if not self.args and not self.options.grains_run and not self.options.doc:
            self.print_help()
            self.error('Requires function, --grains or --doc')

Severity: Minor
Found in salt/utils/parsers.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 delete_all has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def delete_all(self):
        '''
        Delete all keys
        '''
        for status, keys in six.iteritems(self.list_keys()):
Severity: Minor
Found in salt/key.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 process_config_dir has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def process_config_dir(self):
        self.options.config_dir = os.path.expanduser(self.options.config_dir)
        config_filename = self.get_config_file_path()
        if not os.path.isdir(self.options.config_dir):
            # No logging is configured yet
Severity: Minor
Found in salt/utils/parsers.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 _call_function has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def _call_function(self, kwargs):
        '''
        Call target function that has been decorated.

        :return:
Severity: Minor
Found in salt/utils/decorators/__init__.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 process_log_file has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def process_log_file(self):
        if not getattr(self.options, self._logfile_config_setting_name_, None):
            # Log file is not set via CLI, checking loaded configuration
            if self.config.get(self._logfile_config_setting_name_, None):
                # Is the regular log file setting set?
Severity: Minor
Found in salt/utils/parsers.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 find_existing_configs has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def find_existing_configs(self, default):
        '''
        Find configuration files on the system.
        :return:
        '''
Severity: Minor
Found in salt/utils/parsers.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 compare_dicts has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def compare_dicts(old=None, new=None):
    '''
    Compare before and after results from various salt functions, returning a
    dict describing the changes that were made.
    '''
Severity: Minor
Found in salt/utils/data.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 get_error has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def get_error(self, errstr):
        '''
        Parse out an error and return a targeted error string
        '''
        for line in errstr.split('\n'):
Severity: Minor
Found in salt/client/ssh/shell.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 process_log_level_logfile has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def process_log_level_logfile(self):
        if not getattr(self.options, self._logfile_loglevel_config_setting_name_, None):
            # Log file level is not set via CLI, checking loaded configuration
            if self.config.get(self._logfile_loglevel_config_setting_name_, None):
                # Is the regular log file level setting set?
Severity: Minor
Found in salt/utils/parsers.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

Severity
Category
Status
Source
Language