antaresproject/core

View on GitHub

Showing 265 of 306 total issues

File Builder.php has 539 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/**
 * Part of the Antares package.
 *
Severity: Major
Found in src/ui/components/datatables/src/Html/Builder.php - About 1 day to fix

    Function action has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function action($command)
        {
            // make sure we don't compress "a + ++b" to "a+++b", etc.
            if ($command === self::ACTION_DELETE_A_B && $this->b === ' ' && ($this->a === '+' || $this->a === '-')) {
                // Note: we're at an addition/substraction operator; the inputIndex
    Severity: Minor
    Found in src/utils/asset/src/JSMin.php - About 1 day 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

    File helpers.php has 470 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    /**
     * Part of the Antares package.
     *
    Severity: Minor
    Found in src/foundation/src/helpers.php - About 7 hrs to fix

      Method getFunctions has 181 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function getFunctions()
          {
              return [
                  new Twig_SimpleFunction('memorize', function ($key, $default = null) {
                              return app('antares.platform.memory')->get($key, $default);
      Severity: Major
      Found in src/utils/twig/Extension/Foundation.php - About 7 hrs to fix

        BaseEngine has 48 functions (exceeds 20 allowed). Consider refactoring.
        Open

        abstract class BaseEngine implements DataTableEngineContract
        {
        
            /**
             * Datatables Request object.
        Severity: Minor
        Found in src/ui/components/datatables/src/Engines/BaseEngine.php - About 6 hrs to fix

          File BaseEngine.php has 407 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
          
          /**
           * Part of the Antares package.
           *
          Severity: Minor
          Found in src/ui/components/datatables/src/Engines/BaseEngine.php - About 5 hrs to fix

            Function getClientIP has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
            Open

                public function getClientIP()
                {
                    if (getenv('HTTP_CLIENT_IP')) {
                        $ipaddress = getenv('HTTP_CLIENT_IP');
                    } else if (getenv('HTTP_X_FORWARDED_FOR')) {
            Severity: Minor
            Found in src/utils/geoip/src/GeoIP.php - About 5 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

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

            class Builder extends BaseBuilder
            {
            
                /**
                 * defered data
            Severity: Minor
            Found in src/ui/components/datatables/src/Html/Builder.php - About 4 hrs to fix

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

              class User extends Eloquent implements UserContract, CanResetPasswordContract, Recipient, Taggable, Commentable, AuthorizableContract
              {
              
                  use Authenticatable,
                      Authorizable,
              Severity: Minor
              Found in src/components/model/src/User.php - About 4 hrs to fix

                Method render has 108 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function render($request, Exception $e)
                    {
                        if ($e instanceof ValidationException) {
                            return parent::render($request, $e);
                        }
                Severity: Major
                Found in src/components/exception/Handler.php - About 4 hrs to fix

                  Function min has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function min()
                      {
                          if ($this->output !== '') { // min already run
                              return $this->output;
                          }
                  Severity: Minor
                  Found in src/utils/asset/src/JSMin.php - About 4 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 prepareToSave has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
                  Open

                      protected function prepareToSave($classname, array $params = [], array $paramsFromSession = null)
                      {
                          $column = $params['column'];
                          $return = [];
                          if (is_null($paramsFromSession)) {
                  Severity: Minor
                  Found in src/foundation/src/Processor/FilterProcessor.php - About 4 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

                  Method generateScripts has 99 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function generateScripts()
                      {
                  
                          app('antares.asset')->container('antares/foundation::application')
                                  ->add('gridstack', '/webpack/view_datatables.js', ['webpack_gridstack', 'app_cache'])
                  Severity: Major
                  Found in src/ui/components/datatables/src/Html/Builder.php - About 3 hrs to fix

                    Function decorate has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public static function decorate($value, $safe = false)
                        {
                            if (is_string($value)) {
                                if (strpos($value, 'js:') === 0 && $safe === false)
                                    return substr($value, 3);
                    Severity: Minor
                    Found in src/utils/asset/src/JavaScriptDecorator.php - About 3 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

                    File QueryBuilderEngine.php has 321 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    <?php
                    
                    /**
                     * Part of the Antares package.
                     *
                    Severity: Minor
                    Found in src/ui/components/datatables/src/Engines/QueryBuilderEngine.php - About 3 hrs to fix

                      Function adapt has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function adapt(Grid &$grid)
                          {
                              $this->grid   = $grid;
                              $customfields = app('customfields')->get();
                              if (empty($customfields)) {
                      Severity: Minor
                      Found in src/components/html/src/Adapter/CustomfieldAdapter.php - About 3 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 updatePermissions has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function updatePermissions($name, $values, $isNew = false, $brandId = null)
                          {
                              try {
                                  if ($name === null) {
                                      return false;
                      Severity: Minor
                      Found in src/components/memory/src/Model/Permission.php - About 3 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

                      Method action has 84 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          protected function action($command)
                          {
                              // make sure we don't compress "a + ++b" to "a+++b", etc.
                              if ($command === self::ACTION_DELETE_A_B && $this->b === ' ' && ($this->a === '+' || $this->a === '-')) {
                                  // Note: we're at an addition/substraction operator; the inputIndex
                      Severity: Major
                      Found in src/utils/asset/src/JSMin.php - About 3 hrs to fix

                        AbstractType has 27 functions (exceeds 20 allowed). Consider refactoring.
                        Open

                        abstract class AbstractType implements Attributable
                        {
                        
                            use AttributesTrait;
                        
                        
                        Severity: Minor
                        Found in src/utils/form/src/Controls/AbstractType.php - About 3 hrs to fix

                          Function getFunctions has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public function getFunctions()
                              {
                                  return [
                                      new Twig_SimpleFunction('memorize', function ($key, $default = null) {
                                                  return app('antares.platform.memory')->get($key, $default);
                          Severity: Minor
                          Found in src/utils/twig/Extension/Foundation.php - About 3 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

                          Severity
                          Category
                          Status
                          Source
                          Language