erikvw/django-collect-offline

View on GitHub

Showing 24 of 75 total issues

File 0001_initial.py has 500 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# Generated by Django 2.0.6 on 2018-07-03 10:45

import _socket
from django.db import migrations, models
import django.db.models.deletion
Severity: Minor
Found in django_collect_offline/migrations/0001_initial.py - About 1 day to fix

    Function processOutgoingTransactions has 62 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function processOutgoingTransactions( host, userName ) {
        /* 
        Process each OutgoingTransaction one at a time.
        Requests are chained: 
            1. GET outgoingtransaction from host;
    Severity: Major
    Found in django_collect_offline/static/django_offline/js/edc_sync.js - About 2 hrs to fix

      Function processIncomingTransactions has 49 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function processIncomingTransactions( homeUrl, userName ) {
          /*
          Process each IncomingTransaction one at a time.
          Requests are chained: 
              1. GET incoming from server;
      Severity: Minor
      Found in django_collect_offline/static/django_offline/js/edc_sync.js - About 1 hr to fix

        Function processPendingFiles has 40 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function processPendingFiles() {
            var url = client + '/django_collect_offline/';
            var ajPendingFiles = $.ajax({
                url: url,
                type: 'GET',
        Severity: Minor
        Found in django_collect_offline/static/django_offline/js/file_transfer.js - About 1 hr to fix

          Function exportBatch has 37 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function exportBatch(server , userName) {
              var url = client + '/django_collect_offline/';
              var ajExportBatch = $.ajax({
                  url: url,
                  type: 'GET',
          Severity: Minor
          Found in django_collect_offline/static/django_offline/js/file_transfer.js - About 1 hr to fix

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

            function loadUsbTransactionFile(server , userName) {
                var url = client + '/django_collect_offline/dump-to-usb/';
                var ajloadFile = $.ajax({
                    url: url,
                    type: 'GET',
            Severity: Minor
            Found in django_collect_offline/static/django_offline/js/middleman.js - About 1 hr to fix

              Function register has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                  def register(self, models=None, wrapper_cls=None):
                      """Registers with app_label.modelname, wrapper_cls.
                      """
                      if get_offline_enabled():
                          self.loaded = True
              Severity: Minor
              Found in django_collect_offline/site_offline_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 autodiscover has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                  def autodiscover(self, module_name=None):
                      module_name = module_name or self.module_name
                      sys.stdout.write(" * checking for models to register ...\n")
                      for app in django_apps.app_configs:
                          try:
              Severity: Minor
              Found in django_collect_offline/site_offline_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 edcSyncReady has 35 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function edcSyncReady(server, userName, apiToken) {
                  /* Prepare page elements */
                  var csrftoken = Cookies.get('csrftoken');
                  
                  // configure AJAX header with csrf and authorization tokens
              Severity: Minor
              Found in django_collect_offline/static/django_offline/js/file_transfer.js - About 1 hr to fix

                Function sendTransactionFile has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function sendTransactionFile(file) {
                    /*
                        Send a file transaction to node server or central server.
                    */
                    var url = client + '/django_collect_offline/';
                Severity: Minor
                Found in django_collect_offline/static/django_offline/js/file_transfer.js - About 1 hr to fix

                  Function edcSyncReady has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function edcSyncReady(hosts, userName, apiToken, homeUrl) {
                      /* Prepare page elements */
                      var hosts = JSON.parse( hosts );
                      var csrftoken = Cookies.get('csrftoken');
                  
                  
                  Severity: Minor
                  Found in django_collect_offline/static/django_offline/js/edc_sync.js - About 1 hr to fix

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

                    function checkUSBConnectivity(server , userName) {
                        var url = client + '/django_collect_offline/dump-to-usb/';
                        var checkUSBConnection = $.ajax({
                            url: url,
                            type: 'GET',
                    Severity: Minor
                    Found in django_collect_offline/static/django_offline/js/middleman.js - About 1 hr to fix

                      Function dumpTransactionMiddlemanFile has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function dumpTransactionMiddlemanFile(server , userName) {
                      
                          var url = client + '/django_collect_offline/dump-to-usb/';
                          var ajDumpFile = $.ajax({
                              url: url,
                      Severity: Minor
                      Found in django_collect_offline/static/django_offline/js/middleman.js - About 1 hr to fix

                        Function edcSyncUSBReady has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        function edcSyncUSBReady(server, userName, apiToken) {
                            /* Prepare page elements */
                            var csrftoken = Cookies.get('csrftoken');
                            
                            // configure AJAX header with csrf and authorization tokens
                        Severity: Minor
                        Found in django_collect_offline/static/django_offline/js/middleman.js - About 1 hr to fix

                          Function __init__ has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def __init__(self):
                                  self.report_data = []
                                  for client in Client.objects.all():
                                      try:
                                          self.history_model.objects.get(
                          Severity: Minor
                          Found in django_collect_offline/views/sync_report_client_view.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 serialize_on_save has 6 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                          def serialize_on_save(sender, instance, raw, created, using, **kwargs):
                          Severity: Minor
                          Found in django_collect_offline/models/signals.py - About 45 mins to fix

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

                            def create_auth_token(sender, instance, raw, created, **kwargs):
                            Severity: Minor
                            Found in django_collect_offline/models/signals.py - About 35 mins to fix

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

                                  def __init__(self, order_by=None, model=None, batch=None, producer=None, **kwargs):
                              Severity: Minor
                              Found in django_collect_offline/management/commands/deserialize.py - About 35 mins to fix

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

                                def serialize_m2m_on_save(sender, action, instance, using, **kwargs):
                                Severity: Minor
                                Found in django_collect_offline/models/signals.py - About 35 mins to fix

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

                                  function makePageElements ( divId, host, resourceName, listUrl, userName ) {
                                  Severity: Minor
                                  Found in django_collect_offline/static/django_offline/js/edc_sync.js - About 35 mins to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language