renatomefidf/sammui

View on GitHub

Showing 29 of 44 total issues

Method excelAction has 140 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function excelAction($protocolId, $lang)
    {
        $this->languageKey = $lang;

        $protocol = $this->getProtocol($protocolId);
Severity: Major
Found in src/Renatomefi/FormBundle/Controller/ProtocolExportController.php - About 5 hrs to fix

    File protocolControllers.js has 400 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    'use strict';
    
    angular.module('sammui.protocolControllers', ['ngRoute'])
        .controller('formFillingMain', ['$rootScope', '$scope', '$route', '$routeParams', '$location', 'formProtocolManage', 'protocolData', 'formProtocolLock',
            function ($rootScope, $scope, $route, $routeParams, $location, formProtocolManage, protocolData, formProtocolLock) {

      Protocol has 36 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class Protocol
      {
          /**
           * Setting up ODM Document
           */
      Severity: Minor
      Found in src/Renatomefi/FormBundle/Document/Protocol.php - About 4 hrs to fix

        Method load has 70 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function load(ObjectManager $manager)
            {
                $documentManager = $this->container->get('doctrine_mongodb.odm.document_manager');
        
                /** @var Form $form */
        Severity: Major
        Found in src/Renatomefi/FormBundle/DataFixtures/MongoDB/LoadFormFields.php - About 2 hrs to fix

          Function getValueInHR has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
          Open

              public function getValueInHR()
              {
                  $value = $this->value;
                  $opts = $this->getField()->getOptions();
                  $isMulti = (count($opts) > 0);
          Severity: Minor
          Found in src/Renatomefi/FormBundle/Document/ProtocolFieldValue.php - 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

          ManageControllerTest has 21 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class ManageControllerTest extends WebTestCase implements AssertRestUtilsInterface, AssertMongoUtilsInterface, AssertLangInterface, OAuthClientInterface
          {
          
              use AssertMongoUtils, AssertRestUtils, AssertLang, OAuthClient;
          
          

            Function patchFieldsSaveAction has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
            Open

                public function patchFieldsSaveAction(Request $request, $protocolId)
                {
                    $odm = $this->get('doctrine_mongodb')->getManager();
            
                    $protocol = $this->getProtocol($protocolId);
            Severity: Minor
            Found in src/Renatomefi/FormBundle/Controller/ProtocolController.php - 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 excelAction has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
            Open

                public function excelAction($protocolId, $lang)
                {
                    $this->languageKey = $lang;
            
                    $protocol = $this->getProtocol($protocolId);
            Severity: Minor
            Found in src/Renatomefi/FormBundle/Controller/ProtocolExportController.php - 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

            Method testProtocol has 43 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function testProtocol(Form $form)
                {
                    $formRepo = $this->documentManager->getRepository('FormBundle:Form');
                    $formObj = $formRepo->find($form->getId());
            
            
            Severity: Minor
            Found in src/Renatomefi/FormBundle/Tests/DocumentsTest.php - About 1 hr to fix

              Function checkDependenciesSatisfied has 38 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      $scope.checkDependenciesSatisfied = function () {
                          if ($scope.controllerReady === false) {
                              return true;
                          }
              
              

                Method patchFieldsSaveAction has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function patchFieldsSaveAction(Request $request, $protocolId)
                    {
                        $odm = $this->get('doctrine_mongodb')->getManager();
                
                        $protocol = $this->getProtocol($protocolId);
                Severity: Minor
                Found in src/Renatomefi/FormBundle/Controller/ProtocolController.php - About 1 hr to fix

                  Method infoAction has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function infoAction()
                      {
                          $auth = $this->get('security.authorization_checker');
                          $secToken = $this->get('security.token_storage')->getToken();
                          $oauthToken = $this->get('fos_oauth_server.access_token_manager.default');
                  Severity: Minor
                  Found in src/Renatomefi/ApiBundle/Controller/UserController.php - About 1 hr to fix

                    Method registerBundles has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function registerBundles()
                        {
                            $bundles = [
                                new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
                                new Symfony\Bundle\SecurityBundle\SecurityBundle(),
                    Severity: Minor
                    Found in app/AppKernel.php - About 1 hr to fix

                      Function saveFields has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                              $scope.saveFields = function () {
                                  $scope.savingForm = true;
                      
                                  var fieldsToSend = $scope.$parent.protocol.data.form.fields.filter(function (field) {
                                      var fieldValue = null;

                        Method load has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function load(ObjectManager $manager)
                            {
                                $documentManager = $this->container->get('doctrine_mongodb.odm.document_manager');
                        
                                $form = new Form();
                        Severity: Minor
                        Found in src/Renatomefi/FormBundle/DataFixtures/MongoDB/LoadForm.php - About 1 hr to fix

                          Function getData has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                      publicFunctions.getData = function (protocolId) {
                          
                                          if (!currentData[protocolId]) {
                          
                                              currentData[protocolId] = formProtocolManage.get({protocolId: protocolId});

                            Method pdfAction has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function pdfAction($protocolId, $lang)
                                {
                                    $this->languageKey = $lang;
                            
                                    $protocol = $this->getProtocol($protocolId);
                            Severity: Minor
                            Found in src/Renatomefi/FormBundle/Controller/ProtocolExportController.php - About 1 hr to fix

                              Function langKeysTable has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                          $scope.langKeysTable = function (lang, reload) {
                              
                                              lang = lang || $location.search().lang;
                                              reload = reload || false;
                              
                              

                                Method getValueInHR has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    public function getValueInHR()
                                    {
                                        $value = $this->value;
                                        $opts = $this->getField()->getOptions();
                                        $isMulti = (count($opts) > 0);
                                Severity: Minor
                                Found in src/Renatomefi/FormBundle/Document/ProtocolFieldValue.php - About 1 hr to fix

                                  Avoid deeply nested control flow statements.
                                  Open

                                                                  if (field.options[cValue] &&
                                                                      field.value !== null && field.value !== undefined &&
                                                                      Object.getOwnPropertyNames(field.value).length > 0 &&
                                                                      field.value[cValue] === true) {
                                                                      return false;
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language