kiwitcms/Kiwi

View on GitHub

Showing 262 of 405 total issues

File get.js has 720 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { fetchBugDetails } from '../../../../static/js/bugs'
import { jsonRPC } from '../../../../static/js/jsonrpc'
import { propertiesCard } from '../../../../static/js/properties'
import { tagsCard } from '../../../../static/js/tags'
import {
Severity: Major
Found in tcms/testruns/static/testruns/js/get.js - About 1 day to fix

    File get.js has 517 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import { jsonRPC } from '../../../../static/js/jsonrpc'
    import { tagsCard } from '../../../../static/js/tags'
    import {
        animate,
        advancedSearchAndAddTestCases,
    Severity: Major
    Found in tcms/testplans/static/testplans/js/get.js - About 1 day to fix

      File testcase.py has 482 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      # -*- coding: utf-8 -*-
      
      from datetime import timedelta
      
      from django.db.models.functions import Coalesce
      Severity: Minor
      Found in tcms/rpc/api/testcase.py - About 7 hrs to fix

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

        Severity: Major
        Found in tcms/testcases/migrations/0021_add_property_model.py and 1 other location - About 7 hrs to fix
        tcms/testruns/migrations/0016_testexecutionproperty.py on lines 0..34

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

        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

        Severity: Major
        Found in tcms/testruns/migrations/0016_testexecutionproperty.py and 1 other location - About 7 hrs to fix
        tcms/testcases/migrations/0021_add_property_model.py on lines 0..34

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

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

        export function pageTestrunsGetReadyHandler () {
            permissions.removeTag = $('#test_run_pk').data('perm-remove-tag') === 'True'
            permissions.addComment = $('#test_run_pk').data('perm-add-comment') === 'True'
            permissions.removeComment = $('#test_run_pk').data('perm-remove-comment') === 'True'
        
        
        Severity: Major
        Found in tcms/testruns/static/testruns/js/get.js - About 6 hrs to fix

          Function toolbarEvents has 154 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function toolbarEvents (testPlanId, permissions) {
              $('.js-checkbox-toolbar').click(function (ev) {
                  const isChecked = ev.target.checked
                  const testCaseRows = $('.js-testcase-row').find('input')
          
          
          Severity: Major
          Found in tcms/testplans/static/testplans/js/get.js - About 6 hrs to fix

            Function pageTestcasesSearchReadyHandler has 144 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export function pageTestcasesSearchReadyHandler () {
                initializeDateTimePicker('#id_before')
                initializeDateTimePicker('#id_after')
            
                const table = $('#resultsTable').DataTable({
            Severity: Major
            Found in tcms/testcases/static/testcases/js/search.js - About 5 hrs to fix

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

                  $('#bulk-reviewer-button').click(function (ev) {
                      $(this).parents('.dropdown').toggleClass('open')
                      const selectedCases = getSelectedTestCases()
              
                      if (!selectedCases.length) {
              Severity: Major
              Found in tcms/testplans/static/testplans/js/get.js and 1 other location - About 5 hrs to fix
              tcms/testplans/static/testplans/js/get.js on lines 542..561

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

              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

                  $('#default-tester-button').click(function (ev) {
                      $(this).parents('.dropdown').toggleClass('open')
                      const selectedCases = getSelectedTestCases()
              
                      if (!selectedCases.length) {
              Severity: Major
              Found in tcms/testplans/static/testplans/js/get.js and 1 other location - About 5 hrs to fix
              tcms/testplans/static/testplans/js/get.js on lines 563..582

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

              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

              Severity: Major
              Found in tcms/telemetry/urls.py and 1 other location - About 5 hrs to fix
              tcms/bugs/urls.py on lines 0..14

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

              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

              @permissions_required("management.change_build")
              @rpc_method(name="Build.update")
              def update(build_id, values):
                  """
                  .. function:: RPC Build.update(build_id, values)
              Severity: Major
              Found in tcms/rpc/api/build.py and 1 other location - About 5 hrs to fix
              tcms/rpc/api/component.py on lines 84..108

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

              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

              @permissions_required("management.change_component")
              @rpc_method(name="Component.update")
              def update(component_id, values):
                  """
                  .. function:: RPC Component.update
              Severity: Major
              Found in tcms/rpc/api/component.py and 1 other location - About 5 hrs to fix
              tcms/rpc/api/build.py on lines 67..92

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

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

              export function pageTestrunsSearchReadyHandler () {
                  initializeDateTimePicker('#id_before_start_date')
                  initializeDateTimePicker('#id_after_start_date')
                  initializeDateTimePicker('#id_before_stop_date')
                  initializeDateTimePicker('#id_after_stop_date')
              Severity: Minor
              Found in tcms/testruns/static/testruns/js/search.js - About 4 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 pageTestplansSearchReadyHandler has 118 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export function pageTestplansSearchReadyHandler () {
                  initializeDateTimePicker('#id_before')
                  initializeDateTimePicker('#id_after')
              
                  const rowsNotShownMessage = $('#main-element').data('trans-some-rows-not-shown')
              Severity: Major
              Found in tcms/testplans/static/testplans/js/search.js - About 4 hrs to fix

                Function pageTestcasesGetReadyHandler has 115 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export function pageTestcasesGetReadyHandler () {
                    const caseId = $('#test_case_pk').data('pk')
                    const productId = $('#product_pk').data('pk')
                    const permRemoveTag = $('#test_case_pk').data('perm-remove-tag') === 'True'
                    const permRemoveComponent = $('#test_case_pk').data('perm-remove-component') === 'True'
                Severity: Major
                Found in tcms/testcases/static/testcases/js/get.js - About 4 hrs to fix

                  Function pageTestcasesSearchReadyHandler has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
                  Open

                  export function pageTestcasesSearchReadyHandler () {
                      initializeDateTimePicker('#id_before')
                      initializeDateTimePicker('#id_after')
                  
                      const table = $('#resultsTable').DataTable({
                  Severity: Minor
                  Found in tcms/testcases/static/testcases/js/search.js - About 4 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 pageTestrunsSearchReadyHandler has 107 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export function pageTestrunsSearchReadyHandler () {
                      initializeDateTimePicker('#id_before_start_date')
                      initializeDateTimePicker('#id_after_start_date')
                      initializeDateTimePicker('#id_before_stop_date')
                      initializeDateTimePicker('#id_after_stop_date')
                  Severity: Major
                  Found in tcms/testruns/static/testruns/js/search.js - About 4 hrs to fix

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

                        $('.js-toolbar-priority').click(function (ev) {
                            $(this).parents('.dropdown').toggleClass('open')
                            const selectedCases = getSelectedTestCases()
                    
                            if (!selectedCases.length) {
                    Severity: Major
                    Found in tcms/testplans/static/testplans/js/get.js and 1 other location - About 4 hrs to fix
                    tcms/testplans/static/testplans/js/get.js on lines 528..540

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

                    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

                        $('.js-toolbar-status').click(function (ev) {
                            $(this).parents('.dropdown').toggleClass('open')
                            const selectedCases = getSelectedTestCases()
                    
                            if (!selectedCases.length) {
                    Severity: Major
                    Found in tcms/testplans/static/testplans/js/get.js and 1 other location - About 4 hrs to fix
                    tcms/testplans/static/testplans/js/get.js on lines 513..526

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

                    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