datahuborg/datahub

View on GitHub

Showing 1,132 of 1,132 total issues

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

    def test_delete_repo_resolves_to_correct_view_function(self):
        found = resolve('/delete/' + self.username + '/repo/')
        self.assertEqual(found.func, browser.views.repo_delete)
Severity: Major
Found in src/browser/test/test_repo_views.py and 1 other location - About 1 hr to fix
src/browser/test/test_repo_views.py on lines 59..62

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

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_resolves_to_correct_view_function(self):
        found = resolve('/create/' + self.username + '/repo/')

        self.assertEqual(found.func, browser.views.repo_create)
Severity: Major
Found in src/browser/test/test_repo_views.py and 1 other location - About 1 hr to fix
src/browser/test/test_repo_views.py on lines 86..88

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

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

  function getXDomain(points, type, getx) {
    var xdomain = null;

    if (isStr(type)) {
      xdomain = {};
Severity: Minor
Found in src/apps/dbwipes/static/js/summary/util.js - About 1 hr to fix

    Function getXDomain has 39 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      function getXDomain(points, type, getx) {
        var xdomain = null;
    
        if (isStr(type)) {
          xdomain = {};
    Severity: Minor
    Found in src/browser/static/dbwipes/js/summary/util.js - About 1 hr to fix

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

          if request.method == 'POST':
              repo = request.POST['repo']
              with DataHubManager(user=username, repo_base=repo_base) as manager:
                  manager.create_repo(repo)
              return HttpResponseRedirect(reverse('browser-user', args=(username,)))
      Severity: Major
      Found in src/browser/views.py and 1 other location - About 1 hr to fix
      src/browser/views.py on lines 484..515

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

      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

          if request.method == 'POST':
              # creates a new license
              pii_anonymized = False
              pii_removed = False
      
      
      Severity: Major
      Found in src/browser/views.py and 1 other location - About 1 hr to fix
      src/browser/views.py on lines 319..328

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

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

            "initComplete": function(settings, json) {
              filterBar = FilterBar(jqueryObject.parent().parent().parent(), columnDefs, datatable);
              aggregator = Aggregator(jqueryObject.parent().parent().parent(), columnDefs, repo, table);
      
              datatable.forEachRowInColumn = function(colName, func) {
      Severity: Minor
      Found in src/browser/static/datatables/js/dataTables.extra.js - About 1 hr to fix

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

              "initComplete": function(settings, json) {
                filterBar = FilterBar(jqueryObject.parent().parent().parent(), columnDefs, datatable);
                aggregator = Aggregator(jqueryObject.parent().parent().parent(), columnDefs, repo, table);
        
                datatable.forEachRowInColumn = function(colName, func) {
        Severity: Minor
        Found in src/apps/datatables/client/js/dataTables.extra.js - About 1 hr to fix

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

              def test_apply_row_level_security_base(self):
                  mock_find_table_policies = self.create_patch(
                      'core.db.query_rewriter.SQLQueryRewriter.find_table_policies')
                  mock_find_table_policies.return_value = ["tester='Alice'"]
          
          
          Severity: Minor
          Found in src/core/test/test_query_rewriter.py - About 1 hr to fix

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

            },{}],7:[function(require,module,exports){
            // hbsfy compiled Handlebars template
            var HandlebarsCompiler = require('hbsfy/runtime');
            module.exports = HandlebarsCompiler.template({"1":function(depth0,helpers,partials,data) {
                var helper;
            Severity: Minor
            Found in src/browser/static/datatables/js/dataTables.extra.js - About 1 hr 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 __call__ has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

                def __call__(self, fn):
                    def wrapped(this):
                        now = time.time()
                        last_updated = None
                        cached_value = None
            Severity: Minor
            Found in src/account/backends/oidc.py - About 1 hr 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

                def extract_grantee(self, permission):
                    '''
                    Takes in a SQL permissions statement, extracts the grantee, and returns
                    it in the form of a string. Throws an exception if the permissions
                    statement does not contain a grantee.
            Severity: Major
            Found in src/core/db/rls_permissions.py and 1 other location - About 1 hr to fix
            src/core/db/rls_permissions.py on lines 125..135

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

            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 extract_policy(self, permission):
                    '''
                    Takes in a SQL permissions statement, extracts the policy information,
                    and returns it in the form of a string. Throws an exception if the
                    permissions statement does not define any security policies.
            Severity: Major
            Found in src/core/db/rls_permissions.py and 1 other location - About 1 hr to fix
            src/core/db/rls_permissions.py on lines 97..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 43.

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

                parse: function(resp) {
                  var data = resp.data;
                  var type = data.type,
                      stats = data.stats,
                      _this = this;
            Severity: Minor
            Found in src/apps/dbwipes/static/js/summary/cstat.js - About 1 hr to fix

              Function parse has 35 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  parse: function(resp) {
                    var data = resp.data;
                    var type = data.type,
                        stats = data.stats,
                        _this = this;
              Severity: Minor
              Found in src/browser/static/dbwipes/js/summary/cstat.js - About 1 hr to fix

                Function 3 has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                },{"./api.js":3,"./postgres-types.js":5,"./templates/aggregate-col-list-item.hbs":7,"./templates/grouped-aggregate-dropdown.hbs":11}],3:[function(require,module,exports){
                /**
                 * This file contains the code for interacting with the API
                 * for server side processing of datatables.
                 */
                Severity: Minor
                Found in src/browser/static/datatables/js/dataTables.extra.js - About 1 hr to fix

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

                  function hex(x) {
                  for (var i=0; i<x.length; i++)
                  x[i] = rhex(x[i]);
                  return x.join('');
                  }
                  Severity: Major
                  Found in src/apps/dbwipes/static/js/lib/md5.js and 1 other location - About 1 hr to fix
                  src/browser/static/dbwipes/js/lib/md5.js on lines 158..162

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

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

                  function hex(x) {
                  for (var i=0; i<x.length; i++)
                  x[i] = rhex(x[i]);
                  return x.join('');
                  }
                  Severity: Major
                  Found in src/browser/static/dbwipes/js/lib/md5.js and 1 other location - About 1 hr to fix
                  src/apps/dbwipes/static/js/lib/md5.js on lines 158..162

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

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

                      onSubmit: function() {
                        if (!this.model.isValid()) {
                          this.$("#errmsg").html(this.model.validationError);
                          return false;
                        }
                  Severity: Minor
                  Found in src/browser/static/dbwipes/js/summary/scorpionview.js - About 1 hr to fix

                    Function render has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        render: function() {
                          if (!this.model.isValid()) {
                            this.$svg.hide();
                            return this;
                          }
                    Severity: Minor
                    Found in src/apps/dbwipes/static/js/summary/queryview.js - About 1 hr to fix
                      Severity
                      Category
                      Status
                      Source
                      Language