CollageLabs/pypicontents

View on GitHub

Showing 49 of 49 total issues

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

    with open(outputfile, 'w') as sw:
        sw.write(json.dumps(mergedict, separators=(',', ': '),
Severity: Major
Found in pypicontents/api/merge.py and 2 other locations - About 1 hr to fix
pypicontents/api/errors.py on lines 60..61
pypicontents/api/stdlib.py on lines 157..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 39.

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

    with open(outputfile, 'w') as j:
        j.write(json.dumps(jsondict, separators=(',', ': '),
Severity: Major
Found in pypicontents/api/stdlib.py and 2 other locations - About 1 hr to fix
pypicontents/api/errors.py on lines 60..61
pypicontents/api/merge.py on lines 38..39

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

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

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

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

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

Refactorings

Further Reading

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

        nodown += int((re.findall(re_nodown, content)[0:] + [0])[0])
Severity: Major
Found in pypicontents/api/stats.py and 7 other locations - About 1 hr to fix
pypicontents/api/stats.py on lines 58..58
pypicontents/api/stats.py on lines 59..59
pypicontents/api/stats.py on lines 60..60
pypicontents/api/stats.py on lines 61..61
pypicontents/api/stats.py on lines 62..62
pypicontents/api/stats.py on lines 64..64
pypicontents/api/stats.py on lines 65..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 38.

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

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

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

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

Refactorings

Further Reading

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

        processed += int((re.findall(re_processed, content)[0:] + [0])[0])
Severity: Major
Found in pypicontents/api/stats.py and 7 other locations - About 1 hr to fix
pypicontents/api/stats.py on lines 58..58
pypicontents/api/stats.py on lines 60..60
pypicontents/api/stats.py on lines 61..61
pypicontents/api/stats.py on lines 62..62
pypicontents/api/stats.py on lines 63..63
pypicontents/api/stats.py on lines 64..64
pypicontents/api/stats.py on lines 65..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 38.

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

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

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

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

Refactorings

Further Reading

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

        nodata += int((re.findall(re_nodata, content)[0:] + [0])[0])
Severity: Major
Found in pypicontents/api/stats.py and 7 other locations - About 1 hr to fix
pypicontents/api/stats.py on lines 58..58
pypicontents/api/stats.py on lines 59..59
pypicontents/api/stats.py on lines 60..60
pypicontents/api/stats.py on lines 61..61
pypicontents/api/stats.py on lines 63..63
pypicontents/api/stats.py on lines 64..64
pypicontents/api/stats.py on lines 65..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 38.

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

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

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

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

Refactorings

Further Reading

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

        uptodate += int((re.findall(re_uptodate, content)[0:] + [0])[0])
Severity: Major
Found in pypicontents/api/stats.py and 7 other locations - About 1 hr to fix
pypicontents/api/stats.py on lines 58..58
pypicontents/api/stats.py on lines 59..59
pypicontents/api/stats.py on lines 60..60
pypicontents/api/stats.py on lines 62..62
pypicontents/api/stats.py on lines 63..63
pypicontents/api/stats.py on lines 64..64
pypicontents/api/stats.py on lines 65..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 38.

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

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

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

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

Refactorings

Further Reading

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

        noapi += int((re.findall(re_noapi, content)[0:] + [0])[0])
Severity: Major
Found in pypicontents/api/stats.py and 7 other locations - About 1 hr to fix
pypicontents/api/stats.py on lines 58..58
pypicontents/api/stats.py on lines 59..59
pypicontents/api/stats.py on lines 60..60
pypicontents/api/stats.py on lines 61..61
pypicontents/api/stats.py on lines 62..62
pypicontents/api/stats.py on lines 63..63
pypicontents/api/stats.py on lines 65..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 38.

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

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

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

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

Refactorings

Further Reading

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

        total += int((re.findall(re_total, content)[0:] + [0])[0])
Severity: Major
Found in pypicontents/api/stats.py and 7 other locations - About 1 hr to fix
pypicontents/api/stats.py on lines 59..59
pypicontents/api/stats.py on lines 60..60
pypicontents/api/stats.py on lines 61..61
pypicontents/api/stats.py on lines 62..62
pypicontents/api/stats.py on lines 63..63
pypicontents/api/stats.py on lines 64..64
pypicontents/api/stats.py on lines 65..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 38.

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

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

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

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

Refactorings

Further Reading

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

        noproc += int((re.findall(re_noproc, content)[0:] + [0])[0])
Severity: Major
Found in pypicontents/api/stats.py and 7 other locations - About 1 hr to fix
pypicontents/api/stats.py on lines 58..58
pypicontents/api/stats.py on lines 59..59
pypicontents/api/stats.py on lines 60..60
pypicontents/api/stats.py on lines 61..61
pypicontents/api/stats.py on lines 62..62
pypicontents/api/stats.py on lines 63..63
pypicontents/api/stats.py on lines 64..64

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

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

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

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

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

Refactorings

Further Reading

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

        updated += int((re.findall(re_updated, content)[0:] + [0])[0])
Severity: Major
Found in pypicontents/api/stats.py and 7 other locations - About 1 hr to fix
pypicontents/api/stats.py on lines 58..58
pypicontents/api/stats.py on lines 59..59
pypicontents/api/stats.py on lines 61..61
pypicontents/api/stats.py on lines 62..62
pypicontents/api/stats.py on lines 63..63
pypicontents/api/stats.py on lines 64..64
pypicontents/api/stats.py on lines 65..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 38.

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 8 (exceeds 5 allowed). Consider refactoring.
Open

def main(argv=None):
    """
    Handle arguments and commands.

    :param argv: a list of commandline arguments like ``sys.argv``.
Severity: Minor
Found in pypicontents/cli.py - About 45 mins to fix

Cognitive Complexity

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

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

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

Further reading

Function get_pkgpath has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

def get_pkgpath(pkgname, pkgversion, pkgurl, cachedir, extractdir):
    tarname = get_tarname(pkgname, pkgversion, pkgurl)
    tarpath = os.path.join(cachedir, tarname)
    tarext = get_tar_extension(tarpath)

Severity: Minor
Found in pypicontents/api/pypi.py - About 45 mins to fix

Cognitive Complexity

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

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

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

Further reading

Function get_setupargs has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

def get_setupargs(pkgname, pkgversion, pkgurls, cachedir, extractdir):
Severity: Minor
Found in pypicontents/api/pypi.py - About 35 mins to fix

    Function false_import has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def false_import(name, globals={}, locals={}, fromlist=[],
    Severity: Minor
    Found in pypicontents/core/patches.py - About 35 mins to fix

      Function get_pkgpath has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def get_pkgpath(pkgname, pkgversion, pkgurl, cachedir, extractdir):
      Severity: Minor
      Found in pypicontents/api/pypi.py - About 35 mins to fix

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

            elif (parsedurl.netloc in ['github.com', 'www.github.com'] and
                  os.path.basename(parsedurl.path) == 'master'):
        Severity: Minor
        Found in pypicontents/api/pypi.py and 1 other location - About 35 mins to fix
        pypicontents/api/pypi.py on lines 197..198

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

        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 prefill_jsondict has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        def prefill_jsondict(pkglist, jsondict, outjsondict):
            for pkgname in pkglist:
                if pkgname not in jsondict:
                    if pkgname in outjsondict:
                        jsondict[pkgname] = outjsondict[pkgname]
        Severity: Minor
        Found in pypicontents/api/pypi.py - About 35 mins to fix

        Cognitive Complexity

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

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

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

        Further reading

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

        def get_modules(pkgdata):
            """
            List modules inside packages provided in ``pkgdata``.
        
            :param pkgdata: a list of tuples containing the name of a package and
        Severity: Minor
        Found in pypicontents/core/utils.py - About 35 mins to fix

        Cognitive Complexity

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

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

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

        Further reading

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

            if parsedurl.netloc in ['gitlab.com', 'www.gitlab.com'] and \
               os.path.basename(parsedurl.path) == 'archive.tar.gz':
        Severity: Minor
        Found in pypicontents/api/pypi.py and 1 other location - About 35 mins to fix
        pypicontents/api/pypi.py on lines 200..201

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

        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

                sources = list(filter(lambda x: x['packagetype'] == 'sdist', pkgrel))
        Severity: Minor
        Found in pypicontents/api/pypi.py and 2 other locations - About 30 mins to fix
        pypicontents/api/pypi.py on lines 237..237
        pypicontents/api/pypi.py on lines 238..238

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

        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