tobyqin/testcube

View on GitHub

Showing 21 of 96 total issues

File views.py has 597 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import re
from datetime import datetime, timezone, timedelta

from django.db.models import Q
from ipware.ip import get_ip
Severity: Major
Found in testcube/core/api/views.py - About 1 day to fix

    Function renderRunDetailChart has 108 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function renderRunDetailChart() {
            if (window.app.runList === undefined
                || window.app.summaryInfo === undefined
                || window.app.summaryInfo.result_total === 0) {
                loadingCompleted();
    Severity: Major
    Found in testcube/static/modules/chart-support.js - About 4 hrs to fix

      Function renderResultDetailChart has 98 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function renderResultDetailChart(callback) {
              if (window.app.resultHistory === undefined
                  || window.app.summaryInfo === undefined) {
                  loadingCompleted();
                  return;
      Severity: Major
      Found in testcube/static/modules/chart-support.js - About 3 hrs to fix

        File chart-support.js has 261 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        define(['moment', 'c3', 'd3', './utils'], function (moment, c3, d3, utils) {
        
            "use strict";
            let config = {};
        
        
        Severity: Minor
        Found in testcube/static/modules/chart-support.js - About 2 hrs to fix

          Function handler has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
          Open

              def handler(self, request, pk=None):
                  """
                  Handle single reset result.
                  1. update current reset result with provided info.
                  2. create error object if required.
          Severity: Minor
          Found in testcube/core/api/views.py - About 2 hrs 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 resultDetailSummaryPostEvent has 52 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  function resultDetailSummaryPostEvent(data) {
                      if (data[0] === undefined) return;
                      let result = data[0];
                      let stderr = "Nothing found.";
                      let stdout = "Nothing found.";
          Severity: Major
          Found in testcube/static/modules/result-detail.js - About 2 hrs to fix

            Function runDetailSummaryPostEvent has 51 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    function runDetailSummaryPostEvent(data) {
                        if (data[0] === undefined) return;
            
                        let run = data[0];
                        let nav = `${run.id} - ${run.name}`;
            Severity: Major
            Found in testcube/static/modules/run-detail.js - About 2 hrs to fix

              Function renderRunCoverageChart has 36 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  function renderRunCoverageChart(runId, callback) {
                      require(['jquery'], function ($) {
                          $.getJSON('/api/runs/' + runId + '/tags/', function (data) {
                              let counts = ['counts'];
                              let tags = [];
              Severity: Minor
              Found in testcube/static/modules/chart-support.js - About 1 hr to fix

                Function start has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                    def start(self, request):
                        """client api to start a run, `example` as reference."""
                        example = {
                            'name': 'your run name',
                            'owner': 'run owner, default => current user',
                Severity: Minor
                Found in testcube/core/api/views.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 caseTagsEvent has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        function caseTagsEvent(id) {
                            function tagsAction(event, data) {
                                $.ajax({
                                    url: '/api/cases/' + id + '/tags/',
                                    type: 'post',
                Severity: Minor
                Found in testcube/static/modules/case-detail.js - About 1 hr to fix

                  Function result_reset has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def result_reset(request, result_id):
                      """POST view for result reset"""
                      result_id = int(result_id)
                  
                      if request.method == 'POST':
                  Severity: Minor
                  Found in testcube/core/views.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 result_analysis has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def result_analysis(request, result_id):
                      """POST view for result analysis"""
                      result_id = int(result_id)
                  
                      if request.method == 'POST':
                  Severity: Minor
                  Found in testcube/core/views.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 save has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def save(self, result_id, username):
                          """
                          to save the analysis form, we will:
                          1. create analysis object then link to result id
                          2. create issue object if issue id was added
                  Severity: Minor
                  Found in testcube/core/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 signin has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def signin(request):
                      if request.user.is_authenticated:
                          return to_next_page(request)
                  
                      if request.method == 'POST':
                  Severity: Minor
                  Found in testcube/users/views.py - About 55 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 clear has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def clear(self, request):
                          """clear dead runs, will be called async when user visit run list."""
                          pending_runs = TestRun.objects.filter(state__lt=2)  # not ready, starting, running
                          fixed = []
                  
                  
                  Severity: Minor
                  Found in testcube/core/api/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 register has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def register(request):
                      """To register a new client, must provide a token"""
                      if request.method == 'POST':
                          data = request.POST
                          client_type = data.get('client_type')
                  Severity: Minor
                  Found in testcube/core/api/client_auth.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 tags has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def tags(self, request, pk=None):
                          """query result tags"""
                          from tagging.models import Tag
                          instance = self.get_object()
                  
                  
                  Severity: Minor
                  Found in testcube/core/api/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 new has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def new(self, request):
                          """client api to reset a result, `example` as reference."""
                          example = {
                              'reset_id': 123,
                              'outcome': 'int, 0=passed, 1=failed, 2=skipped, 3=error, 5=pending',
                  Severity: Minor
                  Found in testcube/core/api/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 new has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def new(self, request):
                          """client api to create a result, `example` as reference"""
                          example = {
                              'run_id': 123,
                              'outcome': 'int, 0=passed, 1=failed, 2=skipped, 3=error, 5=pending',
                  Severity: Minor
                  Found in testcube/core/api/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 stop has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def stop(self, request):
                          """client api to stop a run, `example` as reference."""
                          example = {
                              'run_id': 123,
                              'state': 'int, default 3=>completed, (2=aborted)',
                  Severity: Minor
                  Found in testcube/core/api/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

                  Severity
                  Category
                  Status
                  Source
                  Language