luyadev/luya

View on GitHub

Showing 82 of 90 total issues

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 _computeTargetAndRootIntersection has 52 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        function(target, targetRect, rootRect) {
      // If the element isn't displayed, an intersection can't happen.
      if (window.getComputedStyle(target).display == 'none') return;
    
      var intersectionRect = targetRect;
Severity: Major
Found in core/resources/lazyload/intersectionObserver.polyfill.src.js - About 2 hrs to fix

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

        Function loadImage has 45 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                loadImage(image) {
                    const context = this
        
                    this.log('Image loading:', { id: image.id, image })
        
        
        Severity: Minor
        Found in core/resources/lazyload/lazyload.src.js - About 1 hr to fix

          Function _monitorIntersections has 45 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              IntersectionObserver.prototype._monitorIntersections = function(doc) {
                var win = doc.defaultView;
                if (!win) {
                  // Already destroyed.
                  return;
          Severity: Minor
          Found in core/resources/lazyload/intersectionObserver.polyfill.src.js - About 1 hr to fix

            Function beforeRun has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

                public function beforeRun($app)
                {
                    foreach ($app->tags as $name => $config) {
                        TagParser::inject($name, $config);
                    }
            Severity: Minor
            Found in core/web/Bootstrap.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 buildTraceItem has 42 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private function buildTraceItem(array $item)
                {
                    $file = $item['file'] ?? null;
                    $line = $item['line'] ?? null;
                    $contextLine = null;
            Severity: Minor
            Found in core/traits/ErrorHandlerTrait.php - About 1 hr to fix

              Function getOwnPropertyDescriptor has 41 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      Object.getOwnPropertyDescriptor = function getOwnPropertyDescriptor(object, property) {
                          if (isPrimitive(object)) {
                              throw new TypeError(ERR_NON_OBJECT + object);
                          }
              
              
              Severity: Minor
              Found in core/resources/lazyload/intersectionObserver.polyfill.src.js - About 1 hr to fix

                Method getInternalResolverArray has 40 lines of code (exceeds 25 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 1 hr to fix

                  Function generateClassName has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                  Open

                      protected function generateClassName($tableName, $useSchemaName = null)
                      {
                          if (isset($this->classNames[$tableName])) {
                              return $this->classNames[$tableName];
                          }
                  Severity: Minor
                  Found in core/console/commands/BaseCrudController.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 actionCreate has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function actionCreate()
                      {
                          Console::clearScreenBeforeCursor();
                  
                          $moduleName = $this->prompt("Enter the name of the module you like to generate:");
                  Severity: Minor
                  Found in core/console/commands/ModuleController.php - About 1 hr to fix

                    Method actionIndex has 38 lines of code (exceeds 25 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 1 hr to fix

                      Method run has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function run()
                          {
                              TextToSpeechAsset::register($this->view);
                      
                              $config = Json::htmlEncode([
                      Severity: Minor
                      Found in core/texttospeech/TextToSpeechWidget.php - About 1 hr to fix

                        Function defineProperty has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                                Object.defineProperty = function defineProperty(object, property, descriptor) {
                                    if (isPrimitive(object)) {
                                        throw new TypeError(ERR_NON_OBJECT_TARGET + object);
                                    }
                                    if (isPrimitive(descriptor)) {
                        Severity: Minor
                        Found in core/resources/lazyload/intersectionObserver.polyfill.src.js - About 1 hr to fix

                          Method actionClone has 36 lines of code (exceeds 25 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 1 hr to fix

                            Function actionCreate has a Cognitive Complexity of 12 (exceeds 5 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: Minor
                            Found in core/console/commands/ThemeController.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 getViewPath has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                            Open

                                public function getViewPath()
                                {
                                    if ($this->module instanceof Module) {
                                        if ($this->module->useAppViewPath) {
                                            return '@app/views/' . $this->module->id . '/' . $this->id;
                            Severity: Minor
                            Found in core/web/Controller.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 _checkForIntersections has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                IntersectionObserver.prototype._checkForIntersections = function() {
                                  if (!this.root && crossOriginUpdater && !crossOriginRect) {
                                    // Cross origin monitoring, but no initial data available yet.
                                    return;
                                  }
                            Severity: Minor
                            Found in core/resources/lazyload/intersectionObserver.polyfill.src.js - About 1 hr to fix
                              Severity
                              Category
                              Status
                              Source
                              Language