Lukasss93/laravel-larex

View on GitHub

Showing 47 of 50 total issues

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

    public function handle(LarexImportCommand $command): Collection
    {
        $include = Str::of($command->option('include'))->explode(',')->reject(fn ($i) => empty($i));
        $exclude = Str::of($command->option('exclude'))->explode(',')->reject(fn ($i) => empty($i));

Severity: Minor
Found in src/Importers/LaravelImporter.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 handle has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

    public function handle(LarexImportCommand $command): Collection
    {
        $include = Str::of($command->option('include'))->explode(',')->reject(fn ($i) => empty($i));
        $exclude = Str::of($command->option('exclude'))->explode(',')->reject(fn ($i) => empty($i));

Severity: Minor
Found in src/Importers/JsonLanguagesImporter.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

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

    public function handle(LarexImportCommand $command): Collection
    {
        $include = Str::of($command->option('include'))->explode(',')->reject(fn ($i) => empty($i));
        $exclude = Str::of($command->option('exclude'))->explode(',')->reject(fn ($i) => empty($i));

Severity: Minor
Found in src/Importers/JsonGroupsImporter.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

Function parse has a Cognitive Complexity of 23 (exceeds 5 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 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

Method handle has 74 lines of code (exceeds 25 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: Major
Found in src/Console/LarexInsertCommand.php - About 2 hrs to fix

    Function validateCollection has a Cognitive Complexity of 19 (exceeds 5 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 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 handle has 61 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function handle(LarexImportCommand $command): Collection
        {
            $include = Str::of($command->option('include'))->explode(',')->reject(fn ($i) => empty($i));
            $exclude = Str::of($command->option('exclude'))->explode(',')->reject(fn ($i) => empty($i));
    
    
    Severity: Major
    Found in src/Importers/LaravelImporter.php - About 2 hrs to fix

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

          public function handle(LarexExportCommand $command, CsvReader $reader): int
          {
              $parser = CsvParser::create($reader);
              $languages = $parser->parse();
      
      
      Severity: Minor
      Found in src/Exporters/LaravelExporter.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 handle has 54 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function handle(LarexImportCommand $command): Collection
          {
              $include = Str::of($command->option('include'))->explode(',')->reject(fn ($i) => empty($i));
              $exclude = Str::of($command->option('exclude'))->explode(',')->reject(fn ($i) => empty($i));
      
      
      Severity: Major
      Found in src/Importers/JsonLanguagesImporter.php - About 2 hrs to fix

        Function handle has a Cognitive Complexity of 16 (exceeds 5 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 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 handle has 51 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function handle(LarexImportCommand $command): Collection
            {
                $include = Str::of($command->option('include'))->explode(',')->reject(fn ($i) => empty($i));
                $exclude = Str::of($command->option('exclude'))->explode(',')->reject(fn ($i) => empty($i));
        
        
        Severity: Major
        Found in src/Importers/JsonGroupsImporter.php - About 2 hrs to fix

          Method handle has 51 lines of code (exceeds 25 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: Major
          Found in src/Console/LarexLintCommand.php - About 2 hrs to fix

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

                public function handle(): int
                {
                    //get the importer name
                    $importerKey = $this->argument('importer') ?? config('larex.importers.default');
                    $importers = config('larex.importers.list');
            Severity: Minor
            Found in src/Console/LarexImportCommand.php - About 2 hrs to fix

              Function handle has a Cognitive Complexity of 15 (exceeds 5 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

              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 validateRaw has a Cognitive Complexity of 14 (exceeds 5 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

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

                  public function handle(): int
                  {
                      $reader = CsvReader::create(csv_path());
                      $csvRows = $reader->getRows()->collect();
                      $filesFound = Utils::findFiles(config('larex.search.dirs'), config('larex.search.patterns'));
              Severity: Minor
              Found in src/Console/LarexLocalizeCommand.php - About 1 hr to fix

                Method handle has 40 lines of code (exceeds 25 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

                  Function handle has a Cognitive Complexity of 13 (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/LarexLintCommand.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 12 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function handle(): int
                      {
                          //get the importer name
                          $importerKey = $this->argument('importer') ?? config('larex.importers.default');
                          $importers = config('larex.importers.list');
                  Severity: Minor
                  Found in src/Console/LarexImportCommand.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 handle has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

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