Lukasss93/laravel-larex

View on GitHub

Showing 47 of 50 total issues

Method handle has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function handle(): int
    {
        $width = (int) $this->option('width');

        $value = Str::lower($this->argument('value'));
Severity: Minor
Found in src/Console/LarexFindCommand.php - About 1 hr to fix

    Method handle has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function handle(): int
        {
            $key = $this->argument('key');
            $force = $this->option('force');
    
    
    Severity: Minor
    Found in src/Console/LarexRemoveCommand.php - About 1 hr to fix

      Method parse has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function parse(bool $skipEmpty = true): array
          {
              $languages = [];
              $header = $this->reader->getHeader();
              $rows = $this->reader->getRows()->collect();
      Severity: Minor
      Found in src/Support/CsvParser.php - About 1 hr to fix

        Method handle has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function handle(): int
            {
                /** @var string $from */
                $from = $this->argument('from');
        
        
        Severity: Minor
        Found in src/Console/LarexLangOrderCommand.php - About 1 hr to fix

          Function handle has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

              public function handle(CsvReader $reader): void
              {
                  //get keys position
                  $count = [];
                  $reader->getRows()->each(function ($columns, $line) use (&$count) {
          Severity: Minor
          Found in src/Linters/ConcurrentKeyLinter.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 msToHuman has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public static function msToHuman($inputMs): string
              {
                  $msInASecond = 1000;
                  $msInAMinute = 60 * $msInASecond;
                  $msInAnHour = 60 * $msInAMinute;
          Severity: Minor
          Found in src/Support/Utils.php - About 1 hr to fix

            Method translate has 30 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function translate(): int
                {
                    $this->warn(sprintf("Processing the '%s' file...", csv_path(true)));
            
                    //check if csv file exists
            Severity: Minor
            Found in src/Console/LarexExportCommand.php - About 1 hr to fix

              Method validateRaw has 30 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function validateRaw(): void
                  {
                      //read raw csv
                      /** @var Collection<int,Collection<int,string>> $output */
                      $output = collect([]);
              Severity: Minor
              Found in src/Support/CsvParser.php - About 1 hr to fix

                Method handle has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function handle(CsvReader $reader): void
                    {
                        $errors = collect([]);
                
                        //get headers
                Severity: Minor
                Found in src/Linters/SameParametersLinter.php - About 1 hr to fix

                  Method handle has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function handle(LarexExportCommand $command, CsvReader $reader): int
                      {
                          $parser = CsvParser::create($reader);
                          $languages = $parser->setHandleSubKey(false)->parse();
                  
                  
                  Severity: Minor
                  Found in src/Exporters/JsonLanguagesExporter.php - About 1 hr to fix

                    Method handle has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function handle(LarexExportCommand $command, CsvReader $reader): int
                        {
                            $parser = CsvParser::create($reader);
                            $languages = $parser->setHandleSubKey(false)->parse();
                    
                    
                    Severity: Minor
                    Found in src/Exporters/JsonGroupsExporter.php - About 1 hr to fix

                      Method validateCollection has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          protected static function validateCollection(Collection $rows): void
                          {
                              $compare = null;
                              foreach ($rows as $i => $columns) {
                                  if (!is_array($columns)) {
                      Severity: Minor
                      Found in src/Console/LarexImportCommand.php - About 1 hr to fix

                        Function handle has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function handle(CsvReader $reader): void
                            {
                                $count = [];
                                $reader->getRows()->each(function ($columns, $line) use (&$count) {
                                    $line += 2;
                        Severity: Minor
                        Found in src/Linters/DuplicateKeyLinter.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 handle has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function handle(): int
                            {
                                if (!File::exists(csv_path())) {
                                    $this->error(sprintf("The '%s' does not exists.", csv_path(true)));
                                    $this->line('Please create it with: php artisan larex:init');
                        Severity: Minor
                        Found in src/Console/LarexInsertCommand.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 fputcsv has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public static function fputcsv(
                                $handle,
                                array $array,
                                string $delimiter = ',',
                                string $enclosure = '"',
                        Severity: Minor
                        Found in src/Support/Utils.php - About 55 mins 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 fputcsv has 6 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                                $handle,
                                array $array,
                                string $delimiter = ',',
                                string $enclosure = '"',
                                string $escape = '\\',
                        Severity: Minor
                        Found in src/Support/Utils.php - About 45 mins to fix

                          Method writeKeyValue has 5 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                              protected static function writeKeyValue($key, $value, &$file, int $level = 1, $eol = PHP_EOL): void
                          Severity: Minor
                          Found in src/Exporters/LaravelExporter.php - About 35 mins to fix

                            Function writeKeyValue has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                            Open

                                protected static function writeKeyValue($key, $value, &$file, int $level = 1, $eol = PHP_EOL): void
                                {
                                    $enclosure = '"';
                            
                                    if (is_array($value)) {
                            Severity: Minor
                            Found in src/Exporters/LaravelExporter.php - About 35 mins 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 translate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                            Open

                                protected function translate(): int
                                {
                                    $this->warn(sprintf("Processing the '%s' file...", csv_path(true)));
                            
                                    //check if csv file exists
                            Severity: Minor
                            Found in src/Console/LarexExportCommand.php - About 35 mins 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 parseErrors has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                            Open

                                protected function parseErrors(string $group, array $keys, &$errors): void
                                {
                                    foreach ($keys as $key) {
                                        if (count($key['children']) === 0) {
                                            continue;
                            Severity: Minor
                            Found in src/Linters/ConcurrentKeyLinter.php - About 35 mins 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