kiwitcms/Kiwi

View on GitHub

Showing 239 of 378 total issues

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

const allExecutionStatuses = {}
const allExecutions = {}
const expandedExecutionIds = []
const permissions = {
    removeTag: false,
Severity: Major
Found in tcms/testruns/static/testruns/js/get.js - About 1 day to fix

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

    const expandedTestCaseIds = []
    const fadeAnimationTime = 500
    
    const allTestCases = {}
    const autocompleteCache = {}
    Severity: Major
    Found in tcms/testplans/static/testplans/js/get.js - About 1 day to fix

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

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

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

        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/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..35

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

          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 556..575

          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

              $('#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 535..554

          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

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

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

          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 74..99

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

          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-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 521..533

          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 506..519

          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

          @permissions_required("testruns.view_environmentproperty")
          @rpc_method(name="Environment.properties")
          def properties(query=None):
              """
              .. function:: Environment.properties(query)
          Severity: Major
          Found in tcms/rpc/api/environment.py and 1 other location - About 4 hrs to fix
          tcms/rpc/api/testcase.py on lines 571..596

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

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

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

                  tags.forEach(function (element) {
                      if (tagsPerCase[element.case] === undefined) {
                          tagsPerCase[element.case] = []
                      }
          
          
          Severity: Major
          Found in tcms/testcases/static/testcases/js/search.js and 2 other locations - About 3 hrs to fix
          tcms/testcases/static/testcases/js/search.js on lines 24..33
          tcms/testplans/static/testplans/js/search.js on lines 10..19

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 114.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

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

                      components.forEach(function (element) {
                          if (componentsPerCase[element.cases] === undefined) {
                              componentsPerCase[element.cases] = []
                          }
          
          
          Severity: Major
          Found in tcms/testcases/static/testcases/js/search.js and 2 other locations - About 3 hrs to fix
          tcms/testcases/static/testcases/js/search.js on lines 10..19
          tcms/testplans/static/testplans/js/search.js on lines 10..19

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 114.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

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

                  tags.forEach(function (element) {
                      if (tagsPerPlan[element.plan] === undefined) {
                          tagsPerPlan[element.plan] = []
                      }
          
          
          Severity: Major
          Found in tcms/testplans/static/testplans/js/search.js and 2 other locations - About 3 hrs to fix
          tcms/testcases/static/testcases/js/search.js on lines 10..19
          tcms/testcases/static/testcases/js/search.js on lines 24..33

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

          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

          File utils.js has 318 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          /*
              Used to update a select when something else changes.
          */
          function updateSelect (data, selector, idAttr, valueAttr, groupAttr) {
              const _selectTag = $(selector)[0]
          Severity: Minor
          Found in tcms/static/js/utils.js - About 3 hrs to fix

            Function renderAdditionalInformation has 90 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function renderAdditionalInformation (testRunId, execution) {
                let linksQuery = { execution__run: testRunId }
                let casesQuery = { executions__run: testRunId }
                let componentQ = { cases__executions__run: testRunId }
                let tagsQ = { case__executions__run: testRunId }
            Severity: Major
            Found in tcms/testruns/static/testruns/js/get.js - About 3 hrs to fix

              File testrun.py has 315 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              # -*- coding: utf-8 -*-
              from django.forms.models import model_to_dict
              from modernrpc.core import REQUEST_KEY, rpc_method
              
              from tcms.core.utils import form_errors_to_list
              Severity: Minor
              Found in tcms/rpc/api/testrun.py - About 3 hrs to fix

                Function getExpandArea has 88 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function getExpandArea (testExecution) {
                    const container = $(`.test-execution-${testExecution.id}`)
                
                    container.find('.test-execution-information .run-date').html(testExecution.stop_date || '-')
                    container.find('.test-execution-information .build').html(testExecution.build__name)
                Severity: Major
                Found in tcms/testruns/static/testruns/js/get.js - About 3 hrs to fix
                  Severity
                  Category
                  Status
                  Source
                  Language