saltstack/salt

View on GitHub
salt/modules/win_task.py

Summary

Maintainability
F
3 wks
Test Coverage

File win_task.py has 1793 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
# https://msdn.microsoft.com/en-us/library/windows/desktop/aa383608(v=vs.85).aspx
'''
Windows Task Scheduler Module
.. versionadded:: 2016.3.0
Severity: Major
Found in salt/modules/win_task.py - About 4 days to fix

    Function add_trigger has a Cognitive Complexity of 101 (exceeds 5 allowed). Consider refactoring.
    Open

    def add_trigger(name=None,
                    location='\\',
                    trigger_type=None,
                    trigger_enabled=True,
                    start_date=None,
    Severity: Minor
    Found in salt/modules/win_task.py - About 2 days 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 edit_task has a Cognitive Complexity of 81 (exceeds 5 allowed). Consider refactoring.
    Open

    def edit_task(name=None,
                  location='\\',
                  # General Tab
                  user_name=None,
                  password=None,
    Severity: Minor
    Found in salt/modules/win_task.py - About 1 day 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 add_trigger. (53)
    Open

    def add_trigger(name=None,
                    location='\\',
                    trigger_type=None,
                    trigger_enabled=True,
                    start_date=None,
    Severity: Minor
    Found in salt/modules/win_task.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 add_action has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
    Open

    def add_action(name=None,
                   location='\\',
                   action_type='Execute',
                   **kwargs):
        r'''
    Severity: Minor
    Found in salt/modules/win_task.py - About 7 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 edit_task. (44)
    Open

    def edit_task(name=None,
                  location='\\',
                  # General Tab
                  user_name=None,
                  password=None,
    Severity: Minor
    Found in salt/modules/win_task.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 info has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
    Open

    def info(name, location='\\'):
        r'''
        Get the details about a task in the task scheduler.
    
        Args:
    Severity: Minor
    Found in salt/modules/win_task.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

    Cyclomatic complexity is too high in function add_action. (23)
    Open

    def add_action(name=None,
                   location='\\',
                   action_type='Execute',
                   **kwargs):
        r'''
    Severity: Minor
    Found in salt/modules/win_task.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 info. (22)
    Open

    def info(name, location='\\'):
        r'''
        Get the details about a task in the task scheduler.
    
        Args:
    Severity: Minor
    Found in salt/modules/win_task.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 run_wait has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

    def run_wait(name, location='\\'):
        r'''
        Run a scheduled task and return when the task finishes
    
        Args:
    Severity: Minor
    Found in salt/modules/win_task.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 create_task_from_xml has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

    def create_task_from_xml(name,
                             location='\\',
                             xml_text=None,
                             xml_path=None,
                             user_name='System',
    Severity: Minor
    Found in salt/modules/win_task.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 info has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    def info(name, location='\\'):
        r'''
        Get the details about a task in the task scheduler.
    
        Args:
    Severity: Minor
    Found in salt/modules/win_task.py - About 1 hr to fix

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

      def _reverse_lookup(dictionary, value):
          '''
          Lookup the key in a dictionary by it's value. Will return the first match.
      
          :param dict dictionary: The dictionary to search
      Severity: Minor
      Found in salt/modules/win_task.py - About 35 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Avoid too many return statements within this function.
      Open

                  return 'Invalid value for "delete_after"'
      Severity: Major
      Found in salt/modules/win_task.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                    return 'Required parameter "days_of_week" not passed'
        Severity: Major
        Found in salt/modules/win_task.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                          return 'Invalid value for "restart_every"'
          Severity: Major
          Found in salt/modules/win_task.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                    return _save_task_definition(name=name,
            Severity: Major
            Found in salt/modules/win_task.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                          return 'Required parameter "title" not found'
              Severity: Major
              Found in salt/modules/win_task.py - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                            return 'Required parameter "message" not found'
                Severity: Major
                Found in salt/modules/win_task.py - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                                  return '"restart_count" must be a value between 1 and 999'
                  Severity: Major
                  Found in salt/modules/win_task.py - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                                return 'Invalid end_time'
                    Severity: Major
                    Found in salt/modules/win_task.py - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                                  return 'Monthly trigger requires "days_of_month" or "last_day_of_' \
                      Severity: Major
                      Found in salt/modules/win_task.py - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                    return 'Required parameter "months_of_year" not passed'
                        Severity: Major
                        Found in salt/modules/win_task.py - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                      return '{0} not found'.format(name)
                          Severity: Major
                          Found in salt/modules/win_task.py - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                        return 'Required parameter "state_change" not passed'
                            Severity: Major
                            Found in salt/modules/win_task.py - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                          return 'Required parameter "from" not found'
                              Severity: Major
                              Found in salt/modules/win_task.py - About 30 mins to fix

                                Avoid too many return statements within this function.
                                Open

                                            return 'Required parameter "to" or "cc" not found'
                                Severity: Major
                                Found in salt/modules/win_task.py - About 30 mins to fix

                                  Avoid too many return statements within this function.
                                  Open

                                              return 'Required parameter "days_of_week" not passed'
                                  Severity: Major
                                  Found in salt/modules/win_task.py - About 30 mins to fix

                                    Avoid too many return statements within this function.
                                    Open

                                            return _save_task_definition(name=name,
                                    Severity: Major
                                    Found in salt/modules/win_task.py - About 30 mins to fix

                                      Avoid too many return statements within this function.
                                      Open

                                                      return 'Invalid value for "execution_time_limit"'
                                      Severity: Major
                                      Found in salt/modules/win_task.py - About 30 mins to fix

                                        Avoid too many return statements within this function.
                                        Open

                                                    return 'Required parameter "name" not passed'
                                        Severity: Major
                                        Found in salt/modules/win_task.py - About 30 mins to fix

                                          Avoid too many return statements within this function.
                                          Open

                                                      return 'Required parameter "subscription" not passed'
                                          Severity: Major
                                          Found in salt/modules/win_task.py - About 30 mins to fix

                                            Avoid too many return statements within this function.
                                            Open

                                                        return 'Monthly DOW trigger requires "weeks_of_month" or "last_' \
                                            Severity: Major
                                            Found in salt/modules/win_task.py - About 30 mins to fix

                                              Avoid too many return statements within this function.
                                              Open

                                                      return _save_task_definition(name=name,
                                              Severity: Major
                                              Found in salt/modules/win_task.py - About 30 mins to fix

                                                Avoid too many return statements within this function.
                                                Open

                                                            return 'Required parameter "months_of_year" not passed'
                                                Severity: Major
                                                Found in salt/modules/win_task.py - About 30 mins to fix

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

                                                  def _clear_actions(name, location='\\'):
                                                      r'''
                                                      Remove all actions from the task.
                                                  
                                                      :param str name: The name of the task from which to clear all actions.
                                                  Severity: Major
                                                  Found in salt/modules/win_task.py and 1 other location - About 1 day to fix
                                                  salt/modules/win_task.py on lines 2418..2463

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

                                                  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

                                                  def clear_triggers(name, location='\\'):
                                                      r'''
                                                      Remove all triggers from the task.
                                                  
                                                      Args:
                                                  Severity: Major
                                                  Found in salt/modules/win_task.py and 1 other location - About 1 day to fix
                                                  salt/modules/win_task.py on lines 1765..1806

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

                                                  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

                                                      if kwargs.get('task_definition', False):
                                                          task_definition = kwargs.get('task_definition')
                                                      else:
                                                          save_definition = True
                                                  
                                                  
                                                  Severity: Major
                                                  Found in salt/modules/win_task.py and 2 other locations - About 7 hrs to fix
                                                  salt/modules/win_task.py on lines 1670..1694
                                                  salt/modules/win_task.py on lines 2246..2270

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

                                                  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

                                                      if kwargs.get('task_definition', False):
                                                          task_definition = kwargs.get('task_definition')
                                                      else:
                                                          save_definition = True
                                                          # Make sure a name was passed
                                                  Severity: Major
                                                  Found in salt/modules/win_task.py and 2 other locations - About 7 hrs to fix
                                                  salt/modules/win_task.py on lines 991..1016
                                                  salt/modules/win_task.py on lines 2246..2270

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

                                                  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

                                                      if kwargs.get('task_definition', False):
                                                          task_definition = kwargs.get('task_definition')
                                                      else:
                                                          save_definition = True
                                                          # Make sure a name was passed
                                                  Severity: Major
                                                  Found in salt/modules/win_task.py and 2 other locations - About 7 hrs to fix
                                                  salt/modules/win_task.py on lines 991..1016
                                                  salt/modules/win_task.py on lines 1670..1694

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

                                                  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

                                                  def delete_folder(name, location='\\'):
                                                      r'''
                                                      Delete a folder from the task scheduler.
                                                  
                                                      Args:
                                                  Severity: Major
                                                  Found in salt/modules/win_task.py and 1 other location - About 6 hrs to fix
                                                  salt/modules/win_task.py on lines 1149..1189

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

                                                  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

                                                  def delete_task(name, location='\\'):
                                                      r'''
                                                      Delete a task from the task scheduler.
                                                  
                                                      Args:
                                                  Severity: Major
                                                  Found in salt/modules/win_task.py and 1 other location - About 6 hrs to fix
                                                  salt/modules/win_task.py on lines 1192..1234

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

                                                  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

                                                  def list_actions(name, location='\\'):
                                                      r'''
                                                      List all actions that pertain to a task in the specified location.
                                                  
                                                      Args:
                                                  Severity: Major
                                                  Found in salt/modules/win_task.py and 1 other location - About 5 hrs to fix
                                                  salt/modules/win_task.py on lines 435..477

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

                                                  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

                                                  def list_triggers(name, location='\\'):
                                                      r'''
                                                      List all triggers that pertain to a task in the specified location.
                                                  
                                                      Args:
                                                  Severity: Major
                                                  Found in salt/modules/win_task.py and 1 other location - About 5 hrs to fix
                                                  salt/modules/win_task.py on lines 480..522

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

                                                  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

                                                  def list_folders(location='\\'):
                                                      r'''
                                                      List all folders located in a specific location in the task scheduler.
                                                  
                                                      Args:
                                                  Severity: Major
                                                  Found in salt/modules/win_task.py and 1 other location - About 4 hrs to fix
                                                  salt/modules/win_task.py on lines 355..392

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

                                                  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

                                                  def list_tasks(location='\\'):
                                                      r'''
                                                      List all tasks located in a specific location in the task scheduler.
                                                  
                                                      Args:
                                                  Severity: Major
                                                  Found in salt/modules/win_task.py and 1 other location - About 4 hrs to fix
                                                  salt/modules/win_task.py on lines 395..432

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

                                                  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 kwargs.get('days_of_month', False) or \
                                                                  kwargs.get('last_day_of_month', False):
                                                              if kwargs.get('days_of_month', False):
                                                                  bits_days = 0
                                                                  for day in kwargs.get('days_of_month'):
                                                  Severity: Major
                                                  Found in salt/modules/win_task.py and 1 other location - About 4 hrs to fix
                                                  salt/modules/win_task.py on lines 2360..2370

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

                                                  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 kwargs.get('weeks_of_month', False) or \
                                                                  kwargs.get('last_week_of_month', False):
                                                              if kwargs.get('weeks_of_month', False):
                                                                  bits_weeks = 0
                                                                  for week in kwargs.get('weeks_of_month'):
                                                  Severity: Major
                                                  Found in salt/modules/win_task.py and 1 other location - About 4 hrs to fix
                                                  salt/modules/win_task.py on lines 2337..2346

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

                                                  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 restart_every is not None:
                                                          if restart_every is False:
                                                              task_definition.Settings.RestartInterval = ''
                                                          else:
                                                              if restart_every in duration:
                                                  Severity: Major
                                                  Found in salt/modules/win_task.py and 1 other location - About 2 hrs to fix
                                                  salt/modules/win_task.py on lines 1115..1123

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

                                                  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 execution_time_limit is not None:
                                                          if execution_time_limit is False:
                                                              task_definition.Settings.ExecutionTimeLimit = 'PT0S'
                                                          else:
                                                              if execution_time_limit in duration:
                                                  Severity: Major
                                                  Found in salt/modules/win_task.py and 1 other location - About 2 hrs to fix
                                                  salt/modules/win_task.py on lines 1100..1108

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

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

                                                          if kwargs.get('days_of_week', False):
                                                              bits_days = 0
                                                              for weekday in kwargs.get('days_of_week'):
                                                                  bits_days |= weekdays[weekday]
                                                              trigger.DaysOfWeek = bits_days
                                                  Severity: Major
                                                  Found in salt/modules/win_task.py and 3 other locations - About 1 hr to fix
                                                  salt/modules/win_task.py on lines 2329..2335
                                                  salt/modules/win_task.py on lines 2352..2358
                                                  salt/modules/win_task.py on lines 2373..2379

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

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

                                                          if kwargs.get('months_of_year', False):
                                                              bits_months = 0
                                                              for month in kwargs.get('months_of_year'):
                                                                  bits_months |= months[month]
                                                              trigger.MonthsOfYear = bits_months
                                                  Severity: Major
                                                  Found in salt/modules/win_task.py and 3 other locations - About 1 hr to fix
                                                  salt/modules/win_task.py on lines 2318..2324
                                                  salt/modules/win_task.py on lines 2329..2335
                                                  salt/modules/win_task.py on lines 2373..2379

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

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

                                                          if kwargs.get('days_of_week', False):
                                                              bits_days = 0
                                                              for weekday in kwargs.get('days_of_week'):
                                                                  bits_days |= weekdays[weekday]
                                                              trigger.DaysOfWeek = bits_days
                                                  Severity: Major
                                                  Found in salt/modules/win_task.py and 3 other locations - About 1 hr to fix
                                                  salt/modules/win_task.py on lines 2318..2324
                                                  salt/modules/win_task.py on lines 2329..2335
                                                  salt/modules/win_task.py on lines 2352..2358

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

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

                                                          if kwargs.get('months_of_year', False):
                                                              bits_months = 0
                                                              for month in kwargs.get('months_of_year'):
                                                                  bits_months |= months[month]
                                                              trigger.MonthsOfYear = bits_months
                                                  Severity: Major
                                                  Found in salt/modules/win_task.py and 3 other locations - About 1 hr to fix
                                                  salt/modules/win_task.py on lines 2318..2324
                                                  salt/modules/win_task.py on lines 2352..2358
                                                  salt/modules/win_task.py on lines 2373..2379

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

                                                  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 end_time:
                                                          time_format = _get_date_time_format(end_time)
                                                          if time_format:
                                                              tm_obj = datetime.strptime(end_time, time_format)
                                                          else:
                                                  Severity: Major
                                                  Found in salt/modules/win_task.py and 1 other location - About 1 hr to fix
                                                  salt/modules/win_task.py on lines 2211..2218

                                                  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 start_time:
                                                          time_format = _get_date_time_format(start_time)
                                                          if time_format:
                                                              tm_obj = datetime.strptime(start_time, time_format)
                                                          else:
                                                  Severity: Major
                                                  Found in salt/modules/win_task.py and 1 other location - About 1 hr to fix
                                                  salt/modules/win_task.py on lines 2231..2238

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

                                                          fc = {'0x80041319L': 'Required element or attribute missing',
                                                                '0x80041318L': 'Value incorrectly formatted or out of range',
                                                                '0x80020005L': 'Access denied',
                                                                '0x80041309L': "A task's trigger is not found",
                                                                '0x8004130aL': "One or more of the properties required to run this task have not been set",
                                                  Severity: Major
                                                  Found in salt/modules/win_task.py and 2 other locations - About 55 mins to fix
                                                  salt/modules/extfs.py on lines 162..180
                                                  salt/modules/logadm.py on lines 29..48

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

                                                  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 triggerObj.EndBoundary:
                                                              end_date, end_time = triggerObj.EndBoundary.split('T', 1)
                                                              trigger['end_date'] = end_date
                                                              trigger['end_time'] = end_time
                                                  Severity: Minor
                                                  Found in salt/modules/win_task.py and 1 other location - About 55 mins to fix
                                                  salt/modules/win_task.py on lines 1542..1545

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

                                                  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 triggerObj.StartBoundary:
                                                              start_date, start_time = triggerObj.StartBoundary.split('T', 1)
                                                              trigger['start_date'] = start_date
                                                              trigger['start_time'] = start_time
                                                  Severity: Minor
                                                  Found in salt/modules/win_task.py and 1 other location - About 55 mins to fix
                                                  salt/modules/win_task.py on lines 1546..1549

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

                                                  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 hasattr(triggerObj, 'Delay'):
                                                              if triggerObj.Delay:
                                                                  trigger['delay'] = _reverse_lookup(duration, triggerObj.Delay)
                                                              else:
                                                                  trigger['delay'] = False
                                                  Severity: Minor
                                                  Found in salt/modules/win_task.py and 1 other location - About 55 mins to fix
                                                  salt/modules/win_task.py on lines 1551..1556

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

                                                  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 hasattr(triggerObj, 'RandomDelay'):
                                                              if triggerObj.RandomDelay:
                                                                  trigger['random_delay'] = _reverse_lookup(
                                                                      duration, triggerObj.RandomDelay)
                                                              else:
                                                  Severity: Minor
                                                  Found in salt/modules/win_task.py and 1 other location - About 55 mins to fix
                                                  salt/modules/win_task.py on lines 1557..1561

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

                                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                  Refactorings

                                                  Further Reading

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

                                                      if def_set.RestartInterval == '':
                                                          settings['restart_interval'] = False
                                                      else:
                                                          settings['restart_interval'] = _reverse_lookup(
                                                              duration, def_set.RestartInterval)
                                                  Severity: Minor
                                                  Found in salt/modules/win_task.py and 1 other location - About 40 mins to fix
                                                  salt/modules/win_task.py on lines 1486..1490

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

                                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                  Refactorings

                                                  Further Reading

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

                                                      if def_set.ExecutionTimeLimit == '':
                                                          settings['execution_time_limit'] = False
                                                      else:
                                                          settings['execution_time_limit'] = _reverse_lookup(
                                                              duration, def_set.ExecutionTimeLimit)
                                                  Severity: Minor
                                                  Found in salt/modules/win_task.py and 1 other location - About 40 mins to fix
                                                  salt/modules/win_task.py on lines 1495..1499

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

                                                  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 idle_duration is not None:
                                                              if idle_duration in duration:
                                                                  task_definition.Settings.IdleSettings.IdleDuration = _lookup_first(duration, idle_duration)
                                                              else:
                                                                  return 'Invalid value for "idle_duration"'
                                                  Severity: Minor
                                                  Found in salt/modules/win_task.py and 1 other location - About 30 mins to fix
                                                  salt/modules/win_task.py on lines 1071..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 40.

                                                  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 idle_wait_timeout is not None:
                                                              if idle_wait_timeout in duration:
                                                                  task_definition.Settings.IdleSettings.WaitTimeout = _lookup_first(duration, idle_wait_timeout)
                                                              else:
                                                                  return 'Invalid value for "idle_wait_timeout"'
                                                  Severity: Minor
                                                  Found in salt/modules/win_task.py and 1 other location - About 30 mins to fix
                                                  salt/modules/win_task.py on lines 1066..1070

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

                                                  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