kiwitcms/Kiwi

View on GitHub

Showing 76 of 346 total issues

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

def update(execution_id, values, **kwargs):
    """
    .. function:: RPC TestExecution.update(execution_id, values)

        Update the selected TestExecution
Severity: Minor
Found in tcms/rpc/api/testexecution.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 ajax has 49 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/testruns/static/testruns/js/search.js - About 1 hr to fix

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

    function drawChart (data, type, selector) {
      const categories = new Set()
      const groups = [[]]
      const chartData = []
    
    
    Severity: Minor
    Found in tcms/telemetry/static/telemetry/js/testing/breakdown.js - About 1 hr to fix

      Function tree_view_html has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

          def tree_view_html(self):
              """
              Returns nested tree structure represented as Patterfly TreeView!
              Relies on the fact that tree nodes are returned in DFS
              order!
      Severity: Minor
      Found in tcms/testplans/models.py - About 1 hr 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 execution_trends has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

      def execution_trends(query=None):
      
          if query is None:
              query = {}
      
      
      Severity: Minor
      Found in tcms/telemetry/api.py - About 1 hr 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 ajax has 43 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/testcases/static/testcases/js/search.js - About 1 hr to fix

        Function loadBugs has 43 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function loadBugs (selector, filter) {
          const noRecordsFoundText = $('.bugs-table').data('no-records-found-text')
        
          $(selector).DataTable({
            ajax: (data, callback, settings) => {
        Severity: Minor
        Found in tcms/static/js/bugs.js - About 1 hr to fix

          Function quickSearchAndAddTestCase has 41 lines of code (exceeds 25 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 1 hr to fix

            Function preProcessData has 39 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function preProcessData (data, callback) {
              const caseIds = []
              data.forEach(function (element) {
                caseIds.push(element.id)
              })
            Severity: Minor
            Found in tcms/testcases/static/testcases/js/search.js - About 1 hr to fix

              Function hookIntoPagination has 38 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function hookIntoPagination (tableSelector, table) {
                const updateCurrentPage = function (table) {
                  const info = table.page.info()
                  $('.current-page').val(info.page + 1)
                  $('.total-pages').html(info.pages)
              Severity: Minor
              Found in tcms/static/js/pagination.js - About 1 hr to fix

                Function getTestCaseRowContent has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function getTestCaseRowContent (rowContent, testCase, permissions) {
                  const row = $(rowContent)
                
                  row[0].firstElementChild.dataset.testcasePk = testCase.id
                  row.find('.js-test-case-link').html(`TC-${testCase.id}: ${testCase.summary}`).attr('href', `/case/${testCase.id}/`)
                Severity: Minor
                Found in tcms/testplans/static/testplans/js/get.js - About 1 hr to fix

                  Function applyStyleToCell has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function applyStyleToCell (cell) {
                    const cellElement = cell[1]
                    if (cellElement) {
                      const cellChildren = cellElement.children
                      if (cellChildren) {
                  Severity: Minor
                  Found in tcms/telemetry/static/telemetry/js/testing/status-matrix.js - About 1 hr 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 addLinkToExecutions has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function addLinkToExecutions (testExecutionIDs) {
                    // remove all previous event handlers
                    $('.add-hyperlink-form').off('submit')
                  
                    // this handler must be here, because if we bind it when the page is loaded.
                  Severity: Minor
                  Found in tcms/testruns/static/testruns/js/get.js - About 1 hr to fix

                    Function preProcessData has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function preProcessData (data, callback) {
                      const runIds = []
                      const planIds = []
                      data.forEach(function (element) {
                        runIds.push(element.id)
                    Severity: Minor
                    Found in tcms/testruns/static/testruns/js/search.js - About 1 hr to fix

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

                          ajax: function (data, callback, settings) {
                            const params = {}
                      
                            if ($('#id_name').val()) {
                              params.name__icontains = $('#id_name').val()
                      Severity: Minor
                      Found in tcms/testplans/static/testplans/js/search.js - About 1 hr to fix

                        Function drawPage has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        function drawPage () {
                          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 parse_translation_string has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def parse_translation_string(self, filename, lines):
                                  startline = 0
                                  startcol = 0
                                  blocktrans_string = ""
                          
                          
                          Severity: Minor
                          Found in kiwi_lint/similar_string.py - About 1 hr 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 create_permissions has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                          Open

                          def create_permissions(
                              app_config,
                              verbosity=2,
                              interactive=True,
                              using=DEFAULT_DB_ALIAS,
                          Severity: Minor
                          Found in tcms/bugs/management.py - About 1 hr 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 filterTestExecutionsByProperty has a Cognitive Complexity of 10 (exceeds 5 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

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

                              def visit_call(self, node):
                                  if node.func.as_string().endswith("Field") and node.keywords:
                                      for keyword in node.keywords:
                                          if keyword.arg == "label":
                                              self.add_message("form-field-label-used", node=node)
                          Severity: Minor
                          Found in kiwi_lint/forms.py - About 1 hr 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