renatomefidf/sammui

View on GitHub

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

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

                          if (!$scope.forms.data && reload === false) {
                              $scope.forms.loading = true;
                              formList.query({},
                                  function (data) {
                                      $scope.forms.data = data;
          src/Renatomefi/FormBundle/Resources/public/angular/form/controllers/formControllers.js on lines 14..23

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 84.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

                      $scope.loadForms = function () {
                          $scope.forms.loading = true;
          
                          formList.query({},
                              function (data) {
          src/Renatomefi/FormBundle/Resources/public/angular/form/controllers/formAdminControllers.js on lines 16..24

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 84.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

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

                Identical blocks of code found in 3 locations. Consider refactoring.
                Open

                            return $http.post('/oauth/v2/token',
                                {
                                    client_id: oAuthClientId,
                                    client_secret: oAuthClientSecret,
                                    refresh_token: refreshToken,
                src/Renatomefi/ApiBundle/Resources/public/angular/api/services/authServices.js on lines 191..206
                src/Renatomefi/ApiBundle/Resources/public/angular/api/services/authServices.js on lines 213..230

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 64.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Identical blocks of code found in 3 locations. Consider refactoring.
                Open

                            $http.post('/oauth/v2/token',
                                {
                                    client_id: oAuthClientId,
                                    client_secret: oAuthClientSecret,
                                    grant_type: 'client_credentials'
                src/Renatomefi/ApiBundle/Resources/public/angular/api/services/authServices.js on lines 161..177
                src/Renatomefi/ApiBundle/Resources/public/angular/api/services/authServices.js on lines 213..230

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 64.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Identical blocks of code found in 3 locations. Consider refactoring.
                Open

                            return $http.post('/oauth/v2/token',
                                {
                                    client_id: oAuthClientId,
                                    client_secret: oAuthClientSecret,
                                    username: data.username,
                src/Renatomefi/ApiBundle/Resources/public/angular/api/services/authServices.js on lines 161..177
                src/Renatomefi/ApiBundle/Resources/public/angular/api/services/authServices.js on lines 191..206

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 64.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

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