saltstack/salt

View on GitHub
salt/modules/schedule.py

Summary

Maintainability
F
2 wks
Test Coverage

File schedule.py has 970 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
'''
Module for managing the Salt schedule on a minion

.. versionadded:: 2014.7.0
Severity: Major
Found in salt/modules/schedule.py - About 2 days to fix

    Function build_schedule_item has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
    Open

    def build_schedule_item(name, **kwargs):
        '''
        Build a schedule job
    
        CLI Example:
    Severity: Minor
    Found in salt/modules/schedule.py - About 6 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

    Function list_ has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
    Open

    def list_(show_all=False,
              show_disabled=True,
              where=None,
              return_yaml=True):
        '''
    Severity: Minor
    Found in salt/modules/schedule.py - About 5 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

    Function postpone_job has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
    Open

    def postpone_job(name,
                     current_time,
                     new_time,
                     **kwargs):
        '''
    Severity: Minor
    Found in salt/modules/schedule.py - About 4 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

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

    def purge(**kwargs):
        '''
        Purge all the jobs currently scheduled on the minion
    
        CLI Example:
    Severity: Minor
    Found in salt/modules/schedule.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

    Function add has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
    Open

    def add(name, **kwargs):
        '''
        Add a job to the schedule
    
        CLI Example:
    Severity: Minor
    Found in salt/modules/schedule.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

    Function skip_job has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
    Open

    def skip_job(name, current_time, **kwargs):
        '''
        Skip a job in the minion's schedule at specified time.
    
        Time to skip should be specified as date string format,
    Severity: Minor
    Found in salt/modules/schedule.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

    Cyclomatic complexity is too high in function build_schedule_item. (30)
    Open

    def build_schedule_item(name, **kwargs):
        '''
        Build a schedule job
    
        CLI Example:
    Severity: Minor
    Found in salt/modules/schedule.py by radon

    Cyclomatic Complexity

    Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

    Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

    Construct Effect on CC Reasoning
    if +1 An if statement is a single decision.
    elif +1 The elif statement adds another decision.
    else +0 The else statement does not cause a new decision. The decision is at the if.
    for +1 There is a decision at the start of the loop.
    while +1 There is a decision at the while statement.
    except +1 Each except branch adds a new conditional path of execution.
    finally +0 The finally block is unconditionally executed.
    with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
    assert +1 The assert statement internally roughly equals a conditional statement.
    Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
    Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

    Source: http://radon.readthedocs.org/en/latest/intro.html

    Function delete has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

    def delete(name, **kwargs):
        '''
        Delete a job from the minion's schedule
    
        CLI Example:
    Severity: Minor
    Found in salt/modules/schedule.py - About 2 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

    Function disable_job has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

    def disable_job(name, **kwargs):
        '''
        Disable a job in the minion's schedule
    
        CLI Example:
    Severity: Minor
    Found in salt/modules/schedule.py - About 2 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

    Function enable_job has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

    def enable_job(name, **kwargs):
        '''
        Enable a job in the minion's schedule
    
        CLI Example:
    Severity: Minor
    Found in salt/modules/schedule.py - About 2 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

    Function modify has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

    def modify(name, **kwargs):
        '''
        Modify an existing job in the schedule
    
        CLI Example:
    Severity: Minor
    Found in salt/modules/schedule.py - About 2 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

    Function reload_ has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

    def reload_():
        '''
        Reload saved scheduled jobs on the minion
    
        CLI Example:
    Severity: Minor
    Found in salt/modules/schedule.py - About 2 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

    Function copy has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

    def copy(name, target, **kwargs):
        '''
        Copy scheduled job to another minion or minions.
    
        CLI Example:
    Severity: Minor
    Found in salt/modules/schedule.py - About 2 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

    Function move has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

    def move(name, target, **kwargs):
        '''
        Move scheduled job to another minion or minions.
    
        CLI Example:
    Severity: Minor
    Found in salt/modules/schedule.py - About 2 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

    Cyclomatic complexity is too high in function modify. (22)
    Open

    def modify(name, **kwargs):
        '''
        Modify an existing job in the schedule
    
        CLI Example:
    Severity: Minor
    Found in salt/modules/schedule.py by radon

    Cyclomatic Complexity

    Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

    Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

    Construct Effect on CC Reasoning
    if +1 An if statement is a single decision.
    elif +1 The elif statement adds another decision.
    else +0 The else statement does not cause a new decision. The decision is at the if.
    for +1 There is a decision at the start of the loop.
    while +1 There is a decision at the while statement.
    except +1 Each except branch adds a new conditional path of execution.
    finally +0 The finally block is unconditionally executed.
    with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
    assert +1 The assert statement internally roughly equals a conditional statement.
    Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
    Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

    Source: http://radon.readthedocs.org/en/latest/intro.html

    Cyclomatic complexity is too high in function add. (22)
    Open

    def add(name, **kwargs):
        '''
        Add a job to the schedule
    
        CLI Example:
    Severity: Minor
    Found in salt/modules/schedule.py by radon

    Cyclomatic Complexity

    Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

    Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

    Construct Effect on CC Reasoning
    if +1 An if statement is a single decision.
    elif +1 The elif statement adds another decision.
    else +0 The else statement does not cause a new decision. The decision is at the if.
    for +1 There is a decision at the start of the loop.
    while +1 There is a decision at the while statement.
    except +1 Each except branch adds a new conditional path of execution.
    finally +0 The finally block is unconditionally executed.
    with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
    assert +1 The assert statement internally roughly equals a conditional statement.
    Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
    Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

    Source: http://radon.readthedocs.org/en/latest/intro.html

    Cyclomatic complexity is too high in function list_. (21)
    Open

    def list_(show_all=False,
              show_disabled=True,
              where=None,
              return_yaml=True):
        '''
    Severity: Minor
    Found in salt/modules/schedule.py by radon

    Cyclomatic Complexity

    Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

    Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

    Construct Effect on CC Reasoning
    if +1 An if statement is a single decision.
    elif +1 The elif statement adds another decision.
    else +0 The else statement does not cause a new decision. The decision is at the if.
    for +1 There is a decision at the start of the loop.
    while +1 There is a decision at the while statement.
    except +1 Each except branch adds a new conditional path of execution.
    finally +0 The finally block is unconditionally executed.
    with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
    assert +1 The assert statement internally roughly equals a conditional statement.
    Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
    Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

    Source: http://radon.readthedocs.org/en/latest/intro.html

    Function disable has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    def disable(**kwargs):
        '''
        Disable all scheduled jobs on the minion
    
        CLI Example:
    Severity: Minor
    Found in salt/modules/schedule.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 enable has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    def enable(**kwargs):
        '''
        Enable all scheduled jobs on the minion
    
        CLI Example:
    Severity: Minor
    Found in salt/modules/schedule.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 run_job has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    def run_job(name, force=False):
        '''
        Run a scheduled job on the minion immediately
    
        CLI Example:
    Severity: Minor
    Found in salt/modules/schedule.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 save has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    def save(**kwargs):
        '''
        Save all scheduled jobs on the minion
    
        CLI Example:
    Severity: Minor
    Found in salt/modules/schedule.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

    Avoid deeply nested control flow statements.
    Open

                            if name in schedule and schedule[name]['enabled']:
                                ret['result'] = True
                                ret['comment'] = 'Enabled Job {0} in schedule.'.format(name)
                            else:
                                ret['result'] = False
    Severity: Major
    Found in salt/modules/schedule.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                              if 'enabled' in schedule and not schedule['enabled']:
                                  ret['result'] = True
                                  ret['comment'] = 'Disabled schedule on minion.'
                              else:
                                  ret['result'] = False
      Severity: Major
      Found in salt/modules/schedule.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                if name not in schedule:
                                    ret['result'] = True
                                    ret['comment'] = 'Deleted Job {0} from schedule.'.format(name)
                                else:
                                    ret['comment'] = 'Failed to delete job {0} from schedule.'.format(name)
        Severity: Major
        Found in salt/modules/schedule.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                  if name in schedule and schedule[name]['enabled']:
                                      ret['result'] = True
                                      ret['comment'] = 'Added Skip Job {0} in schedule.'.format(name)
                                  else:
                                      ret['result'] = False
          Severity: Major
          Found in salt/modules/schedule.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                    if name in schedule and schedule[name]['enabled']:
                                        ret['result'] = True
                                        ret['comment'] = 'Postponed Job {0} in schedule.'.format(name)
                                    else:
                                        ret['result'] = False
            Severity: Major
            Found in salt/modules/schedule.py - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                      if name in schedule and not schedule[name]['enabled']:
                                          ret['result'] = True
                                          ret['comment'] = 'Disabled Job {0} in schedule.'.format(name)
                                      else:
                                          ret['result'] = False
              Severity: Major
              Found in salt/modules/schedule.py - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                        if 'enabled' in schedule and schedule['enabled']:
                                            ret['result'] = True
                                            ret['comment'] = 'Enabled schedule on minion.'
                                        else:
                                            ret['result'] = False
                Severity: Major
                Found in salt/modules/schedule.py - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                          if event_ret and event_ret['complete']:
                                              _schedule_ret = event_ret['schedule']
                                              if name not in _schedule_ret:
                                                  ret['result'] = True
                                                  ret['comment'].append('Deleted job: {0} from schedule.'.format(name))
                  Severity: Major
                  Found in salt/modules/schedule.py - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                            if name in schedule:
                                                ret['result'] = True
                                                ret['comment'] = 'Added job: {0} to schedule.'.format(name)
                                                return ret
                            except KeyError:
                    Severity: Major
                    Found in salt/modules/schedule.py - About 45 mins to fix

                      Avoid too many return statements within this function.
                      Open

                                  return ret
                      Severity: Major
                      Found in salt/modules/schedule.py - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                            return ret
                        Severity: Major
                        Found in salt/modules/schedule.py - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                                      return ret
                          Severity: Major
                          Found in salt/modules/schedule.py - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                return schedule[name]
                            Severity: Major
                            Found in salt/modules/schedule.py - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                  return ret
                              Severity: Major
                              Found in salt/modules/schedule.py - About 30 mins to fix

                                Avoid too many return statements within this function.
                                Open

                                                        return ret
                                Severity: Major
                                Found in salt/modules/schedule.py - About 30 mins to fix

                                  Avoid too many return statements within this function.
                                  Open

                                      return ret
                                  Severity: Major
                                  Found in salt/modules/schedule.py - About 30 mins to fix

                                    Avoid too many return statements within this function.
                                    Open

                                            return ret
                                    Severity: Major
                                    Found in salt/modules/schedule.py - About 30 mins to fix

                                      Avoid too many return statements within this function.
                                      Open

                                                          return ret
                                      Severity: Major
                                      Found in salt/modules/schedule.py - About 30 mins to fix

                                        Avoid too many return statements within this function.
                                        Open

                                            return ret
                                        Severity: Major
                                        Found in salt/modules/schedule.py - About 30 mins to fix

                                          Avoid too many return statements within this function.
                                          Open

                                              return ret
                                          Severity: Major
                                          Found in salt/modules/schedule.py - About 30 mins to fix

                                            Avoid too many return statements within this function.
                                            Open

                                                        return ret
                                            Severity: Major
                                            Found in salt/modules/schedule.py - About 30 mins to fix

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

                                                      try:
                                                          with salt.utils.event.get_event('minion', opts=__opts__) as event_bus:
                                                              res = __salt__['event.fire'](event_data, 'manage_schedule')
                                                              if res:
                                                                  event_ret = event_bus.get_event(
                                              Severity: Major
                                              Found in salt/modules/schedule.py and 2 other locations - About 1 day to fix
                                              salt/modules/schedule.py on lines 638..658
                                              salt/modules/schedule.py on lines 1099..1119

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

                                              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 3 locations. Consider refactoring.
                                              Open

                                                      try:
                                                          with salt.utils.event.get_event('minion', opts=__opts__) as event_bus:
                                                              res = __salt__['event.fire'](event_data, 'manage_schedule')
                                                              if res:
                                                                  event_ret = event_bus.get_event(
                                              Severity: Major
                                              Found in salt/modules/schedule.py and 2 other locations - About 1 day to fix
                                              salt/modules/schedule.py on lines 1099..1119
                                              salt/modules/schedule.py on lines 1182..1202

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

                                              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 3 locations. Consider refactoring.
                                              Open

                                                      try:
                                                          with salt.utils.event.get_event('minion', opts=__opts__) as event_bus:
                                                              res = __salt__['event.fire'](event_data, 'manage_schedule')
                                                              if res:
                                                                  event_ret = event_bus.get_event(
                                              Severity: Major
                                              Found in salt/modules/schedule.py and 2 other locations - About 1 day to fix
                                              salt/modules/schedule.py on lines 638..658
                                              salt/modules/schedule.py on lines 1182..1202

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

                                              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 not new_time:
                                                      ret['comment'] = 'Job new_time is required.'
                                                      ret['result'] = False
                                                      return ret
                                                  else:
                                              Severity: Major
                                              Found in salt/modules/schedule.py and 1 other location - About 4 hrs to fix
                                              salt/modules/schedule.py on lines 1045..1059

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

                                              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 not current_time:
                                                      ret['comment'] = 'Job current time is required.'
                                                      ret['result'] = False
                                                      return ret
                                                  else:
                                              Severity: Major
                                              Found in salt/modules/schedule.py and 1 other location - About 4 hrs to fix
                                              salt/modules/schedule.py on lines 1061..1075

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

                                              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

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

                                                  for item in ['seconds', 'minutes', 'hours', 'days']:
                                                      if item in kwargs and 'when' in kwargs:
                                                          time_conflict = True
                                                      if item in kwargs and 'cron' in kwargs:
                                                          time_conflict = True
                                              Severity: Major
                                              Found in salt/modules/schedule.py and 2 other locations - About 3 hrs to fix
                                              salt/modules/schedule.py on lines 313..318
                                              salt/modules/schedule.py on lines 493..498

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

                                              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

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

                                                  for item in ['seconds', 'minutes', 'hours', 'days']:
                                                      if item in kwargs and 'when' in kwargs:
                                                          time_conflict = True
                                              
                                                      if item in kwargs and 'cron' in kwargs:
                                              Severity: Major
                                              Found in salt/modules/schedule.py and 2 other locations - About 3 hrs to fix
                                              salt/modules/schedule.py on lines 313..318
                                              salt/modules/schedule.py on lines 425..429

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

                                              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

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

                                                  for item in ['seconds', 'minutes', 'hours', 'days']:
                                                      if item in kwargs and 'when' in kwargs:
                                                          time_conflict = True
                                              
                                                      if item in kwargs and 'cron' in kwargs:
                                              Severity: Major
                                              Found in salt/modules/schedule.py and 2 other locations - About 3 hrs to fix
                                              salt/modules/schedule.py on lines 425..429
                                              salt/modules/schedule.py on lines 493..498

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

                                              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 'enabled' in schedule and not schedule['enabled']:
                                                                          ret['result'] = True
                                                                          ret['comment'] = 'Disabled schedule on minion.'
                                                                      else:
                                                                          ret['result'] = False
                                              Severity: Major
                                              Found in salt/modules/schedule.py and 1 other location - About 3 hrs to fix
                                              salt/modules/beacons.py on lines 529..534

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

                                              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 'enabled' in schedule and schedule['enabled']:
                                                                          ret['result'] = True
                                                                          ret['comment'] = 'Enabled schedule on minion.'
                                                                      else:
                                                                          ret['result'] = False
                                              Severity: Major
                                              Found in salt/modules/schedule.py and 1 other location - About 2 hrs to fix
                                              salt/modules/beacons.py on lines 485..490

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

                                              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

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

                                                  if 'when' in kwargs and 'cron' in kwargs:
                                                      ret['result'] = False
                                                      ret['comment'] = 'Unable to use "when" and "cron" options together.  Ignoring.'
                                                      return ret
                                              Severity: Major
                                              Found in salt/modules/schedule.py and 1 other location - About 1 hr to fix
                                              salt/modules/schedule.py on lines 505..508

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

                                              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

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

                                                  if 'when' in kwargs and 'cron' in kwargs:
                                                      ret['result'] = False
                                                      ret['comment'] = 'Unable to use "when" and "cron" options together.  Ignoring.'
                                                      return ret
                                              Severity: Major
                                              Found in salt/modules/schedule.py and 1 other location - About 1 hr to fix
                                              salt/modules/schedule.py on lines 325..328

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

                                              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 'name' in kwargs:
                                                      schedule[name]['name'] = kwargs['name']
                                                  else:
                                                      schedule[name]['name'] = name
                                              Severity: Major
                                              Found in salt/modules/schedule.py and 1 other location - About 1 hr to fix
                                              salt/modules/schedule.py on lines 356..359

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

                                              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 'enabled' in kwargs:
                                                      schedule[name]['enabled'] = kwargs['enabled']
                                                  else:
                                                      schedule[name]['enabled'] = True
                                              Severity: Major
                                              Found in salt/modules/schedule.py and 1 other location - About 1 hr to fix
                                              salt/modules/schedule.py on lines 351..354

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

                                              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 3 locations. Consider refactoring.
                                              Open

                                                  if schedule:
                                                      if return_yaml:
                                                          tmp = {'schedule': schedule}
                                                          return salt.utils.yaml.safe_dump(tmp, default_flow_style=False)
                                                      else:
                                              Severity: Major
                                              Found in salt/modules/schedule.py and 2 other locations - About 1 hr to fix
                                              salt/modules/beacons.py on lines 84..91
                                              salt/modules/beacons.py on lines 133..140

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

                                              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 out:
                                                          ret['comment'].append('Reloaded schedule from pillar on minion.')
                                                      else:
                                                          ret['comment'].append('Failed to reload schedule from pillar on minion.')
                                                          ret['result'] = False
                                              Severity: Major
                                              Found in salt/modules/schedule.py and 1 other location - About 1 hr to fix
                                              salt/modules/schedule.py on lines 872..876

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

                                              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 out:
                                                                  ret['comment'].append('Reloaded schedule on minion from schedule.conf.')
                                                              else:
                                                                  ret['comment'].append('Failed to reload schedule on minion from schedule.conf.')
                                                                  ret['result'] = False
                                              Severity: Major
                                              Found in salt/modules/schedule.py and 1 other location - About 1 hr to fix
                                              salt/modules/schedule.py on lines 854..858

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

                                              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 8 locations. Consider refactoring.
                                              Open

                                                  if name not in current_schedule:
                                                      ret['comment'] = 'Job {0} does not exist in schedule.'.format(name)
                                                      ret['result'] = False
                                                      return ret
                                              Severity: Major
                                              Found in salt/modules/schedule.py and 7 other locations - About 35 mins to fix
                                              salt/modules/beacons.py on lines 584..588
                                              salt/modules/beacons.py on lines 658..662
                                              salt/runners/lxc.py on lines 275..278
                                              salt/states/module.py on lines 519..522
                                              salt/states/selinux.py on lines 155..158
                                              salt/states/selinux.py on lines 235..238
                                              salt/states/selinux.py on lines 306..309

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

                                              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 3 locations. Consider refactoring.
                                              Open

                                                                      if name in schedule:
                                                                          ret['result'] = True
                                                                          ret['comment'] = 'Added job: {0} to schedule.'.format(name)
                                                                          return ret
                                              Severity: Minor
                                              Found in salt/modules/schedule.py and 2 other locations - About 35 mins to fix
                                              salt/states/docker_container.py on lines 2211..2217
                                              salt/states/powerpath.py on lines 39..42

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

                                              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