kiwitcms/Kiwi

View on GitHub

Showing 113 of 404 total issues

Function selectedPlanIds has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

function selectedPlanIds () {
const selectedIds = $('#id_test_plan').val()
const childIds = []
 
// search for children of each selected TP
Severity: Minor
Found in tcms/testcases/static/testcases/js/search.js - About 35 mins to fix

Function drawChart has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

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

Function getTestCaseRowContent has a Cognitive Complexity of 7 (exceeds 5 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 35 mins to fix

Avoid too many return statements within this function.
Open

return HttpResponseRedirect(request.META.get("HTTP_REFERER", "/"))
Severity: Major
Found in tcms/testcases/views.py - About 30 mins to fix

    Function open has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    def open(self):
    for rootpath, _dirs, files in os.walk(self.project_root, topdown=False):
    for file_name in files:
    if file_name.endswith((".html", ".txt")):
    self.all_template_files.add(
    Severity: Minor
    Found in kiwi_lint/similar_string.py - About 25 mins to fix

    Function get_case_notification_recipients has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    def get_case_notification_recipients(case):
    recipients = set()
     
    if case.emailing.auto_to_case_author:
    recipients.add(case.author.email)
    Severity: Minor
    Found in tcms/testcases/helpers/email.py - About 25 mins to fix

    Function dumps_result has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    def dumps_result(self, result: JsonResult) -> str:
    if isinstance(result, JsonSuccessResult):
    if isinstance(result.data, str):
    result.data = html.escape(result.data)
    elif isinstance(result.data, timedelta):
    Severity: Minor
    Found in tcms/handlers.py - About 25 mins to fix

    Function request_host_link has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    def request_host_link(request, domain_name=None):
    protocol = "https://"
    if "runserver" in sys.argv:
    protocol = "http://"
     
     
    Severity: Minor
    Found in tcms/core/utils/__init__.py - About 25 mins to fix

    Function drawPercentBar has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    function drawPercentBar (testExecutions, updateTestRun = false) {
    let positiveCount = 0
    let negativeCount = 0
    const allCount = testExecutions.length
    const statusCount = {}
    Severity: Minor
    Found in tcms/testruns/static/testruns/js/get.js - About 25 mins to fix

    Function get_fieldsets has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    def get_fieldsets(self, request, obj=None):
    # adding new account b/c we have permissions
    if not obj and self.has_add_permission(request):
    return super().get_fieldsets(request, obj)
     
     
    Severity: Minor
    Found in tcms/kiwi_auth/admin.py - About 25 mins to fix

    Function get_install_requires has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    def get_install_requires(path):
    requires = []
    links = []
     
    with open(path, "r", encoding="utf-8") as file:
    Severity: Minor
    Found in setup.py - About 25 mins to fix

    Function updateBuildSelectFromVersion has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    export function updateBuildSelectFromVersion (keepFirst) {
    const updateCallback = function (data) {
    updateSelect(data, '#id_build', 'id', 'name', 'version__value')
    }
     
     
    Severity: Minor
    Found in tcms/static/js/utils.js - About 25 mins to fix

    Function add_link has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    def add_link(values, update_tracker=False, **kwargs):
    """
    .. function:: RPC TestExecution.add_link(values)
     
    Add new URL link to a TestExecution
    Severity: Minor
    Found in tcms/rpc/api/testexecution.py - About 25 mins to fix
    Severity
    Category
    Status
    Source
    Language