kiwitcms/Kiwi

View on GitHub

Showing 76 of 346 total issues

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

    ajax: function (data, callback, settings) {
      const params = {}

      if ($('#id_summary').val()) {
        params.summary__icontains = $('#id_summary').val()
Severity: Minor
Found in tcms/bugs/static/bugs/js/search.js - About 1 hr to fix

    Function advancedSearchAndAddTestCases has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function advancedSearchAndAddTestCases (objId, rpcMethod, href, errorMessage) {
      window.addTestCases = function (testCaseIDs, sender) {
        let rpcErrors = 0
    
        // close the popup
    Severity: Minor
    Found in tcms/static/js/utils.js - About 1 hr to fix

      Function filterTestExecutionsByProperty has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function filterTestExecutionsByProperty (runId, executions, filterBy, filterValue) {
        // no input => show all rows
        if (filterValue.trim().length === 0) {
          $('.test-execution-element').show()
          return
      Severity: Minor
      Found in tcms/testruns/static/testruns/js/get.js - About 1 hr to fix

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

        function renderTestExecutionRow (testExecution) {
          // refresh the internal data structure b/c some fields are used
          // to render the expand area and may have changed via bulk-update meanwhile
          testExecution.status__name = $('#test_run_pk').data(`trans-execution-status-${testExecution.status}`)
          allExecutions[testExecution.id] = testExecution
        Severity: Minor
        Found in tcms/testruns/static/testruns/js/get.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 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 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

                Function drawTable has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                function drawTable () {
                  if (table) {
                    table.destroy()
                
                    $('table > thead > tr > th:not(.header)').remove()
                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

                Function clone has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    def clone(self, new_author, test_plans):
                        values = self.__dict__.copy()
                        del values["_state"]
                        del values["id"]
                        values["case_status_id"] = (
                Severity: Minor
                Found in tcms/testcases/models.py - 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

                Function initAddPlan has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                function initAddPlan (caseId, plansTable) {
                  // + button
                  $('#btn-add-plan').click(function () {
                    addTestPlanToTestCase(caseId, plansTable)
                  })
                Severity: Minor
                Found in tcms/testcases/static/testcases/js/get.js - About 45 mins to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Function _url_view_mapping has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    def _url_view_mapping(cls, root_urlpatterns):
                        def flatten(urlpatterns, prefix="^", result=None):
                            """
                            Flattens the url graph
                
                
                Severity: Minor
                Found in kiwi_lint/views.py - About 45 mins to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Function mailto has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                def mailto(  # pylint: disable=invalid-name
                Severity: Minor
                Found in tcms/core/utils/mailto.py - About 45 mins to fix

                  Function mailto has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def mailto(  # pylint: disable=invalid-name
                      template_name,
                      subject,
                      recipients=None,
                      context=None,
                  Severity: Minor
                  Found in tcms/core/utils/mailto.py - About 45 mins to fix

                  Cognitive Complexity

                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                  A method's cognitive complexity is based on a few simple rules:

                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                  • Code is considered more complex for each "break in the linear flow of the code"
                  • Code is considered more complex when "flow breaking structures are nested"

                  Further reading

                  Function quickSearchAndAddTestCase has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function quickSearchAndAddTestCase (objId, pageCallback, cache, initialQuery = {}) {
                    // + button
                    $('#btn-add-case').click(function () {
                      pageCallback(objId)
                  
                  
                  Severity: Minor
                  Found in tcms/static/js/utils.js - About 45 mins to fix

                  Cognitive Complexity

                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                  A method's cognitive complexity is based on a few simple rules:

                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                  • Code is considered more complex for each "break in the linear flow of the code"
                  • Code is considered more complex when "flow breaking structures are nested"

                  Further reading

                  Function render_change_form has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      def render_change_form(
                  Severity: Minor
                  Found in tcms/kiwi_auth/admin.py - About 45 mins to fix

                    Function create_permissions has 6 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                    def create_permissions(
                    Severity: Minor
                    Found in tcms/bugs/management.py - About 45 mins to fix

                      Function post has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def post(self, request):
                              if not self._is_request_data_valid(request):
                                  return HttpResponseRedirect(request.META.get("HTTP_REFERER", "/"))
                      
                              # Do the clone action
                      Severity: Minor
                      Found in tcms/testcases/views.py - About 45 mins to fix

                      Cognitive Complexity

                      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                      A method's cognitive complexity is based on a few simple rules:

                      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                      • Code is considered more complex for each "break in the linear flow of the code"
                      • Code is considered more complex when "flow breaking structures are nested"

                      Further reading

                      Function advancedSearchAndAddTestCases has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function advancedSearchAndAddTestCases (objId, rpcMethod, href, errorMessage) {
                        window.addTestCases = function (testCaseIDs, sender) {
                          let rpcErrors = 0
                      
                          // close the popup
                      Severity: Minor
                      Found in tcms/static/js/utils.js - About 45 mins to fix

                      Cognitive Complexity

                      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                      A method's cognitive complexity is based on a few simple rules:

                      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                      • Code is considered more complex for each "break in the linear flow of the code"
                      • Code is considered more complex when "flow breaking structures are nested"

                      Further reading

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

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

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

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