saltstack/salt

View on GitHub
salt/states/linux_acl.py

Summary

Maintainability
F
2 wks
Test Coverage

Function list_present has a Cognitive Complexity of 107 (exceeds 5 allowed). Consider refactoring.
Open

def list_present(name, acl_type, acl_names=None, perms='', recurse=False, force=False):
    '''
    Ensure a Linux ACL list is present

    Takes a list of acl names and add them to the given path
Severity: Minor
Found in salt/states/linux_acl.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 present has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring.
Open

def present(name, acl_type, acl_name='', perms='', recurse=False, force=False):
    '''
    Ensure a Linux ACL is present

    name
Severity: Minor
Found in salt/states/linux_acl.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

File linux_acl.py has 450 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
'''
Linux File Access Control Lists

The Linux ACL state module requires the `getfacl` and `setfacl` binaries.
Severity: Minor
Found in salt/states/linux_acl.py - About 6 hrs to fix

    Cyclomatic complexity is too high in function list_present. (37)
    Open

    def list_present(name, acl_type, acl_names=None, perms='', recurse=False, force=False):
        '''
        Ensure a Linux ACL list is present
    
        Takes a list of acl names and add them to the given path
    Severity: Minor
    Found in salt/states/linux_acl.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 absent has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
    Open

    def absent(name, acl_type, acl_name='', perms='', recurse=False):
        '''
        Ensure a Linux ACL does not exist
    
        name
    Severity: Minor
    Found in salt/states/linux_acl.py - About 4 hrs to fix

    Cognitive Complexity

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

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

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

    Further reading

    Function list_absent has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
    Open

    def list_absent(name, acl_type, acl_names=None, recurse=False):
        '''
        Ensure a Linux ACL list does not exist
    
        Takes a list of acl names and remove them from the given path
    Severity: Minor
    Found in salt/states/linux_acl.py - About 3 hrs to fix

    Cognitive Complexity

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

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

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

    Further reading

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

    def present(name, acl_type, acl_name='', perms='', recurse=False, force=False):
        '''
        Ensure a Linux ACL is present
    
        name
    Severity: Minor
    Found in salt/states/linux_acl.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

    Avoid deeply nested control flow statements.
    Open

                            if force:
                                __salt__['acl.wipefacls'](name, recursive=recurse, raise_err=True)
    
    
    Severity: Major
    Found in salt/states/linux_acl.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                          if users[search_name]['octal'] == sum([_octal.get(i, i) for i in perms]):
                              ret['comment'] = 'Permissions are in the desired state'
                          else:
                              changes.update({'new': {'acl_name': ', '.join(acl_names),
                                                                       'acl_type': acl_type,
      Severity: Major
      Found in salt/states/linux_acl.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                            if __opts__['test']:
                                ret.update({'comment': 'New permissions will be applied for '
                                                       '{0}: {1}'.format(acl_names, perms),
                                            'result': None, 'changes': changes})
                                ret['result'] = None
        Severity: Major
        Found in salt/states/linux_acl.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                  for acl_name in acl_names:
                                      __salt__['acl.modfacl'](acl_type, acl_name, perms, name,
                                                              recursive=recurse, raise_err=True)
                                  ret.update({'comment': 'Applied new permissions for '
          Severity: Major
          Found in salt/states/linux_acl.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                if _search_name in user_acl and user_acl[_search_name]['octal'] == octal_sum:
                                    acl_found = True
                                    break
                            if not acl_found:
            Severity: Major
            Found in salt/states/linux_acl.py - About 45 mins to fix

              Avoid too many return statements within this function.
              Open

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

                Avoid too many return statements within this function.
                Open

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

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

                          if users:
                              changes = {}
                              for count, search_name in enumerate(_search_names):
                                  if search_name in users:
                                      if users[search_name]['octal'] == sum([_octal.get(i, i) for i in perms]):
                  Severity: Major
                  Found in salt/states/linux_acl.py and 1 other location - About 1 day to fix
                  salt/states/linux_acl.py on lines 413..470

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 187.

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

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

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

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

                  Refactorings

                  Further Reading

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

                                  if search_name in users:
                                      if users[search_name]['octal'] == sum([_octal.get(i, i) for i in perms]):
                                          ret['comment'] = 'Permissions are in the desired state'
                                      else:
                                          changes.update({'new': {'acl_name': ', '.join(acl_names),
                  Severity: Major
                  Found in salt/states/linux_acl.py and 1 other location - About 1 day to fix
                  salt/states/linux_acl.py on lines 410..497

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 187.

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

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

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

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

                  Refactorings

                  Further Reading

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

                              try:
                                  if force:
                                      __salt__['acl.wipefacls'](name, recursive=recurse, raise_err=True)
                  
                                  __salt__['acl.modfacl'](acl_type, acl_name, perms, name,
                  Severity: Major
                  Found in salt/states/linux_acl.py and 1 other location - About 5 hrs to fix
                  salt/states/linux_acl.py on lines 180..192

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

                  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

                                  try:
                                      if force:
                                          __salt__['acl.wipefacls'](name, recursive=recurse, raise_err=True)
                  
                                      __salt__['acl.modfacl'](acl_type, acl_name, perms, name,
                  Severity: Major
                  Found in salt/states/linux_acl.py and 1 other location - About 5 hrs to fix
                  salt/states/linux_acl.py on lines 205..217

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

                  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 acl_type.startswith(('d:', 'default:')):
                          _acl_type = ':'.join(acl_type.split(':')[1:])
                          _current_perms = __current_perms[name].get('defaults', {})
                          _default = True
                      else:
                  Severity: Major
                  Found in salt/states/linux_acl.py and 2 other locations - About 4 hrs to fix
                  salt/states/linux_acl.py on lines 257..264
                  salt/states/linux_acl.py on lines 543..550

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

                  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 acl_type.startswith(('d:', 'default:')):
                          _acl_type = ':'.join(acl_type.split(':')[1:])
                          _current_perms = __current_perms[name].get('defaults', {})
                          _default = True
                      else:
                  Severity: Major
                  Found in salt/states/linux_acl.py and 2 other locations - About 4 hrs to fix
                  salt/states/linux_acl.py on lines 118..125
                  salt/states/linux_acl.py on lines 543..550

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

                  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 acl_type.startswith(('d:', 'default:')):
                          _acl_type = ':'.join(acl_type.split(':')[1:])
                          _current_perms = __current_perms[name].get('defaults', {})
                          _default = True
                      else:
                  Severity: Major
                  Found in salt/states/linux_acl.py and 2 other locations - About 4 hrs to fix
                  salt/states/linux_acl.py on lines 118..125
                  salt/states/linux_acl.py on lines 257..264

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

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

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

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

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

                  Refactorings

                  Further Reading

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

                          try:
                              users = {}
                              for i in _current_perms[_acl_type]:
                                  if i and next(six.iterkeys(i)) in _search_names:
                                      users.update(i)
                  Severity: Major
                  Found in salt/states/linux_acl.py and 1 other location - About 3 hrs to fix
                  salt/states/linux_acl.py on lines 402..408

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 66.

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

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

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

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

                  Refactorings

                  Further Reading

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

                          try:
                              users = {}
                              for i in _current_perms[_acl_type]:
                                  if i and next(six.iterkeys(i)) in _search_names:
                                      users.update(i)
                  Severity: Major
                  Found in salt/states/linux_acl.py and 1 other location - About 3 hrs to fix
                  salt/states/linux_acl.py on lines 565..571

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 66.

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

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

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

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

                  Refactorings

                  Further Reading

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

                          try:
                              user = [i for i in _current_perms[_acl_type] if next(six.iterkeys(i)) == _search_name].pop()
                          except (AttributeError, IndexError, StopIteration, KeyError):
                              user = None
                  Severity: Major
                  Found in salt/states/linux_acl.py and 1 other location - About 2 hrs to fix
                  salt/states/linux_acl.py on lines 280..283

                  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

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

                          try:
                              user = [i for i in _current_perms[_acl_type] if next(six.iterkeys(i)) == _search_name].pop()
                          except (AttributeError, IndexError, StopIteration, KeyError):
                              user = None
                  Severity: Major
                  Found in salt/states/linux_acl.py and 1 other location - About 2 hrs to fix
                  salt/states/linux_acl.py on lines 141..144

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

                      if not os.path.exists(name):
                          ret['comment'] = '{0} does not exist'.format(name)
                          ret['result'] = False
                          return ret
                  Severity: Major
                  Found in salt/states/linux_acl.py and 5 other locations - About 1 hr to fix
                  salt/states/boto_iam.py on lines 358..361
                  salt/states/linux_acl.py on lines 111..114
                  salt/states/linux_acl.py on lines 347..350
                  salt/states/linux_acl.py on lines 536..539
                  salt/states/mysql_query.py on lines 108..111

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

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

                      if not os.path.exists(name):
                          ret['comment'] = '{0} does not exist'.format(name)
                          ret['result'] = False
                          return ret
                  Severity: Major
                  Found in salt/states/linux_acl.py and 5 other locations - About 1 hr to fix
                  salt/states/boto_iam.py on lines 358..361
                  salt/states/linux_acl.py on lines 111..114
                  salt/states/linux_acl.py on lines 250..253
                  salt/states/linux_acl.py on lines 536..539
                  salt/states/mysql_query.py on lines 108..111

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

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

                      if not os.path.exists(name):
                          ret['comment'] = '{0} does not exist'.format(name)
                          ret['result'] = False
                          return ret
                  Severity: Major
                  Found in salt/states/linux_acl.py and 5 other locations - About 1 hr to fix
                  salt/states/boto_iam.py on lines 358..361
                  salt/states/linux_acl.py on lines 250..253
                  salt/states/linux_acl.py on lines 347..350
                  salt/states/linux_acl.py on lines 536..539
                  salt/states/mysql_query.py on lines 108..111

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

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

                      if not os.path.exists(name):
                          ret['comment'] = '{0} does not exist'.format(name)
                          ret['result'] = False
                          return ret
                  Severity: Major
                  Found in salt/states/linux_acl.py and 5 other locations - About 1 hr to fix
                  salt/states/boto_iam.py on lines 358..361
                  salt/states/linux_acl.py on lines 111..114
                  salt/states/linux_acl.py on lines 250..253
                  salt/states/linux_acl.py on lines 347..350
                  salt/states/mysql_query.py on lines 108..111

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

                  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 __virtual__():
                      '''
                      Ensure getfacl & setfacl exist
                      '''
                      if salt.utils.path.which('getfacl') and salt.utils.path.which('setfacl'):
                  Severity: Minor
                  Found in salt/states/linux_acl.py and 1 other location - About 55 mins to fix
                  salt/modules/varnish.py on lines 28..34

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

                      if acl_names == '':
                          _search_names = __current_perms[name].get('comment').get(_acl_type, '')
                      else:
                          _search_names = acl_names
                  Severity: Minor
                  Found in salt/states/linux_acl.py and 2 other locations - About 30 mins to fix
                  salt/states/linux_acl.py on lines 135..138
                  salt/states/linux_acl.py on lines 274..277

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

                      if acl_name == '':
                          _search_name = __current_perms[name].get('comment').get(_acl_type, '')
                      else:
                          _search_name = acl_name
                  Severity: Minor
                  Found in salt/states/linux_acl.py and 2 other locations - About 30 mins to fix
                  salt/states/linux_acl.py on lines 274..277
                  salt/states/linux_acl.py on lines 396..399

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

                      if acl_name == '':
                          _search_name = __current_perms[name].get('comment').get(_acl_type, '')
                      else:
                          _search_name = acl_name
                  Severity: Minor
                  Found in salt/states/linux_acl.py and 2 other locations - About 30 mins to fix
                  salt/states/linux_acl.py on lines 135..138
                  salt/states/linux_acl.py on lines 396..399

                  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