warlof/seat-connector

View on GitHub

Showing 17 of 30 total issues

Function handle has a Cognitive Complexity of 20 (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 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 handle has a Cognitive Complexity of 20 (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 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 notifyDrivers has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    public function notifyDrivers(SeatUser $user)
    {
        // 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 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function notifyDrivers(SeatUser $user)
    {
        // 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

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

        private function validate(array $schema, array $structure)
        {
            foreach ($schema as $element => $component) {
    
                if (is_int($element))
    Severity: Minor
    Found in src/Drivers/Driver.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 up has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function up()
        {
            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 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')));
                $terminator = $this->option('terminator') ?: false;
        Severity: Minor
        Found in src/Commands/DriverApplyPolicies.php - About 1 hr to fix

          Method handle has 26 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 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

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

                public function remove(AccessRuleValidation $request)
                {
                    $entity_type = $this->classAlias($request->input('entity_type'));
            
                    switch ($entity_type) {
            Severity: Minor
            Found in src/Http/Controllers/AccessController.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

            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 $class_name;
              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

                  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

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

                      public function create(AccessRuleValidation $request)
                      {
                          $entity_type = $request->input('entity_type');
                  
                          switch ($entity_type) {
                  Severity: Minor
                  Found in src/Http/Controllers/AccessController.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

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