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 make_repo_public(self, repo):
        self.browser.find_element_by_id('logo').click()

        # click the collaborators button next to the repo
        xpath = ('(//table/tbody/tr[td/a/text()="{repo}"]/td/a[text()['
Severity: Major
Found in src/functional_tests/base.py and 1 other location - About 3 hrs to fix
src/functional_tests/base.py on lines 314..323

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

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

@login_required
def card_delete(request, repo_base, repo, card_name):
    username = request.user.get_username()

    with DataHubManager(user=username, repo_base=repo_base) as manager:
Severity: Major
Found in src/browser/views.py and 1 other location - About 3 hrs to fix
src/browser/views.py on lines 834..842

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

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 make_repo_not_public(self, repo):
        self.browser.find_element_by_id('logo').click()

        # click the collaborators button next to the repo
        xpath = ('(//table/tbody/tr[td/a/text()="{repo}"]/td/a[text()['
Severity: Major
Found in src/functional_tests/base.py and 1 other location - About 3 hrs to fix
src/functional_tests/base.py on lines 303..312

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

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

@login_required
def file_delete(request, repo_base, repo, file_name):
    username = request.user.get_username()

    with DataHubManager(user=username, repo_base=repo_base) as manager:
Severity: Major
Found in src/browser/views.py and 1 other location - About 3 hrs to fix
src/browser/views.py on lines 1038..1046

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

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 delete(self, request, repo_base, repo_name, collaborator, format=None):
        """
        Remove a collaborator from a given repo
        """
        username = request.user.get_username()
Severity: Major
Found in src/api/views.py and 2 other locations - About 3 hrs to fix
src/api/views.py on lines 514..522
src/api/views.py on lines 714..722

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

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 delete(self, request, repo_base, repo_name, file_name, format=None):
        """
        Delete a file
        """
        username = request.user.get_username()
Severity: Major
Found in src/api/views.py and 2 other locations - About 3 hrs to fix
src/api/views.py on lines 278..286
src/api/views.py on lines 714..722

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

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 delete(self, request, repo_base, repo_name, card_name, format=None):
        """
        Delete a single card
        """
        username = request.user.get_username()
Severity: Major
Found in src/api/views.py and 2 other locations - About 3 hrs to fix
src/api/views.py on lines 278..286
src/api/views.py on lines 514..522

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

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

},{}],18:[function(require,module,exports){
"use strict";
/*jshint -W004 */
var escape = {
  "&": "&",
Severity: Major
Found in src/browser/static/datatables/js/dataTables.extra.js - About 3 hrs to fix

    Function getTargetBounds has 78 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        _Tether.prototype.getTargetBounds = function() {
          var bounds, fitAdj, hasBottomScroll, height, out, scrollBottom, scrollPercentage, style, target;
          if (this.targetModifier != null) {
            switch (this.targetModifier) {
              case 'visible':
    Severity: Major
    Found in src/browser/static/dbwipes/js/lib/tether.js - About 3 hrs to fix

      Function getTargetBounds has 78 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          _Tether.prototype.getTargetBounds = function() {
            var bounds, fitAdj, hasBottomScroll, height, out, scrollBottom, scrollPercentage, style, target;
            if (this.targetModifier != null) {
              switch (this.targetModifier) {
                case 'visible':
      Severity: Major
      Found in src/apps/dbwipes/static/js/lib/tether.js - About 3 hrs to fix

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

            ensureX: function() {
              var x = this.get('x');
              x = (_.isString(x))? {col:x, expr:x} : x;
              if (!x.alias) x.alias = x.col;
              this.attributes['x'] = x;
        Severity: Major
        Found in src/browser/static/dbwipes/js/summary/query.js and 1 other location - About 3 hrs to fix
        src/apps/dbwipes/static/js/summary/query.js on lines 52..57

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

        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

            ensureX: function() {
              var x = this.get('x');
              x = (_.isString(x))? {col:x, expr:x} : x;
              if (!x.alias) x.alias = x.col;
              this.attributes['x'] = x;
        Severity: Major
        Found in src/apps/dbwipes/static/js/summary/query.js and 1 other location - About 3 hrs to fix
        src/browser/static/dbwipes/js/summary/query.js on lines 51..56

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

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

            renderData: function(el) {
              var col = this.model.get('col'),
                  type = this.model.get('type'),
                  stats = this.model.get('stats'),
                  xscales = this.state.xscales,
        Severity: Major
        Found in src/browser/static/dbwipes/js/summary/cstatview.js - About 3 hrs to fix

          Function renderBrushes has 76 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              renderBrushes: function(el) {
                var xscales = this.state.xscales,
                    h = this.state.h,
                    type = this.model.get('type'),
                    _this = this;
          Severity: Major
          Found in src/apps/dbwipes/static/js/summary/cstatview.js - About 3 hrs to fix

            Function renderBrushes has 76 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                renderBrushes: function(el) {
                  var xscales = this.state.xscales,
                      h = this.state.h,
                      type = this.model.get('type'),
                      _this = this;
            Severity: Major
            Found in src/browser/static/dbwipes/js/summary/cstatview.js - About 3 hrs to fix

              Function renderData has 76 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  renderData: function(el) {
                    var col = this.model.get('col'),
                        type = this.model.get('type'),
                        stats = this.model.get('stats'),
                        xscales = this.state.xscales,
              Severity: Major
              Found in src/apps/dbwipes/static/js/summary/cstatview.js - About 3 hrs to fix

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

                    @factory.django.mute_signals(signals.pre_save)
                    def setUp(self):
                        self.username = "delete_me_login_username"
                        self.password = "delete_me_password"
                        self.email = "test_email@csail.mit.edu"
                Severity: Major
                Found in src/account/test/test_views.py and 1 other location - About 3 hrs to fix
                src/account/test/test_views.py on lines 45..51

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

                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

                    @factory.django.mute_signals(signals.pre_save)
                    def setUp(self):
                        self.username = "delete_me_logout_username"
                        self.password = "delete_me_password"
                        self.email = "test_email@csail.mit.edu"
                Severity: Major
                Found in src/account/test/test_views.py and 1 other location - About 3 hrs to fix
                src/account/test/test_views.py on lines 13..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 62.

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

                def aggregate(request, repo, table, agg_type, col_name):
                    username = request.user.get_username()
                    manager = DataHubManager(username)
                    repos = get_repos(manager)
                    # Ensure that the repo exists.
                Severity: Minor
                Found in src/apps/datatables/views.py - About 2 hrs 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 __init__ has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                Open

                    def __init__(self, request):
                        # First extract the easy variables.
                        self.draw = int(request.GET["draw"])
                        self.start = int(request.GET["start"])
                        self.length = int(request.GET["length"])
                Severity: Minor
                Found in src/apps/datatables/models/draw_request.py - About 2 hrs 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

                Severity
                Category
                Status
                Source
                Language