luyadev/luya

View on GitHub

Showing 133 of 133 total issues

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

    public static function unlink($file)
    {
        // no errors should be thrown, return false instead.
        try {
            if (parent::unlink($file)) {
Severity: Minor
Found in core/helpers/FileHelper.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 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 = isset($item['file']) ? $item['file'] : null;
        $line = isset($item['line']) ? $item['line'] : null;
        $contextLine = null;
Severity: Minor
Found in core/traits/ErrorHandlerTrait.php - About 1 hr to fix

    Method generateContentArray has 42 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected static function generateContentArray($contentRows, array $keys, $generateHeader = true)
        {
            if (is_scalar($contentRows)) {
                throw new Exception("Content must be either an array, object or traversable.");
            }
    Severity: Minor
    Found in core/helpers/ExportHelper.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 writeToFile has 38 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function writeToFile($filename)
              {
                  foreach ($this->sheets as $sheet_name => $sheet) {
                      self::finalizeSheet($sheet_name);//making sure all footers have been written
                  }
          Severity: Minor
          Found in core/helpers/XLSXWriter.php - About 1 hr to fix

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

                public function writeSheetRow($sheet_name, array $row, $row_options = null)
                {
                    if (empty($sheet_name)) {
                        return;
                    }
            Severity: Minor
            Found in core/helpers/XLSXWriter.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

                Method getInternalResolverArray has 37 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

                  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 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 convert_date_time has a Cognitive Complexity of 12 (exceeds 5 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: 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 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 highlightWord has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public static function highlightWord($content, $word, $markup = '<b>%s</b>')
                        {
                            $word = (array) $word;
                            $content = strip_tags($content);
                            $latest = null;
                    Severity: Minor
                    Found in core/helpers/StringHelper.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 determineNumberFormatType has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        private static function determineNumberFormatType($num_format)
                        {
                            $num_format = preg_replace("/\[(Black|Blue|Cyan|Green|Magenta|Red|White|Yellow)\]/i", "", $num_format);
                            if ($num_format == 'GENERAL') {
                                return 'n_auto';
                    Severity: Minor
                    Found in core/helpers/XLSXWriter.php - About 1 hr to fix

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

                        Function lazyLoad has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            $.lazyLoad = function (options) {        
                                if(typeof options === 'string') {
                                    switch(options) {
                                        case 'refetchElements':
                                        fetchImages();
                        Severity: Minor
                        Found in core/resources/lazyload/lazyload.src.js - About 1 hr to fix

                          Function loadVisibleImages has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              var loadVisibleImages = function () {
                                  var visibleImages = getVisibleImages();
                          
                                  $(visibleImages).each(function () {
                                      // Generate a new image, add the source so it starts loading
                          Severity: Minor
                          Found in core/resources/lazyload/lazyload.src.js - About 1 hr to fix
                            Severity
                            Category
                            Status
                            Source
                            Language