luyadev/luya

View on GitHub

Showing 133 of 133 total issues

Function buildTraceItem has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

    private function buildTraceItem(array $item)
    {
        $file = isset($item['file']) ? $item['file'] : null;
        $line = isset($item['line']) ? $item['line'] : null;
        $contextLine = null;
Severity: Minor
Found in core/traits/ErrorHandlerTrait.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 actionIndex has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

    public function actionIndex()
    {
        // opcache reset should run in web context, but might be helpfull as well.
        if (function_exists('opcache_reset')) {
            @opcache_reset();
Severity: Minor
Found in core/console/commands/HealthController.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

File EventTrait.php has 282 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace luya\web\jsonld;

use luya\helpers\ObjectHelper;
Severity: Minor
Found in core/web/jsonld/EventTrait.php - About 2 hrs to fix

    Method init has 68 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function init()
        {
            parent::init();
    
            if ($this->src === null) {
    Severity: Major
    Found in core/lazyload/LazyLoad.php - About 2 hrs to fix

      Function getInternalResolverArray has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function getInternalResolverArray()
          {
              if ($this->_resolved === null) {
                  $requestPathInfo = $this->trailingPathInfo();
                  $newRegex = $this->buildRegexPattern();
      Severity: Minor
      Found in core/web/CompositionResolver.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 csv has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function csv($filename, array $options = [])
          {
              $filename = Yii::getAlias($filename);
              
              // check if a given file name is provided or a csv based on the content
      Severity: Minor
      Found in core/helpers/ImportHelper.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 selectModule has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

          public function selectModule(array $options = [])
          {
              $modules = [];
              foreach (Yii::$app->getModules() as $id => $object) {
                  if (!$object instanceof \luya\base\Module) {
      Severity: Minor
      Found in core/console/Command.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

      Method getExceptionArray has 59 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function getExceptionArray($exception)
          {
              $_message = 'Uknonwn exception object, not instance of \Exception.';
              $_file = 'unknown';
              $_line = 0;
      Severity: Major
      Found in core/traits/ErrorHandlerTrait.php - About 2 hrs to fix

        Composition has 22 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class Composition extends Component implements \ArrayAccess
        {
            const VAR_LANG_SHORT_CODE = 'langShortCode';
            
            /**
        Severity: Minor
        Found in core/web/Composition.php - About 2 hrs to fix

          JsonLd has 22 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class JsonLd extends BaseObject
          {
              /**
               * Register new Article.
               *
          Severity: Minor
          Found in core/web/JsonLd.php - About 2 hrs to fix

            Method convert_date_time has 56 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public static function convert_date_time($date_input) //thanks to Excel::Writer::XLSX::Worksheet.pm (perl)
                {
                    $days = 0;    # Number of days since epoch
                    $seconds = 0;    # Time expressed as fraction of 24h hours in seconds
                    $year = $month = $day = 0;
            Severity: Major
            Found in core/helpers/XLSXWriter.php - About 2 hrs to fix

              Method numberFormatStandardized has 55 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private static function numberFormatStandardized($num_format)
                  {
                      if ($num_format == 'money') {
                          $num_format = 'dollar';
                      }
              Severity: Major
              Found in core/helpers/XLSXWriter.php - About 2 hrs to fix

                Method actionInit has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function actionInit()
                    {
                        // username
                        $username = $this->getConfig(self::CONFIG_VAR_USERNAME);
                        if (!$username) {
                Severity: Major
                Found in dev/RepoController.php - About 2 hrs to fix

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

                      public function actionClone($vendor = null, $repo = null)
                      {
                          // if `vendor/repo` notation is provided
                          if ($vendor !== null && strpos($vendor, '/')) {
                              list($vendor, $repo) = explode("/", $vendor);
                  Severity: Minor
                  Found in dev/RepoController.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 getIsAdmin has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function getIsAdmin()
                      {
                          if ($this->_isAdmin === null) {
                              if ($this->getIsConsoleRequest() && !$this->forceWebRequest && !Yii::$app->hasModule('admin')) {
                                  $this->_isAdmin = false;
                  Severity: Minor
                  Found in core/web/Request.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 buildImporterQueue has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function buildImporterQueue()
                      {
                          $queue = [];
                          foreach (Yii::$app->getApplicationModules() as $id => $module) {
                              $response = $module->import($this);
                  Severity: Minor
                  Found in core/console/commands/ImportController.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

                  Method actionCreate has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function actionCreate(string $themeName = null)
                      {
                          Console::clearScreenBeforeCursor();
                          
                          $themeName = $this->prompt("Enter the name (lower case) of the theme you like to generate:", ['default' => $themeName]);
                  Severity: Major
                  Found in core/console/commands/ThemeController.php - About 2 hrs to fix

                    Function trigger has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                    Open

                        protected static function trigger($name)
                        {
                            if (isset(static::$_hooks[$name])) {
                                $events = [];
                                
                    Severity: Minor
                    Found in core/Hook.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

                    Function writeCell has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                    Open

                        protected function writeCell(
                            XLSXWriter_BuffererWriter &$file,
                            $row_number,
                            $column_number,
                            $value,
                    Severity: Minor
                    Found in core/helpers/XLSXWriter.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

                    Function play has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                                    play() {
                                        if (this.isPaused) {
                                            return this.resume()
                                        }
                    
                    
                    Severity: Minor
                    Found in core/resources/texttospeech/texttospeech.src.js - About 1 hr to fix
                      Severity
                      Category
                      Status
                      Source
                      Language