borgbackup/borg

View on GitHub
src/borg/testsuite/archiver/prune_cmd.py

Summary

Maintainability
F
5 days
Test Coverage

Function test_prune_repository_example has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

def test_prune_repository_example(archivers, request):
    archiver = request.getfixturevalue(archivers)
    cmd(archiver, "rcreate", RK_ENCRYPTION)
    # Archives that will be kept, per the example
    # Oldest archive
Severity: Minor
Found in src/borg/testsuite/archiver/prune_cmd.py - About 1 hr to fix

    Function test_prune_repository has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    def test_prune_repository(archivers, request):
        archiver = request.getfixturevalue(archivers)
        cmd(archiver, "rcreate", RK_ENCRYPTION)
        cmd(archiver, "create", "test1", src_dir)
        cmd(archiver, "create", "test2", src_dir)
    Severity: Minor
    Found in src/borg/testsuite/archiver/prune_cmd.py - About 1 hr to fix

      Function _create_archive_ts has 8 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def _create_archive_ts(archiver, name, y, m, d, H=0, M=0, S=0):
      Severity: Major
      Found in src/borg/testsuite/archiver/prune_cmd.py - About 1 hr to fix

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

        def test_prune_repository_prefix(archivers, request):
            archiver = request.getfixturevalue(archivers)
            cmd(archiver, "rcreate", RK_ENCRYPTION)
            cmd(archiver, "create", "foo-2015-08-12-10:00", src_dir)
            cmd(archiver, "create", "foo-2015-08-12-20:00", src_dir)
        Severity: Major
        Found in src/borg/testsuite/archiver/prune_cmd.py and 1 other location - About 1 day to fix
        src/borg/testsuite/archiver/prune_cmd.py on lines 173..193

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

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

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

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

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

        Refactorings

        Further Reading

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

        def test_prune_repository_glob(archivers, request):
            archiver = request.getfixturevalue(archivers)
            cmd(archiver, "rcreate", RK_ENCRYPTION)
            cmd(archiver, "create", "2015-08-12-10:00-foo", src_dir)
            cmd(archiver, "create", "2015-08-12-20:00-foo", src_dir)
        Severity: Major
        Found in src/borg/testsuite/archiver/prune_cmd.py and 1 other location - About 1 day to fix
        src/borg/testsuite/archiver/prune_cmd.py on lines 150..170

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

        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

            for i in range(1, 15):
                assert re.search(r"Keeping archive \(rule: daily #" + str(i) + r"\):\s+test" + ("%02d" % (22 - i)), output)
        Severity: Major
        Found in src/borg/testsuite/archiver/prune_cmd.py and 1 other location - About 2 hrs to fix
        src/borg/testsuite/archiver/prune_cmd.py on lines 106..107

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

        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

            for i in range(1, 7):
                assert re.search(r"Keeping archive \(rule: monthly #" + str(i) + r"\):\s+test" + ("%02d" % (8 - i)), output)
        Severity: Major
        Found in src/borg/testsuite/archiver/prune_cmd.py and 1 other location - About 2 hrs to fix
        src/borg/testsuite/archiver/prune_cmd.py on lines 108..109

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

        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

            for i in range(1, 31):
                _create_archive_ts(archiver, "september%02d" % i, 2020, 9, i, 12)
                cmd(archiver, "prune", "--keep-daily=7", "--keep-monthly=1")
        Severity: Major
        Found in src/borg/testsuite/archiver/prune_cmd.py and 1 other location - About 1 hr to fix
        src/borg/testsuite/archiver/prune_cmd.py on lines 135..137

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

            for i in range(1, 7):
                _create_archive_ts(archiver, "october%02d" % i, 2020, 10, i, 12)
                cmd(archiver, "prune", "--keep-daily=7", "--keep-monthly=1")
        Severity: Major
        Found in src/borg/testsuite/archiver/prune_cmd.py and 1 other location - About 1 hr to fix
        src/borg/testsuite/archiver/prune_cmd.py on lines 131..133

        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

        There are no issues that match your filters.

        Category
        Status