antaresproject/core

View on GitHub

Showing 306 of 306 total issues

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

    public function update(Listener $listener, Fluent $extension, array $input)
    {

        if (!Extension::started($extension->get('name'))) {
            return $listener->suspend(404);
Severity: Major
Found in src/foundation/src/Processor/Extension/ModuleConfigure.php and 1 other location - About 1 day to fix
src/foundation/src/Processor/Extension/Configure.php on lines 88..115

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 288.

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

    public function update(Listener $listener, Fluent $extension, array $input)
    {

        if (!Extension::started($extension->get('name'))) {
            return $listener->suspend(404);
Severity: Major
Found in src/foundation/src/Processor/Extension/Configure.php and 1 other location - About 1 day to fix
src/foundation/src/Processor/Extension/ModuleConfigure.php on lines 114..141

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 288.

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

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

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

                  <?php
                  
                  /**
                   * Part of the Antares package.
                   *
                  Severity: Major
                  Found in src/utils/form/src/Controls/LanguageType.php and 1 other location - About 4 hrs to fix
                  src/utils/form/src/Controls/CountryType.php on lines 1..70

                  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 169.

                  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

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

                  <?php
                  
                  /**
                   * Part of the Antares package.
                   *
                  Severity: Major
                  Found in src/utils/form/src/Controls/CountryType.php and 1 other location - About 4 hrs to fix
                  src/utils/form/src/Controls/LanguageType.php on lines 1..69

                  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 169.

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

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

                        protected function getValues()
                        {
                            $uri    = uri();
                            $params = $this->session->get($uri . '.' . get_called_class());
                            if (is_null($params) or ! isset($params['column']) or ! $params['column'] == $this->column) {
                    Severity: Major
                    Found in src/ui/components/datatables/src/Filter/SelectFilter.php and 1 other location - About 3 hrs to fix
                    src/ui/components/datatables/src/Filter/DateRangeFilter.php on lines 48..65

                    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 159.

                    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

                        protected function getValues()
                        {
                            $uri    = uri();
                            $params = $this->session->get($uri . '.' . get_called_class());
                            if (is_null($params) or ! isset($params['column']) or ! $params['column'] == $this->column) {
                    Severity: Major
                    Found in src/ui/components/datatables/src/Filter/DateRangeFilter.php and 1 other location - About 3 hrs to fix
                    src/ui/components/datatables/src/Filter/SelectFilter.php on lines 45..62

                    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 159.

                    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

                    Severity
                    Category
                    Status
                    Source
                    Language