kiwitcms/Kiwi

View on GitHub

Showing 239 of 376 total issues

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

      if ($('#id_before_start_date').val()) {
        params.start_date__lte = $('#id_before_start_date').data('DateTimePicker').date().format('YYYY-MM-DD 23:59:59')
      }
Severity: Major
Found in tcms/testruns/static/testruns/js/search.js and 13 other locations - About 1 hr to fix
tcms/bugs/static/bugs/js/search.js on lines 36..38
tcms/bugs/static/bugs/js/search.js on lines 40..42
tcms/testcases/static/testcases/js/search.js on lines 65..67
tcms/testcases/static/testcases/js/search.js on lines 69..71
tcms/testplans/static/testplans/js/search.js on lines 44..46
tcms/testplans/static/testplans/js/search.js on lines 48..50
tcms/testruns/static/testruns/js/search.js on lines 52..54
tcms/testruns/static/testruns/js/search.js on lines 60..62
tcms/testruns/static/testruns/js/search.js on lines 64..66
tcms/testruns/static/testruns/js/search.js on lines 68..70
tcms/testruns/static/testruns/js/search.js on lines 72..74
tcms/testruns/static/testruns/js/search.js on lines 76..78
tcms/testruns/static/testruns/js/search.js on lines 80..82

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

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

      if ($('#id_after_stop_date').val()) {
        params.stop_date__gte = $('#id_after_stop_date').data('DateTimePicker').date().format('YYYY-MM-DD 00:00:00')
      }
Severity: Major
Found in tcms/testruns/static/testruns/js/search.js and 13 other locations - About 1 hr to fix
tcms/bugs/static/bugs/js/search.js on lines 36..38
tcms/bugs/static/bugs/js/search.js on lines 40..42
tcms/testcases/static/testcases/js/search.js on lines 65..67
tcms/testcases/static/testcases/js/search.js on lines 69..71
tcms/testplans/static/testplans/js/search.js on lines 44..46
tcms/testplans/static/testplans/js/search.js on lines 48..50
tcms/testruns/static/testruns/js/search.js on lines 52..54
tcms/testruns/static/testruns/js/search.js on lines 56..58
tcms/testruns/static/testruns/js/search.js on lines 64..66
tcms/testruns/static/testruns/js/search.js on lines 68..70
tcms/testruns/static/testruns/js/search.js on lines 72..74
tcms/testruns/static/testruns/js/search.js on lines 76..78
tcms/testruns/static/testruns/js/search.js on lines 80..82

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

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

      if ($('#id_after_planned_start').val()) {
        params.planned_start__gte = $('#id_after_planned_start').data('DateTimePicker').date().format('YYYY-MM-DD 00:00:00')
      }
Severity: Major
Found in tcms/testruns/static/testruns/js/search.js and 13 other locations - About 1 hr to fix
tcms/bugs/static/bugs/js/search.js on lines 36..38
tcms/bugs/static/bugs/js/search.js on lines 40..42
tcms/testcases/static/testcases/js/search.js on lines 65..67
tcms/testcases/static/testcases/js/search.js on lines 69..71
tcms/testplans/static/testplans/js/search.js on lines 44..46
tcms/testplans/static/testplans/js/search.js on lines 48..50
tcms/testruns/static/testruns/js/search.js on lines 52..54
tcms/testruns/static/testruns/js/search.js on lines 56..58
tcms/testruns/static/testruns/js/search.js on lines 60..62
tcms/testruns/static/testruns/js/search.js on lines 64..66
tcms/testruns/static/testruns/js/search.js on lines 72..74
tcms/testruns/static/testruns/js/search.js on lines 76..78
tcms/testruns/static/testruns/js/search.js on lines 80..82

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

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

      if ($('#id_after').val()) {
        params.created_at__gte = $('#id_after').data('DateTimePicker').date().format('YYYY-MM-DD 00:00:00')
      }
Severity: Major
Found in tcms/bugs/static/bugs/js/search.js and 13 other locations - About 1 hr to fix
tcms/bugs/static/bugs/js/search.js on lines 36..38
tcms/testcases/static/testcases/js/search.js on lines 65..67
tcms/testcases/static/testcases/js/search.js on lines 69..71
tcms/testplans/static/testplans/js/search.js on lines 44..46
tcms/testplans/static/testplans/js/search.js on lines 48..50
tcms/testruns/static/testruns/js/search.js on lines 52..54
tcms/testruns/static/testruns/js/search.js on lines 56..58
tcms/testruns/static/testruns/js/search.js on lines 60..62
tcms/testruns/static/testruns/js/search.js on lines 64..66
tcms/testruns/static/testruns/js/search.js on lines 68..70
tcms/testruns/static/testruns/js/search.js on lines 72..74
tcms/testruns/static/testruns/js/search.js on lines 76..78
tcms/testruns/static/testruns/js/search.js on lines 80..82

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

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

      if ($('#id_before').val()) {
        params.created_at__lte = $('#id_before').data('DateTimePicker').date().format('YYYY-MM-DD 23:59:59')
      }
Severity: Major
Found in tcms/bugs/static/bugs/js/search.js and 13 other locations - About 1 hr to fix
tcms/bugs/static/bugs/js/search.js on lines 40..42
tcms/testcases/static/testcases/js/search.js on lines 65..67
tcms/testcases/static/testcases/js/search.js on lines 69..71
tcms/testplans/static/testplans/js/search.js on lines 44..46
tcms/testplans/static/testplans/js/search.js on lines 48..50
tcms/testruns/static/testruns/js/search.js on lines 52..54
tcms/testruns/static/testruns/js/search.js on lines 56..58
tcms/testruns/static/testruns/js/search.js on lines 60..62
tcms/testruns/static/testruns/js/search.js on lines 64..66
tcms/testruns/static/testruns/js/search.js on lines 68..70
tcms/testruns/static/testruns/js/search.js on lines 72..74
tcms/testruns/static/testruns/js/search.js on lines 76..78
tcms/testruns/static/testruns/js/search.js on lines 80..82

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

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

      if ($('#id_after_planned_stop').val()) {
        params.planned_stop__gte = $('#id_after_planned_stop').data('DateTimePicker').date().format('YYYY-MM-DD 00:00:00')
      }
Severity: Major
Found in tcms/testruns/static/testruns/js/search.js and 13 other locations - About 1 hr to fix
tcms/bugs/static/bugs/js/search.js on lines 36..38
tcms/bugs/static/bugs/js/search.js on lines 40..42
tcms/testcases/static/testcases/js/search.js on lines 65..67
tcms/testcases/static/testcases/js/search.js on lines 69..71
tcms/testplans/static/testplans/js/search.js on lines 44..46
tcms/testplans/static/testplans/js/search.js on lines 48..50
tcms/testruns/static/testruns/js/search.js on lines 52..54
tcms/testruns/static/testruns/js/search.js on lines 56..58
tcms/testruns/static/testruns/js/search.js on lines 60..62
tcms/testruns/static/testruns/js/search.js on lines 64..66
tcms/testruns/static/testruns/js/search.js on lines 68..70
tcms/testruns/static/testruns/js/search.js on lines 72..74
tcms/testruns/static/testruns/js/search.js on lines 80..82

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

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

      if ($('#id_before_planned_stop').val()) {
        params.planned_stop__lte = $('#id_before_planned_stop').data('DateTimePicker').date().format('YYYY-MM-DD 23:59:59')
      }
Severity: Major
Found in tcms/testruns/static/testruns/js/search.js and 13 other locations - About 1 hr to fix
tcms/bugs/static/bugs/js/search.js on lines 36..38
tcms/bugs/static/bugs/js/search.js on lines 40..42
tcms/testcases/static/testcases/js/search.js on lines 65..67
tcms/testcases/static/testcases/js/search.js on lines 69..71
tcms/testplans/static/testplans/js/search.js on lines 44..46
tcms/testplans/static/testplans/js/search.js on lines 48..50
tcms/testruns/static/testruns/js/search.js on lines 52..54
tcms/testruns/static/testruns/js/search.js on lines 56..58
tcms/testruns/static/testruns/js/search.js on lines 60..62
tcms/testruns/static/testruns/js/search.js on lines 64..66
tcms/testruns/static/testruns/js/search.js on lines 68..70
tcms/testruns/static/testruns/js/search.js on lines 72..74
tcms/testruns/static/testruns/js/search.js on lines 76..78

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

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

      if ($('#id_before_planned_start').val()) {
        params.planned_start__lte = $('#id_before_planned_start').data('DateTimePicker').date().format('YYYY-MM-DD 23:59:59')
      }
Severity: Major
Found in tcms/testruns/static/testruns/js/search.js and 13 other locations - About 1 hr to fix
tcms/bugs/static/bugs/js/search.js on lines 36..38
tcms/bugs/static/bugs/js/search.js on lines 40..42
tcms/testcases/static/testcases/js/search.js on lines 65..67
tcms/testcases/static/testcases/js/search.js on lines 69..71
tcms/testplans/static/testplans/js/search.js on lines 44..46
tcms/testplans/static/testplans/js/search.js on lines 48..50
tcms/testruns/static/testruns/js/search.js on lines 52..54
tcms/testruns/static/testruns/js/search.js on lines 56..58
tcms/testruns/static/testruns/js/search.js on lines 60..62
tcms/testruns/static/testruns/js/search.js on lines 64..66
tcms/testruns/static/testruns/js/search.js on lines 68..70
tcms/testruns/static/testruns/js/search.js on lines 76..78
tcms/testruns/static/testruns/js/search.js on lines 80..82

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

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

      if ($('#id_before_stop_date').val()) {
        params.stop_date__lte = $('#id_before_stop_date').data('DateTimePicker').date().format('YYYY-MM-DD 23:59:59')
      }
Severity: Major
Found in tcms/testruns/static/testruns/js/search.js and 13 other locations - About 1 hr to fix
tcms/bugs/static/bugs/js/search.js on lines 36..38
tcms/bugs/static/bugs/js/search.js on lines 40..42
tcms/testcases/static/testcases/js/search.js on lines 65..67
tcms/testcases/static/testcases/js/search.js on lines 69..71
tcms/testplans/static/testplans/js/search.js on lines 44..46
tcms/testplans/static/testplans/js/search.js on lines 48..50
tcms/testruns/static/testruns/js/search.js on lines 52..54
tcms/testruns/static/testruns/js/search.js on lines 56..58
tcms/testruns/static/testruns/js/search.js on lines 60..62
tcms/testruns/static/testruns/js/search.js on lines 68..70
tcms/testruns/static/testruns/js/search.js on lines 72..74
tcms/testruns/static/testruns/js/search.js on lines 76..78
tcms/testruns/static/testruns/js/search.js on lines 80..82

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

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

function jsonRPC (rpcMethod, rpcParams, callback, isSync) {
  // .filter() args are passed as dictionary but other args,
  // e.g. for .add_tag() are passed as a list of positional values
  if (!Array.isArray(rpcParams)) {
    rpcParams = [rpcParams]
Severity: Minor
Found in tcms/static/js/jsonrpc.js - About 1 hr to fix

    Function updateSelect has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function updateSelect (data, selector, idAttr, valueAttr, groupAttr) {
      const _selectTag = $(selector)[0]
      let newOptions = ''
      let currentGroup = ''
      const isMultiple = _selectTag.attributes.getNamedItem('multiple') !== null
    Severity: Minor
    Found in tcms/static/js/utils.js - About 1 hr to fix

      Function ajax has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          ajax: function (data, callback, settings) {
            const query = {}
      
            const productIds = $('#id_product').val()
            if (productIds.length) {
      Severity: Minor
      Found in tcms/telemetry/static/telemetry/js/testing/test-case-health.js - About 1 hr to fix

        Function clone has 8 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def clone(  # pylint: disable=too-many-arguments
        Severity: Major
        Found in tcms/testplans/models.py - About 1 hr to fix

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

                      if (testCase.tagNames.length) {
                        row.find('.js-row-tags').toggleClass('hidden')
                        row.find('.js-row-tags').append(testCase.tagNames.join(', '))
                      }
          Severity: Minor
          Found in tcms/testruns/static/testruns/js/get.js and 1 other location - About 55 mins to fix
          tcms/testruns/static/testruns/js/get.js on lines 646..649

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

          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

            $('#btn-search-cases').click(function () {
              return advancedSearchAndAddTestCases(
                testPlanId, 'TestPlan.add_case', $(this).attr('href'),
                $('#test_plan_pk').data('trans-error-adding-cases')
              )
          Severity: Minor
          Found in tcms/testplans/static/testplans/js/get.js and 1 other location - About 55 mins to fix
          tcms/testruns/static/testruns/js/get.js on lines 168..173

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

          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 (testCase.componentNames.length) {
                        row.find('.js-row-components').toggleClass('hidden')
                        row.find('.js-row-components').append(testCase.componentNames.join(', '))
                      }
          Severity: Minor
          Found in tcms/testruns/static/testruns/js/get.js and 1 other location - About 55 mins to fix
          tcms/testruns/static/testruns/js/get.js on lines 633..636

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

          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

            $('#btn-search-cases').click(function () {
              return advancedSearchAndAddTestCases(
                testRunId, 'TestRun.add_case', $(this).attr('href'),
                $('#test_run_pk').data('trans-error-adding-cases')
              )
          Severity: Minor
          Found in tcms/testruns/static/testruns/js/get.js and 1 other location - About 55 mins to fix
          tcms/testplans/static/testplans/js/get.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 54.

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

          function drawTable () {
            $('.js-spinner').show()
            if (table) {
              table.destroy()
          
          
          Severity: Minor
          Found in tcms/telemetry/static/telemetry/js/testing/status-matrix.js - About 55 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 4 locations. Consider refactoring.
          Open

          @permissions_required("testruns.delete_environmentproperty")
          @rpc_method(name="Environment.remove_property")
          def remove_property(query):
              """
              .. function:: Environment.remove_property(query)
          Severity: Major
          Found in tcms/rpc/api/environment.py and 3 other locations - About 55 mins to fix
          tcms/rpc/api/testcase.py on lines 601..613
          tcms/rpc/api/testexecution.py on lines 307..319
          tcms/bugs/api.py on lines 59..71

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

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

          @permissions_required("testcases.delete_property")
          @rpc_method(name="TestCase.remove_property")
          def remove_property(query):
              """
              .. function:: TestCase.remove_property(query)
          Severity: Major
          Found in tcms/rpc/api/testcase.py and 3 other locations - About 55 mins to fix
          tcms/rpc/api/environment.py on lines 46..58
          tcms/rpc/api/testexecution.py on lines 307..319
          tcms/bugs/api.py on lines 59..71

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

          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