kiwitcms/Kiwi

View on GitHub

Showing 75 of 377 total issues

File get.js has 641 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 506 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

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

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

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

        Function toolbarEvents has 153 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 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.close_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

            Function getTestCaseExpandArea has 78 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function getTestCaseExpandArea(row, testCase, permissions) {
                markdown2HTML(testCase.text, row.find('.js-test-case-expand-text'))
                if (testCase.notes.trim().length > 0) {
                    row.find('.js-test-case-expand-notes').html(testCase.notes);
                }
            Severity: Major
            Found in tcms/testplans/static/testplans/js/get.js - About 3 hrs to fix

              Function drawChart has 73 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function drawChart() {
                  const query = {};
              
                  const productIds = $('#id_product').val();
                  if (productIds.length) {
              Severity: Major
              Found in tcms/telemetry/static/telemetry/js/testing/execution-trends.js - About 2 hrs to fix

                File types.py has 285 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                """
                    This module implements Kiwi TCMS interface to external issue tracking systems.
                    Refer to each implementor class for integration specifics!
                """
                
                
                Severity: Minor
                Found in tcms/issuetracker/types.py - About 2 hrs to fix

                  Function renderAdditionalInformation has 69 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 2 hrs to fix

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

                    /*
                        Used to update a select when something else changes.
                    */
                    function updateSelect(data, selector, id_attr, value_attr, group_attr) {
                        var _select_tag = $(selector)[0];
                    Severity: Minor
                    Found in tcms/static/js/utils.js - About 2 hrs to fix

                      Function drawTable has 68 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function drawTable() {
                          if (table) {
                              table.destroy();
                      
                              $('table > thead > tr > th:not(.header)').remove();
                      Severity: Major
                      Found in tcms/telemetry/static/telemetry/js/testing/status-matrix.js - About 2 hrs to fix

                        Function attachEvents has 65 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        function attachEvents(testPlanId, permissions) {
                            treeViewBind('#testcases-list');
                        
                            if (permissions['perm-change-testcase']) {
                                // update default tester
                        Severity: Major
                        Found in tcms/testplans/static/testplans/js/get.js - About 2 hrs to fix

                          File testplan.py has 275 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
                          
                          
                          Severity: Minor
                          Found in tcms/rpc/api/testplan.py - About 2 hrs to fix

                            File testrun.py has 275 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 2 hrs to fix

                              Function update has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                              Open

                              def update(
                                  user_id, values, **kwargs
                              ):  # pylint: disable=missing-api-permissions-required
                                  """
                                  .. function:: RPC User.update(user_id, values)
                              Severity: Minor
                              Found in tcms/rpc/api/user.py - About 2 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 tagsCard has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              function tagsCard(model, object_id, display_filter, perm_remove) {
                                  // load the tags table
                                  var tags_table = $('#tags').DataTable({
                                      ajax: function(data, callback, settings) {
                                          dataTableJsonRPC('Tag.filter', display_filter, callback, function(data, callback) {
                              Severity: Major
                              Found in tcms/static/js/tags.js - About 2 hrs to fix

                                Function initSimpleMDE has 60 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                function initSimpleMDE(textArea, fileUploadElement, autoSaveId=window.location.toString()) {
                                    if (!textArea || !fileUploadElement) {
                                        return null;
                                    }
                                
                                
                                Severity: Major
                                Found in tcms/static/js/simplemde_security_override.js - About 2 hrs to fix

                                  File models.py has 266 lines of code (exceeds 250 allowed). Consider refactoring.
                                  Open

                                  # -*- coding: utf-8 -*-
                                  from datetime import timedelta
                                  
                                  import vinaigrette
                                  from django.conf import settings
                                  Severity: Minor
                                  Found in tcms/testcases/models.py - About 2 hrs to fix

                                    File testexecution.py has 266 lines of code (exceeds 250 allowed). Consider refactoring.
                                    Open

                                    # -*- coding: utf-8 -*-
                                    
                                    from django.conf import settings
                                    from django.forms.models import model_to_dict
                                    from django.utils import timezone
                                    Severity: Minor
                                    Found in tcms/rpc/api/testexecution.py - About 2 hrs to fix

                                      Function clean has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                          def clean(self, value):
                                              """
                                              Form-validation:  accept a string/integer.
                                              Looks at both email address and real name.
                                              """
                                      Severity: Minor
                                      Found in tcms/core/forms/fields.py - About 2 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

                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language