zenobio93/seat-connector

View on GitHub

Showing 15 of 28 total issues

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

    public function handle()
    {
        $drivers_parameter = $this->option('driver');
        $drivers = collect(array_keys(config('seat-connector.drivers')));

Severity: Minor
Found in src/Commands/DriverUpdateSets.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 15 (exceeds 5 allowed). Consider refactoring.
Open

    public function handle()
    {
        $drivers_parameter = $this->option('driver');
        $drivers = collect(array_keys(config('seat-connector.drivers')));
        $terminator = $this->option('terminator') ?: false;
Severity: Minor
Found in src/Commands/DriverApplyPolicies.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 notifyDrivers has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    public function notifyDrivers(SeatUser $user): void
    {
        // extract registered drivers from the configuration stack
        $drivers = collect(array_keys(config('seat-connector.drivers')));

Severity: Minor
Found in src/Observers/AbstractIdentityObserver.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 notifyDrivers has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function notifyDrivers(SeatUser $user): void
    {
        // extract registered drivers from the configuration stack
        $drivers = collect(array_keys(config('seat-connector.drivers')));

Severity: Minor
Found in src/Observers/AbstractIdentityObserver.php - About 1 hr to fix

    Method up has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function up(): void
        {
            DB::table('seat_connector_users')
                ->select('group_id')
                ->orderBy('group_id')
    Severity: Minor
    Found in src/database/migrations/2020_03_26_110237_convert_to_seat_400.php - About 1 hr to fix

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

          public function index(AccessDataTable $datatable)
          {
              $filter_type = '';
      
              // retrieve all registered SeAT Connector drivers
      Severity: Minor
      Found in src/Http/Controllers/AccessController.php - About 1 hr to fix

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

            public function handle()
            {
                $drivers_parameter = $this->option('driver');
                $drivers = collect(array_keys(config('seat-connector.drivers')));
                $terminator = $this->option('terminator') ?: false;
        Severity: Minor
        Found in src/Commands/DriverApplyPolicies.php - About 1 hr to fix

          Method destroy has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function destroy(int $id)
              {
                  // attempt to retrieve requested identity
                  $identity = User::find($id);
          
          
          Severity: Minor
          Found in src/Http/Controllers/UsersController.php - About 1 hr to fix

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

                public function handle()
                {
                    $drivers_parameter = $this->option('driver');
                    $drivers = collect(array_keys(config('seat-connector.drivers')));
            
            
            Severity: Minor
            Found in src/Commands/DriverUpdateSets.php - About 1 hr to fix

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

                  public function handle()
                  {
                      $config_key = sprintf('seat-connector.drivers.%s.client', $this->driver);
                      $client = config($config_key);
              
              
              Severity: Minor
              Found in src/Jobs/DriverApplyPolicies.php - About 45 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 index has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function index(AccessDataTable $datatable)
                  {
                      $filter_type = '';
              
                      // retrieve all registered SeAT Connector drivers
              Severity: Minor
              Found in src/Http/Controllers/AccessController.php - About 45 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

              Avoid too many return statements within this method.
              Open

                              return 'alliances';
              Severity: Major
              Found in src/Http/Controllers/AccessController.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                                return 'squads';
                Severity: Major
                Found in src/Http/Controllers/AccessController.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                                  return $class_name;
                  Severity: Major
                  Found in src/Http/Controllers/AccessController.php - About 30 mins to fix

                    Function destroy has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function destroy(int $id)
                        {
                            // attempt to retrieve requested identity
                            $identity = User::find($id);
                    
                    
                    Severity: Minor
                    Found in src/Http/Controllers/UsersController.php - About 25 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