saltstack/salt

View on GitHub

Showing 9,400 of 17,590 total issues

Function install has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

def install(name=None,
            refresh=False,
            skip_verify=False,
            pkgs=None,
            sources=None,
Severity: Minor
Found in salt/modules/yumpkg.py - About 1 hr to fix

    Function apply_master_config has 32 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    def apply_master_config(overrides=None, defaults=None):
        '''
        Returns master configurations dict.
        '''
        if defaults is None:
    Severity: Minor
    Found in salt/config/__init__.py - About 1 hr to fix

      Function socket_queue_thread has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

              def socket_queue_thread(self):
                  try:
                      while True:
                          try:
                              client_socket, address = self.socket_queue.get(True, 1)
      Severity: Minor
      Found in salt/transport/tcp.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 is_cached has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          def is_cached(self, path, saltenv='base', cachedir=None):
              '''
              Returns the full path to a file if it is cached locally on the minion
              otherwise returns a blank string
              '''
      Severity: Minor
      Found in salt/fileclient.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 socket has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          def socket(self):
              '''
              Lazily create the socket.
              '''
              if not hasattr(self, '_socket'):
      Severity: Minor
      Found in salt/payload.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 http_statuscode_role has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

      def http_statuscode_role(name, rawtext, text, lineno, inliner,
                               options={}, content=[]):
          if text.isdigit():
              code = int(text)
              try:
      Severity: Minor
      Found in doc/_ext/httpdomain.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 get_template has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          def get_template(
                  self,
                  url,
                  dest,
                  template='jinja',
      Severity: Minor
      Found in salt/fileclient.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 reg has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

      def reg(name):
          '''
          Activate this register to turn on a minion status tracking register, this
          register keeps the current status beacon data and the time that each beacon
          was last checked in.
      Severity: Minor
      Found in salt/thorium/status.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 insert has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

      def insert(queue, items):
          '''
          Add an item or items to a queue
          '''
          con = _conn(queue)
      Severity: Minor
      Found in salt/queues/sqlite_queue.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 clean_proc_dir has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

      def clean_proc_dir(opts):
          '''
          Clean out old tracked jobs running on the master
      
          Generally, anything tracking a job should remove the job
      Severity: Minor
      Found in salt/daemons/masterapi.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 check_autosign_dir has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          def check_autosign_dir(self, keyid):
              '''
              Check a keyid for membership in a autosign directory.
              '''
              autosign_dir = os.path.join(self.opts['pki_dir'], 'minions_autosign')
      Severity: Minor
      Found in salt/daemons/masterapi.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 init_git_pillar has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

      def init_git_pillar(opts):
          '''
          Clear out the ext pillar caches, used when the master starts
          '''
          ret = []
      Severity: Minor
      Found in salt/daemons/masterapi.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 _purge_jobs has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

      def _purge_jobs():
          write_profile = __opts__.get('etcd.returner_write_profile')
          client, path, _ = _get_conn(__opts__, write_profile)
      
          # Figure out the path that our jobs should exist at
      Severity: Minor
      Found in salt/returners/etcd_return.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 _fetch_option has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

      def _fetch_option(cfg, ret_config, virtualname, attr_name):
          """
          Fetch a given option value from the config.
      
          @see :func:`get_returner_options`
      Severity: Minor
      Found in salt/returners/__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 get_jids has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

      def get_jids():
          '''
          Return a list of all job ids that have returned something.
          '''
          client, path, _ = _get_conn(__opts__)
      Severity: Minor
      Found in salt/returners/etcd_return.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 get_fun has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

      def get_fun(fun):
          '''
          Return a dict containing the last function called for all the minions that have called a function.
          '''
          client, path, _ = _get_conn(__opts__)
      Severity: Minor
      Found in salt/returners/etcd_return.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 __compare__ has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          def __compare__(self, other, method):
              if not isinstance(other, SaltStackVersion):
                  if isinstance(other, string_types):
                      other = SaltStackVersion.parse(other)
                  elif isinstance(other, (list, tuple)):
      Severity: Minor
      Found in salt/version.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 _generate_states_report has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

      def _generate_states_report(sorted_data):
          '''
          Generate states report
          '''
          states = []
      Severity: Minor
      Found in salt/returners/highstate_return.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 returner has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

      def returner(ret):
          '''
          Send an slack message with the data
          '''
      
      
      Severity: Minor
      Found in salt/returners/slack_returner.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 get_jid has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

      def get_jid(jid):
          '''
          Return the information returned when the specified job id was executed.
          '''
          client, path, _ = _get_conn(__opts__)
      Severity: Minor
      Found in salt/returners/etcd_return.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

      Severity
      Category
      Status
      Source
      Language