datahuborg/datahub

View on GitHub

Showing 1,132 of 1,132 total issues

File query_rewriter.py has 287 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import sqlparse

from inventory.models import Collaborator
from core.db.rlsmanager import RowLevelSecurityManager
from config import settings
Severity: Minor
Found in src/core/db/query_rewriter.py - About 2 hrs to fix

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

            for repo in collab_repos:
                relative_uri = reverse('api:repo', args=(
                    repo.repo_base, repo.repo_name))
                absolute_uri = self.base_uri + relative_uri
    
    
    Severity: Major
    Found in src/api/serializer.py and 2 other locations - About 2 hrs to fix
    src/api/serializer.py on lines 132..140
    src/api/serializer.py on lines 149..157

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

    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

            for repo in public_repos:
                relative_uri = reverse('api:repo', args=(
                    repo.repo_base, repo.repo_name))
                absolute_uri = self.base_uri + relative_uri
    
    
    Severity: Major
    Found in src/api/serializer.py and 2 other locations - About 2 hrs to fix
    src/api/serializer.py on lines 132..140
    src/api/serializer.py on lines 166..174

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

    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

        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_query_serializer.py and 2 other locations - About 2 hrs to fix
    src/api/test/test_datahub_serializer.py on lines 11..19
    src/api/test/test_file_serializer.py on lines 11..19

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

    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

            for repo in collab_repos:
                relative_uri = reverse('api:repo', args=(
                    self.repo_base, repo.repo_name))
                absolute_uri = self.base_uri + relative_uri
    
    
    Severity: Major
    Found in src/api/serializer.py and 2 other locations - About 2 hrs to fix
    src/api/serializer.py on lines 149..157
    src/api/serializer.py on lines 166..174

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

    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

        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_datahub_serializer.py and 2 other locations - About 2 hrs to fix
    src/api/test/test_file_serializer.py on lines 11..19
    src/api/test/test_query_serializer.py on lines 11..19

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

    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

        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_file_serializer.py and 2 other locations - About 2 hrs to fix
    src/api/test/test_datahub_serializer.py on lines 11..19
    src/api/test/test_query_serializer.py on lines 11..19

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

    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 md5cycle has 69 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function md5cycle(x, k) {
    var a = x[0], b = x[1], c = x[2], d = x[3];
    
    a = ff(a, b, c, d, k[0], 7, -680876936);
    d = ff(d, a, b, c, k[1], 12, -389564586);
    Severity: Major
    Found in src/browser/static/dbwipes/js/lib/md5.js - About 2 hrs to fix

      Function md5cycle has 69 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function md5cycle(x, k) {
      var a = x[0], b = x[1], c = x[2], d = x[3];
      
      a = ff(a, b, c, d, k[0], 7, -680876936);
      d = ff(d, a, b, c, k[1], 12, -389564586);
      Severity: Major
      Found in src/apps/dbwipes/static/js/lib/md5.js - About 2 hrs to fix

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

            def test_table_view_returns_correct_function(self):
                found = resolve(
                    '/browse/' + self.username + "/" + self.repo_name + "/tables")
                self.assertEqual(found.func, browser.views.repo_tables)
        Severity: Major
        Found in src/browser/test/test_repo_views.py and 2 other locations - About 2 hrs to fix
        src/browser/test/test_repo_views.py on lines 160..164
        src/browser/test/test_repo_views.py on lines 223..227

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

            def test_files_view_returns_correct_function(self):
                found = resolve(
                    '/browse/' + self.username + "/" + self.repo_name + "/files")
        
                self.assertEqual(found.func, browser.views.repo_files)
        Severity: Major
        Found in src/browser/test/test_repo_views.py and 2 other locations - About 2 hrs to fix
        src/browser/test/test_repo_views.py on lines 140..143
        src/browser/test/test_repo_views.py on lines 160..164

        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_remove_collaborator(self):
                mock_remove_collab = self.mock_manager.return_value.delete_collaborator
                mock_remove_collab.return_value = True
        
                res = self.serializer.remove_collaborator('repo_name', 'collab')
        Severity: Major
        Found in src/api/test/test_collaborator_serializer.py and 1 other location - About 2 hrs to fix
        src/api/test/test_repo_serializer.py on lines 47..53

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

            def test_cards_view_returns_correct_function(self):
                found = resolve(
                    '/browse/' + self.username + "/" + self.repo_name + "/cards")
        
                self.assertEqual(found.func, browser.views.repo_cards)
        Severity: Major
        Found in src/browser/test/test_repo_views.py and 2 other locations - About 2 hrs to fix
        src/browser/test/test_repo_views.py on lines 140..143
        src/browser/test/test_repo_views.py on lines 223..227

        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

                try:
                    # Decode the JWT and raise an error if the sig is invalid.
                    # Make sure to specify the expected algorithm to prevent attacks
                    # that use an RSA public key as an HMAC secret key.
                    user_info = JWS().verify_compact(
        Severity: Major
        Found in src/account/backends/oidc.py and 1 other location - About 2 hrs to fix
        src/account/backends/oidc.py on lines 271..281

        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_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

                try:
                    # Decode the JWT and raise an error if the sig is invalid.
                    # Make sure to specify the expected algorithm to prevent attacks
                    # that used an RSA public key as an HMAC secret key.
                    id_token = JWS().verify_compact(
        Severity: Major
        Found in src/account/backends/oidc.py and 1 other location - About 2 hrs to fix
        src/account/backends/oidc.py on lines 240..250

        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 _validate_table_name(self, noun):
                """
                Raises ValueError if the proposed table name is invalid.
        
                Valid table names contain only alphanumeric characters and underscores.
        Severity: Major
        Found in src/core/db/backend/pg.py and 1 other location - About 2 hrs to fix
        src/core/db/backend/pg.py on lines 128..146

        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 _check_for_injections(self, noun):
                """
                Raises ValueError if the proposed noun is invalid.
        
                Valid nouns contain only alphanumeric characters and underscores, and
        Severity: Major
        Found in src/core/db/backend/pg.py and 1 other location - About 2 hrs to fix
        src/core/db/backend/pg.py on lines 148..165

        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

        Function test_authorization_code_flow has 68 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def test_authorization_code_flow(self):
                user_info = {
                    'username': 'delete_me_test',
                    'email': 'delete_me_test@mit.edu',
                    'password': 'delete_me_test',
        Severity: Major
        Found in src/functional_tests/test_api.py - About 2 hrs to fix

          Function onMove has 67 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              onMove: function() {
                if (!this.model.get("isDrawing")) 
                  return;
          
                var xy = d3.mouse(this.d3g[0][0]),
          Severity: Major
          Found in src/apps/dbwipes/static/js/summary/drawingview.js - About 2 hrs to fix
            Severity
            Category
            Status
            Source
            Language