saltstack/salt

View on GitHub

Showing 7,542 of 17,590 total issues

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

    if username and password:
        headers['Authorization'] = 'Basic {0}'.format(base64.encodestring('{0}:{1}'.format(username, password)).replace('\n', ''))
Severity: Major
Found in salt/modules/artifactory.py and 8 other locations - About 1 hr to fix
salt/modules/artifactory.py on lines 71..72
salt/modules/artifactory.py on lines 147..148
salt/modules/artifactory.py on lines 186..187
salt/modules/nexus.py on lines 73..74
salt/modules/nexus.py on lines 113..114
salt/modules/nexus.py on lines 147..148
salt/modules/nexus.py on lines 180..181
salt/modules/nexus.py on lines 220..221

Duplicated Code

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

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

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

Tuning

This issue has a mass of 46.

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

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

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

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

Refactorings

Further Reading

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

    if username and password:
        headers['Authorization'] = 'Basic {0}'.format(base64.encodestring('{0}:{1}'.format(username, password)).replace('\n', ''))
Severity: Major
Found in salt/modules/nexus.py and 8 other locations - About 1 hr to fix
salt/modules/artifactory.py on lines 71..72
salt/modules/artifactory.py on lines 111..112
salt/modules/artifactory.py on lines 147..148
salt/modules/artifactory.py on lines 186..187
salt/modules/nexus.py on lines 73..74
salt/modules/nexus.py on lines 113..114
salt/modules/nexus.py on lines 147..148
salt/modules/nexus.py on lines 180..181

Duplicated Code

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

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

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

Tuning

This issue has a mass of 46.

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

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

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

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

Refactorings

Further Reading

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

    if out['retcode'] != 0 and out['stderr']:
        errors = [out['stderr']]
    else:
        errors = []
Severity: Major
Found in salt/modules/aptpkg.py and 16 other locations - About 1 hr to fix
salt/modules/apkpkg.py on lines 334..337
salt/modules/apkpkg.py on lines 410..413
salt/modules/ebuildpkg.py on lines 1034..1037
salt/modules/freebsdpkg.py on lines 409..412
salt/modules/freebsdpkg.py on lines 472..475
salt/modules/mac_brew_pkg.py on lines 261..264
salt/modules/mac_brew_pkg.py on lines 415..418
salt/modules/openbsdpkg.py on lines 299..302
salt/modules/pacmanpkg.py on lines 614..617
salt/modules/pacmanpkg.py on lines 739..742
salt/modules/pkgin.py on lines 429..432
salt/modules/pkgin.py on lines 577..580
salt/modules/pkgng.py on lines 893..896
salt/modules/pkgng.py on lines 1070..1073
salt/modules/solarispkg.py on lines 466..469
salt/modules/yumpkg.py on lines 2018..2021

Duplicated Code

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

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

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

Tuning

This issue has a mass of 46.

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

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

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

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

Refactorings

Further Reading

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

        if out['retcode'] != 0 and out['stderr']:
            errors = [out['stderr']]
        else:
            errors = []
Severity: Major
Found in salt/modules/solarispkg.py and 16 other locations - About 1 hr to fix
salt/modules/apkpkg.py on lines 334..337
salt/modules/apkpkg.py on lines 410..413
salt/modules/aptpkg.py on lines 810..813
salt/modules/ebuildpkg.py on lines 1034..1037
salt/modules/freebsdpkg.py on lines 409..412
salt/modules/freebsdpkg.py on lines 472..475
salt/modules/mac_brew_pkg.py on lines 261..264
salt/modules/mac_brew_pkg.py on lines 415..418
salt/modules/openbsdpkg.py on lines 299..302
salt/modules/pacmanpkg.py on lines 614..617
salt/modules/pacmanpkg.py on lines 739..742
salt/modules/pkgin.py on lines 429..432
salt/modules/pkgin.py on lines 577..580
salt/modules/pkgng.py on lines 893..896
salt/modules/pkgng.py on lines 1070..1073
salt/modules/yumpkg.py on lines 2018..2021

Duplicated Code

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

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

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

Tuning

This issue has a mass of 46.

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

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

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

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

Refactorings

Further Reading

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

    if out['retcode'] != 0 and out['stderr']:
        errors = [out['stderr']]
    else:
        errors = []
Severity: Major
Found in salt/modules/openbsdpkg.py and 16 other locations - About 1 hr to fix
salt/modules/apkpkg.py on lines 334..337
salt/modules/apkpkg.py on lines 410..413
salt/modules/aptpkg.py on lines 810..813
salt/modules/ebuildpkg.py on lines 1034..1037
salt/modules/freebsdpkg.py on lines 409..412
salt/modules/freebsdpkg.py on lines 472..475
salt/modules/mac_brew_pkg.py on lines 261..264
salt/modules/mac_brew_pkg.py on lines 415..418
salt/modules/pacmanpkg.py on lines 614..617
salt/modules/pacmanpkg.py on lines 739..742
salt/modules/pkgin.py on lines 429..432
salt/modules/pkgin.py on lines 577..580
salt/modules/pkgng.py on lines 893..896
salt/modules/pkgng.py on lines 1070..1073
salt/modules/solarispkg.py on lines 466..469
salt/modules/yumpkg.py on lines 2018..2021

Duplicated Code

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

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

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

Tuning

This issue has a mass of 46.

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

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

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

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

Refactorings

Further Reading

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

    if out['retcode'] != 0 and out['stderr']:
        errors = [out['stderr']]
    else:
        errors = []
Severity: Major
Found in salt/modules/yumpkg.py and 16 other locations - About 1 hr to fix
salt/modules/apkpkg.py on lines 334..337
salt/modules/apkpkg.py on lines 410..413
salt/modules/aptpkg.py on lines 810..813
salt/modules/ebuildpkg.py on lines 1034..1037
salt/modules/freebsdpkg.py on lines 409..412
salt/modules/freebsdpkg.py on lines 472..475
salt/modules/mac_brew_pkg.py on lines 261..264
salt/modules/mac_brew_pkg.py on lines 415..418
salt/modules/openbsdpkg.py on lines 299..302
salt/modules/pacmanpkg.py on lines 614..617
salt/modules/pacmanpkg.py on lines 739..742
salt/modules/pkgin.py on lines 429..432
salt/modules/pkgin.py on lines 577..580
salt/modules/pkgng.py on lines 893..896
salt/modules/pkgng.py on lines 1070..1073
salt/modules/solarispkg.py on lines 466..469

Duplicated Code

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

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

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

Tuning

This issue has a mass of 46.

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

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

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

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

Refactorings

Further Reading

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

    if out['retcode'] != 0 and out['stderr']:
        errors = [out['stderr']]
    else:
        errors = []
Severity: Major
Found in salt/modules/pacmanpkg.py and 16 other locations - About 1 hr to fix
salt/modules/apkpkg.py on lines 334..337
salt/modules/apkpkg.py on lines 410..413
salt/modules/aptpkg.py on lines 810..813
salt/modules/ebuildpkg.py on lines 1034..1037
salt/modules/freebsdpkg.py on lines 409..412
salt/modules/freebsdpkg.py on lines 472..475
salt/modules/mac_brew_pkg.py on lines 261..264
salt/modules/mac_brew_pkg.py on lines 415..418
salt/modules/openbsdpkg.py on lines 299..302
salt/modules/pacmanpkg.py on lines 614..617
salt/modules/pkgin.py on lines 429..432
salt/modules/pkgin.py on lines 577..580
salt/modules/pkgng.py on lines 893..896
salt/modules/pkgng.py on lines 1070..1073
salt/modules/solarispkg.py on lines 466..469
salt/modules/yumpkg.py on lines 2018..2021

Duplicated Code

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

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

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

Tuning

This issue has a mass of 46.

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

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

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

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

Refactorings

Further Reading

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

    if username and password:
        headers['Authorization'] = 'Basic {0}'.format(base64.encodestring('{0}:{1}'.format(username, password)).replace('\n', ''))
Severity: Major
Found in salt/modules/nexus.py and 8 other locations - About 1 hr to fix
salt/modules/artifactory.py on lines 71..72
salt/modules/artifactory.py on lines 111..112
salt/modules/artifactory.py on lines 147..148
salt/modules/artifactory.py on lines 186..187
salt/modules/nexus.py on lines 113..114
salt/modules/nexus.py on lines 147..148
salt/modules/nexus.py on lines 180..181
salt/modules/nexus.py on lines 220..221

Duplicated Code

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

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

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

Tuning

This issue has a mass of 46.

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

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

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

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

Refactorings

Further Reading

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

    if out['retcode'] != 0 and out['stderr']:
        errors = [out['stderr']]
    else:
        errors = []
Severity: Major
Found in salt/modules/freebsdpkg.py and 16 other locations - About 1 hr to fix
salt/modules/apkpkg.py on lines 334..337
salt/modules/apkpkg.py on lines 410..413
salt/modules/aptpkg.py on lines 810..813
salt/modules/ebuildpkg.py on lines 1034..1037
salt/modules/freebsdpkg.py on lines 472..475
salt/modules/mac_brew_pkg.py on lines 261..264
salt/modules/mac_brew_pkg.py on lines 415..418
salt/modules/openbsdpkg.py on lines 299..302
salt/modules/pacmanpkg.py on lines 614..617
salt/modules/pacmanpkg.py on lines 739..742
salt/modules/pkgin.py on lines 429..432
salt/modules/pkgin.py on lines 577..580
salt/modules/pkgng.py on lines 893..896
salt/modules/pkgng.py on lines 1070..1073
salt/modules/solarispkg.py on lines 466..469
salt/modules/yumpkg.py on lines 2018..2021

Duplicated Code

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

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

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

Tuning

This issue has a mass of 46.

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

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

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

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

Refactorings

Further Reading

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

    if username and password:
        headers['Authorization'] = 'Basic {0}'.format(base64.encodestring('{0}:{1}'.format(username, password)).replace('\n', ''))
Severity: Major
Found in salt/modules/nexus.py and 8 other locations - About 1 hr to fix
salt/modules/artifactory.py on lines 71..72
salt/modules/artifactory.py on lines 111..112
salt/modules/artifactory.py on lines 147..148
salt/modules/artifactory.py on lines 186..187
salt/modules/nexus.py on lines 73..74
salt/modules/nexus.py on lines 147..148
salt/modules/nexus.py on lines 180..181
salt/modules/nexus.py on lines 220..221

Duplicated Code

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

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

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

Tuning

This issue has a mass of 46.

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

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

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

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

Refactorings

Further Reading

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

    if out['retcode'] != 0 and out['stderr']:
        errors = [out['stderr']]
    else:
        errors = []
Severity: Major
Found in salt/modules/pkgin.py and 16 other locations - About 1 hr to fix
salt/modules/apkpkg.py on lines 334..337
salt/modules/apkpkg.py on lines 410..413
salt/modules/aptpkg.py on lines 810..813
salt/modules/ebuildpkg.py on lines 1034..1037
salt/modules/freebsdpkg.py on lines 409..412
salt/modules/freebsdpkg.py on lines 472..475
salt/modules/mac_brew_pkg.py on lines 261..264
salt/modules/mac_brew_pkg.py on lines 415..418
salt/modules/openbsdpkg.py on lines 299..302
salt/modules/pacmanpkg.py on lines 614..617
salt/modules/pacmanpkg.py on lines 739..742
salt/modules/pkgin.py on lines 429..432
salt/modules/pkgng.py on lines 893..896
salt/modules/pkgng.py on lines 1070..1073
salt/modules/solarispkg.py on lines 466..469
salt/modules/yumpkg.py on lines 2018..2021

Duplicated Code

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

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

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

Tuning

This issue has a mass of 46.

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

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

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

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

Refactorings

Further Reading

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

    if out['retcode'] != 0 and out['stderr']:
        errors = [out['stderr']]
    else:
        errors = []
Severity: Major
Found in salt/modules/freebsdpkg.py and 16 other locations - About 1 hr to fix
salt/modules/apkpkg.py on lines 334..337
salt/modules/apkpkg.py on lines 410..413
salt/modules/aptpkg.py on lines 810..813
salt/modules/ebuildpkg.py on lines 1034..1037
salt/modules/freebsdpkg.py on lines 409..412
salt/modules/mac_brew_pkg.py on lines 261..264
salt/modules/mac_brew_pkg.py on lines 415..418
salt/modules/openbsdpkg.py on lines 299..302
salt/modules/pacmanpkg.py on lines 614..617
salt/modules/pacmanpkg.py on lines 739..742
salt/modules/pkgin.py on lines 429..432
salt/modules/pkgin.py on lines 577..580
salt/modules/pkgng.py on lines 893..896
salt/modules/pkgng.py on lines 1070..1073
salt/modules/solarispkg.py on lines 466..469
salt/modules/yumpkg.py on lines 2018..2021

Duplicated Code

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

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

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

Tuning

This issue has a mass of 46.

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

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

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

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

Refactorings

Further Reading

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

    if username and password:
        headers['Authorization'] = 'Basic {0}'.format(base64.encodestring('{0}:{1}'.format(username, password)).replace('\n', ''))
Severity: Major
Found in salt/modules/artifactory.py and 8 other locations - About 1 hr to fix
salt/modules/artifactory.py on lines 71..72
salt/modules/artifactory.py on lines 111..112
salt/modules/artifactory.py on lines 147..148
salt/modules/nexus.py on lines 73..74
salt/modules/nexus.py on lines 113..114
salt/modules/nexus.py on lines 147..148
salt/modules/nexus.py on lines 180..181
salt/modules/nexus.py on lines 220..221

Duplicated Code

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

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

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

Tuning

This issue has a mass of 46.

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

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

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

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

Refactorings

Further Reading

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

    if username and password:
        headers['Authorization'] = 'Basic {0}'.format(base64.encodestring('{0}:{1}'.format(username, password)).replace('\n', ''))
Severity: Major
Found in salt/modules/nexus.py and 8 other locations - About 1 hr to fix
salt/modules/artifactory.py on lines 71..72
salt/modules/artifactory.py on lines 111..112
salt/modules/artifactory.py on lines 147..148
salt/modules/artifactory.py on lines 186..187
salt/modules/nexus.py on lines 73..74
salt/modules/nexus.py on lines 113..114
salt/modules/nexus.py on lines 180..181
salt/modules/nexus.py on lines 220..221

Duplicated Code

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

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

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

Tuning

This issue has a mass of 46.

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

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

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

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

Refactorings

Further Reading

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

    if out['retcode'] != 0 and out['stderr']:
        errors = [out['stderr']]
    else:
        errors = []
Severity: Major
Found in salt/modules/apkpkg.py and 16 other locations - About 1 hr to fix
salt/modules/apkpkg.py on lines 334..337
salt/modules/aptpkg.py on lines 810..813
salt/modules/ebuildpkg.py on lines 1034..1037
salt/modules/freebsdpkg.py on lines 409..412
salt/modules/freebsdpkg.py on lines 472..475
salt/modules/mac_brew_pkg.py on lines 261..264
salt/modules/mac_brew_pkg.py on lines 415..418
salt/modules/openbsdpkg.py on lines 299..302
salt/modules/pacmanpkg.py on lines 614..617
salt/modules/pacmanpkg.py on lines 739..742
salt/modules/pkgin.py on lines 429..432
salt/modules/pkgin.py on lines 577..580
salt/modules/pkgng.py on lines 893..896
salt/modules/pkgng.py on lines 1070..1073
salt/modules/solarispkg.py on lines 466..469
salt/modules/yumpkg.py on lines 2018..2021

Duplicated Code

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

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

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

Tuning

This issue has a mass of 46.

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

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

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

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

Refactorings

Further Reading

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

    if out['retcode'] != 0 and out['stderr']:
        errors = [out['stderr']]
    else:
        errors = []
Severity: Major
Found in salt/modules/pkgin.py and 16 other locations - About 1 hr to fix
salt/modules/apkpkg.py on lines 334..337
salt/modules/apkpkg.py on lines 410..413
salt/modules/aptpkg.py on lines 810..813
salt/modules/ebuildpkg.py on lines 1034..1037
salt/modules/freebsdpkg.py on lines 409..412
salt/modules/freebsdpkg.py on lines 472..475
salt/modules/mac_brew_pkg.py on lines 261..264
salt/modules/mac_brew_pkg.py on lines 415..418
salt/modules/openbsdpkg.py on lines 299..302
salt/modules/pacmanpkg.py on lines 614..617
salt/modules/pacmanpkg.py on lines 739..742
salt/modules/pkgin.py on lines 577..580
salt/modules/pkgng.py on lines 893..896
salt/modules/pkgng.py on lines 1070..1073
salt/modules/solarispkg.py on lines 466..469
salt/modules/yumpkg.py on lines 2018..2021

Duplicated Code

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

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

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

Tuning

This issue has a mass of 46.

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

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

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

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

Refactorings

Further Reading

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

    if username and password:
        headers['Authorization'] = 'Basic {0}'.format(base64.encodestring('{0}:{1}'.format(username, password)).replace('\n', ''))
Severity: Major
Found in salt/modules/nexus.py and 8 other locations - About 1 hr to fix
salt/modules/artifactory.py on lines 71..72
salt/modules/artifactory.py on lines 111..112
salt/modules/artifactory.py on lines 147..148
salt/modules/artifactory.py on lines 186..187
salt/modules/nexus.py on lines 73..74
salt/modules/nexus.py on lines 113..114
salt/modules/nexus.py on lines 147..148
salt/modules/nexus.py on lines 220..221

Duplicated Code

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

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

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

Tuning

This issue has a mass of 46.

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

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

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

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

Refactorings

Further Reading

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

        if out['retcode'] != 0 and out['stderr']:
            errors = [out['stderr']]
        else:
            errors = []
Severity: Major
Found in salt/modules/pacmanpkg.py and 16 other locations - About 1 hr to fix
salt/modules/apkpkg.py on lines 334..337
salt/modules/apkpkg.py on lines 410..413
salt/modules/aptpkg.py on lines 810..813
salt/modules/ebuildpkg.py on lines 1034..1037
salt/modules/freebsdpkg.py on lines 409..412
salt/modules/freebsdpkg.py on lines 472..475
salt/modules/mac_brew_pkg.py on lines 261..264
salt/modules/mac_brew_pkg.py on lines 415..418
salt/modules/openbsdpkg.py on lines 299..302
salt/modules/pacmanpkg.py on lines 739..742
salt/modules/pkgin.py on lines 429..432
salt/modules/pkgin.py on lines 577..580
salt/modules/pkgng.py on lines 893..896
salt/modules/pkgng.py on lines 1070..1073
salt/modules/solarispkg.py on lines 466..469
salt/modules/yumpkg.py on lines 2018..2021

Duplicated Code

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

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

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

Tuning

This issue has a mass of 46.

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

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

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

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

Refactorings

Further Reading

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

    if out['retcode'] != 0 and out['stderr']:
        errors = [out['stderr']]
    else:
        errors = []
Severity: Major
Found in salt/modules/pkgng.py and 16 other locations - About 1 hr to fix
salt/modules/apkpkg.py on lines 334..337
salt/modules/apkpkg.py on lines 410..413
salt/modules/aptpkg.py on lines 810..813
salt/modules/ebuildpkg.py on lines 1034..1037
salt/modules/freebsdpkg.py on lines 409..412
salt/modules/freebsdpkg.py on lines 472..475
salt/modules/mac_brew_pkg.py on lines 261..264
salt/modules/mac_brew_pkg.py on lines 415..418
salt/modules/openbsdpkg.py on lines 299..302
salt/modules/pacmanpkg.py on lines 614..617
salt/modules/pacmanpkg.py on lines 739..742
salt/modules/pkgin.py on lines 429..432
salt/modules/pkgin.py on lines 577..580
salt/modules/pkgng.py on lines 893..896
salt/modules/solarispkg.py on lines 466..469
salt/modules/yumpkg.py on lines 2018..2021

Duplicated Code

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

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

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

Tuning

This issue has a mass of 46.

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

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

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

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

Refactorings

Further Reading

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

    if out['retcode'] != 0 and out['stderr']:
        errors = [out['stderr']]
    else:
        errors = []
Severity: Major
Found in salt/modules/mac_brew_pkg.py and 16 other locations - About 1 hr to fix
salt/modules/apkpkg.py on lines 334..337
salt/modules/apkpkg.py on lines 410..413
salt/modules/aptpkg.py on lines 810..813
salt/modules/ebuildpkg.py on lines 1034..1037
salt/modules/freebsdpkg.py on lines 409..412
salt/modules/freebsdpkg.py on lines 472..475
salt/modules/mac_brew_pkg.py on lines 261..264
salt/modules/openbsdpkg.py on lines 299..302
salt/modules/pacmanpkg.py on lines 614..617
salt/modules/pacmanpkg.py on lines 739..742
salt/modules/pkgin.py on lines 429..432
salt/modules/pkgin.py on lines 577..580
salt/modules/pkgng.py on lines 893..896
salt/modules/pkgng.py on lines 1070..1073
salt/modules/solarispkg.py on lines 466..469
salt/modules/yumpkg.py on lines 2018..2021

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

Severity
Category
Status
Source
Language