herpaderpaldent/seat-notifications

View on GitHub

Showing 14 of 135 total issues

Method callback has 69 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function callback(Request $request)
    {
        // get back pending OAuth credentials validation from session
        $credentials = $request->session()->get('herpaderp.seatnotifications.discord.credentials');

Severity: Major
Found in src/Http/Controllers/Discord/DiscordServerController.php - About 2 hrs to fix

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

        public function callback(Request $request)
        {
            // get back pending OAuth credentials validation from session
            $credentials = $request->session()->get('herpaderp.seatnotifications.slack.credentials');
    
    
    Severity: Minor
    Found in src/Http/Controllers/Slack/SlackServerOAuthController.php - About 1 hr to fix

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

          public function callback()
          {
              $state = request()->session()->get('herpaderp.seatnotifications.slack.user.state');
      
              request()->session()->forget('herpaderp.seatnotifications.slack.user.state');
      Severity: Minor
      Found in src/Http/Controllers/Slack/SlackUserOAuthController.php - About 1 hr to fix

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

            private static function getCategories(int $category_id = null): Collection
            {
                $params = [
                    'api_key' => setting('herpaderp.seatnotifications.discourse.credentials.api_key', true),
                ];
        Severity: Minor
        Found in src/Drivers/DiscourseNotificationDriver.php - About 1 hr to fix

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

              protected function mergeConfigs(array $original, array $merging)
              {
                  $array = array_merge($original, $merging);
          
                  foreach ($original as $key => $value) {
          Severity: Minor
          Found in src/SeatNotificationsServiceProvider.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 execute has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              public function execute(array $data)
              {
          
                  if (array_key_exists('characters_filter', $data) || array_key_exists('corporations_filter', $data)) {
          
          
          Severity: Minor
          Found in src/Http/Actions/BuildAffiliationJSONAction.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 callback has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function callback()
              {
                  $state = request()->session()->get('herpaderp.seatnotifications.discord.user.state');
          
                  request()->session()->forget('herpaderp.seatnotifications.discord.user.state');
          Severity: Minor
          Found in src/Http/Controllers/Discord/DiscordOAuthController.php - About 1 hr to fix

            Method execute has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function execute(array $data)
                {
                    try {
            
                        $subscription = NotificationRecipient::where('driver_id', $data['driver_id'])
            Severity: Minor
            Found in src/Http/Actions/UnsubscribeAction.php - About 1 hr to fix

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

                  public function handle()
                  {
              
                      // Check if victim and attacker details are present yet.
                      if(empty($this->killmail_detail->victims) || empty($this->killmail_detail->attackers)){
              Severity: Minor
              Found in src/Jobs/KillmaillDispatcher.php - About 1 hr to fix

                Avoid too many return statements within this method.
                Open

                        return $this->subscribe_action->execute($data);
                Severity: Major
                Found in src/Http/Controllers/Slack/SlackUserOAuthController.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                          return redirect()->route('seatnotifications.configuration')
                              ->with('success', 'The bot credentials has been set.');
                  Severity: Major
                  Found in src/Http/Controllers/Discord/DiscordServerController.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                return redirect()->route('seatnotifications.configuration')
                                    ->with('error', 'An error occurred while trying to create websocket connection with Discord. ' .
                                        $e->getMessage());
                    Severity: Major
                    Found in src/Http/Controllers/Discord/DiscordServerController.php - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                                      return redirect()->route('seatnotifications.configuration')
                                          ->with('error', 'An error occurred while trying to create websocket connection with Discord. ' .
                                              $identified);
                      Severity: Major
                      Found in src/Http/Controllers/Discord/DiscordServerController.php - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                return redirect()->route('seatnotifications.configuration')
                                    ->with('success', 'The bot credentials has been set.');
                        Severity: Major
                        Found in src/Http/Controllers/Slack/SlackServerOAuthController.php - About 30 mins to fix
                          Severity
                          Category
                          Status
                          Source
                          Language