datahuborg/datahub

View on GitHub
src/api/test/test_repo_serializer.py

Summary

Maintainability
D
1 day
Test Coverage

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

    def setUp(self):
        self.username = "delete_me_username"
        self.repo_base = "delete_me_repo_base"
        self.password = "delete_me_password"

Severity: Major
Found in src/api/test/test_repo_serializer.py and 2 other locations - About 4 hrs to fix
src/api/test/test_collaborator_serializer.py on lines 11..22
src/api/test/test_table_serializer.py on lines 11..22

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

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_rename_repo(self):
        mock_manager_rename_repo = self.mock_manager.return_value.rename_repo
        mock_manager_rename_repo.return_value = True

        success = self.serializer.rename_repo('old_repo_name', 'new_repo_name')
Severity: Major
Found in src/api/test/test_repo_serializer.py and 1 other location - About 2 hrs to fix
src/api/test/test_collaborator_serializer.py on lines 54..60

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

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_delete_repo(self):
        mock_manager_delete_repo = self.mock_manager.return_value.delete_repo
        mock_manager_delete_repo.return_value = True

        success = self.serializer.delete_repo('repo_to_be_deleted')
Severity: Major
Found in src/api/test/test_repo_serializer.py and 1 other location - About 2 hrs to fix
src/api/test/test_repo_serializer.py on lines 31..37

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

    def test_create_repo(self):
        mock_manager_create_repo = self.mock_manager.return_value.create_repo
        mock_manager_create_repo.return_value = True

        success = self.serializer.create_repo('new_repo_name')
Severity: Major
Found in src/api/test/test_repo_serializer.py and 1 other location - About 2 hrs to fix
src/api/test/test_repo_serializer.py on lines 39..45

Duplicated Code

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

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

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

Tuning

This issue has a mass of 58.

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

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

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

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

Refactorings

Further Reading

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

    def create_patch(self, name):
        # helper method for creating patches
        patcher = patch(name)
        thing = patcher.start()
        self.addCleanup(patcher.stop)
Severity: Major
Found in src/api/test/test_repo_serializer.py and 17 other locations - About 1 hr to fix
src/api/test/test_collaborator_serializer.py on lines 24..29
src/api/test/test_datahub_serializer.py on lines 21..26
src/api/test/test_file_serializer.py on lines 21..26
src/api/test/test_query_serializer.py on lines 21..26
src/api/test/test_table_serializer.py on lines 24..29
src/api/test/test_view_serializer.py on lines 25..30
src/browser/test/test_repo_views.py on lines 50..55
src/browser/test/test_repo_views.py on lines 126..131
src/browser/test/test_repo_views.py on lines 216..221
src/browser/test/test_repo_views.py on lines 258..263
src/browser/test/test_repo_views.py on lines 301..306
src/core/test/test_manager.py on lines 26..31
src/core/test/test_manager.py on lines 65..70
src/core/test/test_manager.py on lines 229..234
src/core/test/test_query_rewriter.py on lines 23..28
src/core/test/test_rls_permissions.py on lines 19..24
src/core/test/test_rlsmanager.py on lines 24..29

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