linuxmuster/linuxmuster-base7

View on GitHub

Showing 69 of 69 total issues

File functions.py has 853 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#!/usr/bin/python3
#
# functions.py
#
# thomas@linuxmuster.net
Severity: Major
Found in lib/functions.py - About 2 days to fix

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

    try:
        firewallip = setup.get('setup', 'firewallip')
        if not isValidHostIpv4(firewallip):
            printScript(' ' + firewallip + ' is not valid!',
                        '', True, True, False, len(msg))
    Severity: Major
    Found in lib/setup.d/a_ini.py and 2 other locations - About 7 hrs to fix
    lib/setup.d/a_ini.py on lines 40..49
    lib/setup.d/a_ini.py on lines 84..93

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

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

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

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

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

    Refactorings

    Further Reading

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

    try:
        domainname = setup.get('setup', 'domainname')
        if not isValidDomainname(domainname):
            printScript(' ' + domainname + ' is not valid!',
                        '', True, True, False, len(msg))
    Severity: Major
    Found in lib/setup.d/a_ini.py and 2 other locations - About 7 hrs to fix
    lib/setup.d/a_ini.py on lines 84..93
    lib/setup.d/a_ini.py on lines 149..158

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

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

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

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

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

    Refactorings

    Further Reading

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

    try:
        serverip = setup.get('setup', 'serverip')
        if not isValidHostIpv4(serverip):
            printScript(' ' + serverip + ' is not valid!',
                        '', True, True, False, len(msg))
    Severity: Major
    Found in lib/setup.d/a_ini.py and 2 other locations - About 7 hrs to fix
    lib/setup.d/a_ini.py on lines 40..49
    lib/setup.d/a_ini.py on lines 149..158

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

    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:
        subProc('sophomorix-admin --create-global-admin global-admin --password "'
                + adminpw + '"', logfile)
        subProc('sophomorix-user --user global-admin --comment "'
                + sophomorix_comment + '"', logfile)
    Severity: Major
    Found in lib/setup.d/k_samba-users.py and 1 other location - About 5 hrs to fix
    lib/setup.d/k_samba-users.py on lines 87..95

    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

    try:
        subProc('sophomorix-admin --create-global-binduser global-binduser --password "'
                + binduserpw + '"', logfile)
        subProc('sophomorix-user --user global-binduser --comment "'
                + sophomorix_comment + '"', logfile)
    Severity: Major
    Found in lib/setup.d/k_samba-users.py and 1 other location - About 5 hrs to fix
    lib/setup.d/k_samba-users.py on lines 74..82

    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 dhcprange2 == '':
        dhcprange2 = serverip.split('.')[
                                0] + '.' + serverip.split('.')[1] + '.' + serverip.split('.')[2] + '.' + '200'
    Severity: Major
    Found in lib/setup.d/c_general-dialog.py and 1 other location - About 5 hrs to fix
    lib/setup.d/c_general-dialog.py on lines 95..97

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

    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

    Function getDevicesArray has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
    Open

    def getDevicesArray(fieldnrs='', subnet='', pxeflag='', stype=False,
                        school='default-school'):
        devices_array = []
        if school == "default-school":
            infile = open(constants.SOPHOSYSDIR
    Severity: Minor
    Found in lib/functions.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

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

    if dhcprange1 == '':
        dhcprange1 = serverip.split('.')[
                                0] + '.' + serverip.split('.')[1] + '.' + serverip.split('.')[2] + '.' + '100'
    Severity: Major
    Found in lib/setup.d/c_general-dialog.py and 1 other location - About 5 hrs to fix
    lib/setup.d/c_general-dialog.py on lines 98..100

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

    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:
        setup = configparser.RawConfigParser(
            delimiters=('='), inline_comment_prefixes=('#', ';'))
        setup.read(setupini)
        # get ip addresses
    Severity: Major
    Found in lib/setup.d/h_ssh.py and 1 other location - About 5 hrs to fix
    lib/setup.d/i_linbo.py on lines 25..33

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

    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:
        setup = configparser.RawConfigParser(
            delimiters=('='), inline_comment_prefixes=('#', ';'))
        setup.read(setupini)
        serverip = setup.get('setup', 'serverip')
    Severity: Major
    Found in lib/setup.d/i_linbo.py and 1 other location - About 5 hrs to fix
    lib/setup.d/h_ssh.py on lines 26..35

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

    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:
        sambaTool('dns add localhost ' + domainname + ' ' + hostname + ' A ' + ip)
        print('Added A record for ' + fqdn + '.')
    except:
        print('Failed to add A record for ' + fqdn + '.')
    Severity: Major
    Found in lib/dhcpd-update-samba-dns.py and 1 other location - About 4 hrs to fix
    lib/dhcpd-update-samba-dns.py on lines 93..98

    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

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

    try:
        sambaTool('dns add localhost ' + zone + ' ' + oc4 + ' PTR ' + fqdn)
        print('Added PTR record for ' + ip + '.')
    except:
        print('Failed to add PTR record for ' + ip + '.')
    Severity: Major
    Found in lib/dhcpd-update-samba-dns.py and 1 other location - About 4 hrs to fix
    lib/dhcpd-update-samba-dns.py on lines 76..81

    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

    Function main has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
    Open

    def main():
        # get various setup values
        msg = 'Reading setup data '
        printScript(msg, '', False, False, True)
        try:
    Severity: Minor
    Found in lib/setup.d/m_firewall.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

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

        if sambaTool('dns delete localhost ' + zone + ' ' + oc4 + ' PTR ' + fqdn):
            print('Deleted PTR record for ' + item + ' -> ' + fqdn + '.')
    Severity: Major
    Found in lib/dhcpd-update-samba-dns.py and 1 other location - About 3 hrs to fix
    lib/dhcpd-update-samba-dns.py on lines 64..65

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

    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 sambaTool('dns delete localhost ' + domainname + ' ' + hostname + ' A ' + item):
            print('Deleted A record for ' + fqdn + ' -> ' + item + '.')
    Severity: Major
    Found in lib/dhcpd-update-samba-dns.py and 1 other location - About 3 hrs to fix
    lib/dhcpd-update-samba-dns.py on lines 68..69

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

    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

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

    def scpTransfer(ip, mode, sourcefile, targetfile, secret='', sshuser='root'):
        if mode == 'get' or mode == 'put':
            printScript(mode + ' ' + ip + ' ' + sourcefile + ' ' + targetfile)
        else:
            print('Usage: scpTransfer(ip, mode, sourcefile, targetfile, secret, sshuser)')
    Severity: Minor
    Found in lib/functions.py - About 2 hrs to fix

    Cognitive Complexity

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

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

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

    Further reading

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

    try:
        subProc('linuxmuster-import-subnets', logfile)
        printScript(' Success!', '', True, True, False, len(msg))
    except Exception as error:
        printScript(error, '', True, True, False, len(msg))
    Severity: Major
    Found in lib/setup.d/z_final.py and 4 other locations - About 2 hrs to fix
    lib/setup.d/j_samba-provisioning.py on lines 121..126
    lib/setup.d/k_samba-users.py on lines 40..45
    lib/setup.d/z_final.py on lines 41..46
    lib/setup.d/z_final.py on lines 66..71

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

    try:
        subProc('systemctl restart apparmor.service', logfile)
        printScript(' Success!', '', True, True, False, len(msg))
    except Exception as error:
        printScript(error, '', True, True, False, len(msg))
    Severity: Major
    Found in lib/setup.d/z_final.py and 4 other locations - About 2 hrs to fix
    lib/setup.d/j_samba-provisioning.py on lines 121..126
    lib/setup.d/k_samba-users.py on lines 40..45
    lib/setup.d/z_final.py on lines 66..71
    lib/setup.d/z_final.py on lines 85..90

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

    try:
        subProc('sophomorix-samba --backup-samba without-sophomorix-schema', logfile)
        printScript(' Success!', '', True, True, False, len(msg))
    except Exception as error:
        printScript(error, '', True, True, False, len(msg))
    Severity: Major
    Found in lib/setup.d/j_samba-provisioning.py and 4 other locations - About 2 hrs to fix
    lib/setup.d/k_samba-users.py on lines 40..45
    lib/setup.d/z_final.py on lines 41..46
    lib/setup.d/z_final.py on lines 66..71
    lib/setup.d/z_final.py on lines 85..90

    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

    Severity
    Category
    Status
    Source
    Language