kiwitcms/Kiwi

View on GitHub

Showing 112 of 403 total issues

Function initializePage has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

export function initializePage () {
    table = $('#test-case-health-table').DataTable({
        ajax: function (data, callback, settings) {
            const query = {}

Severity: Minor
Found in tcms/telemetry/static/telemetry/js/testing/test-case-health.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 loadBugs has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export 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

    export 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 tree_view_html has a Cognitive Complexity of 13 (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 preProcessData has 39 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function preProcessData (data, callbackF) {
          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 ajax has 38 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                ajax: function (data, callbackF, settings) {
                    const query = {}
        
                    const productIds = $('#id_product').val()
                    if (productIds.length) {
        Severity: Minor
        Found in tcms/telemetry/static/telemetry/js/testing/execution-dashboard.js - About 1 hr to fix

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

          export function pageTestcasesMutableReadyHandler () {
              $('#id_template').change(function () {
                  window.markdownEditor.codemirror.setValue($(this).val())
              })
          
          
          Severity: Minor
          Found in tcms/testcases/static/testcases/js/mutable.js - About 1 hr to fix

            Function pageTelemetryReadyHandler has 37 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export function pageTelemetryReadyHandler (pageId) {
                initializeDateTimePicker('#id_before')
                initializeDateTimePicker('#id_after')
            
                const drawChart = {
            Severity: Minor
            Found in tcms/telemetry/static/telemetry/js/index.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 pageTestplansGetReadyHandler has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export function pageTestplansGetReadyHandler () {
                    const testPlanDataElement = $('#test_plan_pk')
                    const testPlanId = testPlanDataElement.data('testplan-pk')
                
                    const permissions = {
                Severity: Minor
                Found in tcms/testplans/static/testplans/js/get.js - About 1 hr to fix

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

                        def property_matrix(properties, _type="full"):
                            """
                            Return a sequence of tuples representing the property matrix!
                            """
                            property_groups = OrderedDict()
                    Severity: Minor
                    Found in tcms/testruns/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 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 clone has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def clone(self, new_author, test_plans):
                            values = self.__dict__.copy()
                            del values["_state"]
                            del values["id"]
                            if "sortkey" in values:
                    Severity: Minor
                    Found in tcms/testcases/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 create_execution has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def create_execution(  # pylint: disable=too-many-arguments,too-many-positional-arguments
                            self,
                            case,
                            assignee=None,
                            build=None,
                    Severity: Minor
                    Found in tcms/testruns/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 deny_uploads_containing_script_tag has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def deny_uploads_containing_script_tag(uploaded_file):
                        for chunk in uploaded_file.chunks(2048):
                            for tag_name in generally_xss_unsafe:
                                if chunk.lower().find(b"<" + tag_name.encode()) > -1:
                                    raise ValidationError(_(f"File contains forbidden tag: <{tag_name}>"))
                    Severity: Minor
                    Found in tcms/kiwi_attachments/validators.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 testPlanAutoComplete has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export function testPlanAutoComplete (selector, planCache) {
                        $(`${selector}.typeahead`).typeahead({
                            minLength: 1,
                            highlight: true
                        }, {
                    Severity: Minor
                    Found in tcms/static/js/jsonrpc.js - About 1 hr to fix

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

                                ajax: function (data, callback, settings) {
                                    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 filterTestExecutionsByProperty has 30 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()
                                  $('.test-executions-count').text(executions.length)
                          Severity: Minor
                          Found in tcms/testruns/static/testruns/js/get.js - About 1 hr to fix
                            Severity
                            Category
                            Status
                            Source
                            Language