datahuborg/datahub

View on GitHub

Showing 283 of 1,132 total issues

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

    def paginate_query(self, query, current_page, rows_per_page):
        """
        Set variables for query pagination, limiting query statement
        to just the section of the table that will be displayed
        """
Severity: Minor
Found in src/core/db/manager.py - About 35 mins 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 remove_user has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def remove_user(username, remove_db=True, ignore_missing_user=False):
        # Delete the Django user
        try:
            DataHubManager._remove_django_user(username)
        except User.DoesNotExist as e:
Severity: Minor
Found in src/core/db/manager.py - About 35 mins 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 license_create has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def license_create(request):
    username = request.user.get_username()
    public_role = settings.PUBLIC_ROLE

    if request.method == 'POST':
Severity: Minor
Found in src/browser/views.py - About 35 mins 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 refine_data has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def refine_data(request):
    res = {'error': None}
    try:
        if request.method == 'POST':
            training_input = request.POST['training_input']
Severity: Minor
Found in src/apps/refiner/views.py - About 35 mins 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 _check_external_links has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def _check_external_links(self):
        # Justin gets a list of external links
        links = self.browser.find_elements_by_xpath(
            "//a[(starts-with(@href, 'http'))]")
        links = map(lambda x: x.get_attribute('href'), links)
Severity: Minor
Found in src/functional_tests/base.py - About 35 mins 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 find_security_policies has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def find_security_policies(self, repo_base, repo=None, table=None,
                               policy_id=None, policy=None, policy_type=None,
                               grantee=None, grantor=None):
        '''
        Returns a list of all security polices that match the inputs specied
Severity: Minor
Found in src/core/db/backend/pg.py - About 35 mins 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 get_date_stats has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def get_date_stats(self, col_name):
        q = ('select max(%s)::date, min(%s)::date, '
             'EXTRACT(EPOCH FROM (max(%s::timestamp) - min(%s::timestamp)))/60'
             ' as minutes from %s')
        q = q % (col_name, col_name, col_name, col_name, self.tablename)
Severity: Minor
Found in src/apps/dbwipes/summary.py - About 35 mins 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

Avoid too many return statements within this function.
Open

      return fn(context, options);
Severity: Major
Found in src/browser/static/datatables/js/dataTables.extra.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

      return string.replace(badChars, escapeChar);
    Severity: Major
    Found in src/browser/static/datatables/js/dataTables.extra.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

              return Response(
      Severity: Major
      Found in src/api/views.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                return super(SummaryEncoder, self).default(o)
        Severity: Major
        Found in src/apps/dbwipes/util.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                  return HttpResponse(
          Severity: Major
          Found in src/browser/views.py - About 30 mins to fix

            Function set_visibility has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            var set_visibility = function(colname, visibility) {
              if (visibility !== undefined) {
                if (visibility) {
                  hidden_cols[colname] = undefined;
                } else {
            Severity: Minor
            Found in src/apps/datatables/client/js/filter-bar.js - About 25 mins 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 get_user_details has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            def get_user_details(request):
                """
                DataHub account registration form for social accounts.
            
                Gives new users a chance to choose a DataHub username and set their email
            Severity: Minor
            Found in src/account/views.py - About 25 mins 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 _unique_keys has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            def _unique_keys(proposed):
                """
                Uniques and returns a given list of strings.
            
                e.g. ['foo', 'foo', 'foo'] => ['foo', 'foo_1', 'foo_2']
            Severity: Minor
            Found in src/api/serializer.py - About 25 mins 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 insert_into_cache has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            def insert_into_cache(f):
                """Inserts metadata into the cache"""
                @wraps(f)
                def _f(self, *args, **kwargs):
                    try:
            Severity: Minor
            Found in src/apps/dbwipes/summary.py - About 25 mins 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 user has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            def user(request, repo_base=None):
                username = request.user.get_username()
            
                repo_base = username or 'public'
            
            
            Severity: Minor
            Found in src/browser/views.py - About 25 mins 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 get_view_sql has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                def get_view_sql(self, repo_base, repo, table, view_params, license_id):
                    # create view based on license
                    license = LicenseManager.find_license_by_id(license_id)
            
                    pii_def = license.pii_def
            Severity: Minor
            Found in src/core/db/backend/pg.py - About 25 mins 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 app_register has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            def app_register(request):
                username = request.user.get_username()
            
                if request.method == "POST":
                    try:
            Severity: Minor
            Found in src/browser/views.py - About 25 mins 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 _remove_django_user has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                def _remove_django_user(username):
                    # Get the user associated with the username, delete their apps, and
                    # then delete the user
                    try:
                        user = User.objects.get(username=username)
            Severity: Minor
            Found in src/core/db/manager.py - About 25 mins 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