kiwitcms/Kiwi

View on GitHub

Showing 76 of 347 total issues

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

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

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

        def post(self, request):
            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

    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 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

      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 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

      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 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

      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 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

      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 6 (exceeds 5 allowed). Consider refactoring.
      Open

      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 25 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 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

      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 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def post(self, request):
              form = NewRunForm(data=request.POST)
              form.populate(request.POST.get("plan"))
      
              if form.is_valid():
      Severity: Minor
      Found in tcms/testruns/views.py - About 25 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 drawPage has a Cognitive Complexity of 6 (exceeds 5 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 25 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

      Severity
      Category
      Status
      Source
      Language