kiwitcms/Kiwi

View on GitHub

Showing 243 of 379 total issues

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

  if (dateBefore.val()) {
    query.stop_date__lte = dateBefore.data('DateTimePicker').date().format('YYYY-MM-DD 23:59:59')
  }
Severity: Major
Found in tcms/telemetry/static/telemetry/js/testing/test-case-health.js and 7 other locations - About 40 mins to fix
tcms/telemetry/static/telemetry/js/testing/breakdown.js on lines 31..33
tcms/telemetry/static/telemetry/js/testing/breakdown.js on lines 36..38
tcms/telemetry/static/telemetry/js/testing/execution-trends.js on lines 50..52
tcms/telemetry/static/telemetry/js/testing/execution-trends.js on lines 55..57
tcms/telemetry/static/telemetry/js/testing/status-matrix.js on lines 99..101
tcms/telemetry/static/telemetry/js/testing/status-matrix.js on lines 104..106
tcms/telemetry/static/telemetry/js/testing/test-case-health.js on lines 56..58

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

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

  if (dateAfter.val()) {
    query.stop_date__gte = dateAfter.data('DateTimePicker').date().format('YYYY-MM-DD 00:00:00')
  }
Severity: Major
Found in tcms/telemetry/static/telemetry/js/testing/status-matrix.js and 7 other locations - About 40 mins to fix
tcms/telemetry/static/telemetry/js/testing/breakdown.js on lines 31..33
tcms/telemetry/static/telemetry/js/testing/breakdown.js on lines 36..38
tcms/telemetry/static/telemetry/js/testing/execution-trends.js on lines 50..52
tcms/telemetry/static/telemetry/js/testing/execution-trends.js on lines 55..57
tcms/telemetry/static/telemetry/js/testing/status-matrix.js on lines 99..101
tcms/telemetry/static/telemetry/js/testing/test-case-health.js on lines 51..53
tcms/telemetry/static/telemetry/js/testing/test-case-health.js on lines 56..58

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

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

  if (dateAfter.val()) {
    query.stop_date__gte = dateAfter.data('DateTimePicker').date().format('YYYY-MM-DD 00:00:00')
  }
Severity: Major
Found in tcms/telemetry/static/telemetry/js/testing/test-case-health.js and 7 other locations - About 40 mins to fix
tcms/telemetry/static/telemetry/js/testing/breakdown.js on lines 31..33
tcms/telemetry/static/telemetry/js/testing/breakdown.js on lines 36..38
tcms/telemetry/static/telemetry/js/testing/execution-trends.js on lines 50..52
tcms/telemetry/static/telemetry/js/testing/execution-trends.js on lines 55..57
tcms/telemetry/static/telemetry/js/testing/status-matrix.js on lines 99..101
tcms/telemetry/static/telemetry/js/testing/status-matrix.js on lines 104..106
tcms/telemetry/static/telemetry/js/testing/test-case-health.js on lines 51..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 48.

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 ($('#id_status').val().length > 0) {
        params.case_status__in = $('#id_status').val()
      };
Severity: Minor
Found in tcms/testcases/static/testcases/js/search.js and 1 other location - About 40 mins to fix
tcms/testcases/static/testcases/js/search.js on lines 85..87

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

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 ($('#id_priority').val().length > 0) {
        params.priority__in = $('#id_priority').val()
      };
Severity: Minor
Found in tcms/testcases/static/testcases/js/search.js and 1 other location - About 40 mins to fix
tcms/testcases/static/testcases/js/search.js on lines 89..91

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

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 addPropertyValue has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

function addPropertyValue (objectId, objectAttrName, viewMethod, addMethod, removeMethod) {
Severity: Minor
Found in tcms/static/js/properties.js - About 35 mins to fix

    Function assign_default_group_permissions has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def assign_default_group_permissions(
    Severity: Minor
    Found in tcms/utils/permissions.py - About 35 mins to fix

      Function updateSelect has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      function updateSelect (data, selector, idAttr, valueAttr, groupAttr) {
      Severity: Minor
      Found in tcms/static/js/utils.js - About 35 mins to fix

        Function add_attachment has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def add_attachment(obj_id, app_model, user, filename, b64content):
        Severity: Minor
        Found in tcms/rpc/utils.py - About 35 mins to fix

          Function renderCommentsForObject has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          function renderCommentsForObject (objId, getMethod, deleteMethod, canDelete, parentNode) {
          Severity: Minor
          Found in tcms/static/js/utils.js - About 35 mins to fix

            Function propertiesCard has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            function propertiesCard (objectId, objectAttrName, viewMethod, addMethod, removeMethod) {
            Severity: Minor
            Found in tcms/static/js/properties.js - About 35 mins to fix

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

                  def visit_attribute(self, node):
                      # looking for .extra(select={}) patterns
                      if node.attrname == "extra" and isinstance(node.parent, astroid.Call):
                          for keyword in node.parent.keywords:
                              if keyword.arg in [
              Severity: Minor
              Found in kiwi_lint/raw_sql.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 assign_default_group_permissions has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

              def assign_default_group_permissions(
                  output=None,
                  refresh_all=False,
                  group_model=Group,
                  admin_permissions_filter=None,
              Severity: Minor
              Found in tcms/utils/permissions.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 update has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

              def update(case_id, values):
                  """
                  .. function:: RPC TestCase.update(case_id, values)
              
                      Update the fields of the selected test case.
              Severity: Minor
              Found in tcms/rpc/api/testcase.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 clone has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  def clone(  # pylint: disable=too-many-arguments
                      self,
                      name=None,
                      product=None,
                      version=None,
              Severity: Minor
              Found in tcms/testplans/models.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 getTestCaseRowContent has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

              function getTestCaseRowContent (rowContent, testCase, permissions) {
                const row = $(rowContent)
              
                row[0].firstElementChild.dataset.testcasePk = testCase.id
                row.find('.js-test-case-link').html(`TC-${testCase.id}: ${testCase.summary}`).attr('href', `/case/${testCase.id}/`)
              Severity: Minor
              Found in tcms/testplans/static/testplans/js/get.js - 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 post has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  def post(self, request):  # pylint: disable=no-self-use
                      form = BugCommentForm(request.POST)
                      request_action = request.POST.get("action")
              
                      if form.is_valid():
              Severity: Minor
              Found in tcms/bugs/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 hookIntoPagination has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

              function hookIntoPagination (tableSelector, table) {
                const updateCurrentPage = function (table) {
                  const info = table.page.info()
                  $('.current-page').val(info.page + 1)
                  $('.total-pages').html(info.pages)
              Severity: Minor
              Found in tcms/static/js/pagination.js - 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

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

                          if (
                              isinstance(decorator, astroid.Call)
                              and isinstance(decorator.func, astroid.Name)
                              and decorator.func.name == "permissions_required"
              Severity: Minor
              Found in kiwi_lint/missing_permissions.py and 1 other location - About 35 mins to fix
              kiwi_lint/utils.py on lines 14..17

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

              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 (
                          isinstance(decorator, astroid.Call)
                          and isinstance(decorator.func, astroid.Name)
                          and decorator.func.name == "rpc_method"
              Severity: Minor
              Found in kiwi_lint/utils.py and 1 other location - About 35 mins to fix
              kiwi_lint/missing_permissions.py on lines 117..120

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

              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

              Severity
              Category
              Status
              Source
              Language