kiwitcms/Kiwi

View on GitHub

Showing 109 of 405 total issues

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

        def save_model(self, request, obj, form, change):
            super().save_model(request, obj, form, change)
            # try health check
            bug_url = form.cleaned_data["hc_bug_url"]
            if bug_url:
    Severity: Minor
    Found in tcms/testcases/admin.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

    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 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 update has a Cognitive Complexity of 8 (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 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 updateSelect has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    export function updateSelect (data, selector, idAttr, valueAttr, groupAttr) {
    Severity: Minor
    Found in tcms/static/js/utils.js - About 35 mins to fix

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

      export function addPropertyValue (objectId, objectAttrName, viewMethod, addMethod, removeMethod) {
      Severity: Minor
      Found in tcms/static/js/properties.js - About 35 mins to fix

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

        def assign_default_group_permissions(
        Severity: Minor
        Found in tcms/utils/permissions.py - About 35 mins to fix

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

          export function propertiesCard (objectId, objectAttrName, viewMethod, addMethod, removeMethod) {
          Severity: Minor
          Found in tcms/static/js/properties.js - About 35 mins to fix

            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

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

                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

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

                def update(case_id, values):
                    """
                    .. function:: RPC TestCase.update(case_id, values)
                
                        Update the fields of the selected test case.
                Severity: Minor
                Found in tcms/rpc/api/testcase.py - About 35 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 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    def clone(  # pylint: disable=too-many-arguments
                        self,
                        name=None,
                        product=None,
                        version=None,
                Severity: Minor
                Found in tcms/testplans/models.py - About 35 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 diff_objects has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                def diff_objects(old_instance, new_instance, fields):
                    """
                    Diff two objects by examining the given fields and
                    return a string.
                    """
                Severity: Minor
                Found in tcms/core/history.py - About 35 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 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

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

                    def visit_attribute(self, node):
                        # looking for .extra(select={}) patterns
                        if node.attrname == "extra" and isinstance(node.parent, astroid.Call):
                            for keyword in node.parent.keywords:
                                if keyword.arg in [
                Severity: Minor
                Found in kiwi_lint/raw_sql.py - About 35 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 post has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    def post(self, request):  # pylint: disable=no-self-use
                        form = BugCommentForm(request.POST)
                        request_action = request.POST.get("action")
                
                        if form.is_valid():
                Severity: Minor
                Found in tcms/bugs/views.py - About 35 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 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

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

                def assign_default_group_permissions(
                    output=None,
                    refresh_all=False,
                    group_model=Group,
                    admin_permissions_filter=None,
                Severity: Minor
                Found in tcms/utils/permissions.py - About 35 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

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