kiwitcms/Kiwi

View on GitHub

Showing 148 of 407 total issues

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

      export function pageTestrunsMutableReadyHandler () {
          initializeDateTimePicker('#id_planned_start')
          initializeDateTimePicker('#id_planned_stop')
      
          $('#add_id_product').click(function () {
      Severity: Minor
      Found in tcms/testruns/static/testruns/js/mutable.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 pageTestplansMutableReadyHandler has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export function pageTestplansMutableReadyHandler () {
              if ($('#id_version').find('option').length === 0) {
                  populateVersion()
              }
          
          
          Severity: Minor
          Found in tcms/testplans/static/testplans/js/mutable.js - About 1 hr to fix

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

            function preProcessData (data, callbackF) {
                const runIds = []
                const productIds = []
                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 pageBugsMutableReadyHandler has 29 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export function pageBugsMutableReadyHandler () {
                  $('#add_id_product').click(function () {
                      return showRelatedObjectPopup(this)
                  })
              
              
              Severity: Minor
              Found in tcms/bugs/static/bugs/js/mutable.js - About 1 hr to fix

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

                        ajax: function (data, callbackF, 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 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 drawTable has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                  export function drawTable () {
                      $('.js-spinner').show()
                      if (table) {
                          table.destroy()
                  
                  
                  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 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 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

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

                  export 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 renderTestExecutionRow has 27 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 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 jsonRPC has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export 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
                          Severity
                          Category
                          Status
                          Source
                          Language