Showing 186 of 479 total issues

Method ajax has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function ajax()
    {
        return datatables()
            ->eloquent($this->applyScopes($this->query()))
            ->editColumn('ship.typeName', function ($row) {
Severity: Minor
Found in src/Http/DataTables/Common/Military/AbstractFittingDataTable.php - About 1 hr to fix

    Method validate_menu has 43 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function validate_menu(string $package_name, array $menu_data)
        {
    
            if (! is_string($package_name))
                throw new PackageMenuBuilderException(
    Severity: Minor
    Found in src/Http/Composers/AbstractMenu.php - About 1 hr to fix

      Method getUsers has 42 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function getUsers(Request $request)
          {
              $users = User::with('characters')
                  ->standard()
                  ->where('name', 'like', ["%{$request->query('q', '')}%"]);
      Severity: Minor
      Found in src/Http/Controllers/Support/FastLookupController.php - About 1 hr to fix

        Method getCharacterMailTimeline has 41 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private function getCharacterMailTimeline(int $message_id = null)
            {
                // Get the User for permissions and affiliation
                // checks
                $user = auth()->user();
        Severity: Minor
        Found in src/Http/Controllers/Character/MailController.php - About 1 hr to fix

          Method apply has 41 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function apply($query)
              {
                  return $query->whereHas('recipients', function ($sub_query) {
          
                      if ($this->requested_characters != null) {
          Severity: Minor
          Found in src/Http/DataTables/Scopes/CharacterMailScope.php - About 1 hr to fix

            Method getTopTransactionsData has 40 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function getTopTransactionsData(CharacterInfo $character)
                {
            
                    if (! request()->has('characters'))
                        return abort(500);
            Severity: Minor
            Found in src/Http/Controllers/Character/IntelController.php - About 1 hr to fix

              Function index has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function index(Request $request)
                  {
                      $squads = Squad::with('members', 'moderators', 'applications');
              
                      if ($request->has('filters')) {
              Severity: Minor
              Found in src/Http/Controllers/Squads/SquadsController.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 getCharacterJournalStandingsWithProfile has 39 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private function getCharacterJournalStandingsWithProfile(int $character_id, int $profile_id)
                  {
              
                      return CharacterAffiliation::with('character', 'corporation', 'alliance', 'faction')
                          ->select(
              Severity: Minor
              Found in src/Http/Controllers/Character/IntelController.php - About 1 hr to fix

                Method apply has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function apply($query)
                    {
                        // extract querying table (from)
                        $table = $query->getQuery()->from;
                
                
                Severity: Minor
                Found in src/Http/DataTables/Scopes/CorporationScope.php - About 1 hr to fix

                  Method getTopMailContent has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function getTopMailContent(CharacterInfo $character, int $from)
                      {
                  
                          $character_ids = collect($character->character_id);
                  
                  
                  Severity: Minor
                  Found in src/Http/Controllers/Character/IntelController.php - About 1 hr to fix

                    Method isEligible has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        final public function isEligible(Model $member): bool
                        {
                            // in case no filters exists, bypass check
                            if (! property_exists($this->getFilters(), 'and') && ! property_exists($this->getFilters(), 'or'))
                                return true;
                    Severity: Minor
                    Found in src/Models/Filterable.php - About 1 hr to fix

                      Method ajax has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function ajax()
                          {
                              return datatables()
                                  ->eloquent($this->applyScopes($this->query()))
                                  ->editColumn('category', function ($row) {
                      Severity: Minor
                      Found in src/Http/DataTables/Tools/StandingsDataTable.php - About 1 hr to fix

                        Method getSearchCharacterAssetsData has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function getSearchCharacterAssetsData(Request $request)
                            {
                                $scope = new CharacterScope('character.asset');
                        
                                $query = CharacterAsset::with('character', 'type', 'type.group', 'station', 'container', 'container.station',
                        Severity: Minor
                        Found in src/Http/Controllers/Support/SearchController.php - About 1 hr to fix

                          Function draw has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public function draw(Model $row)
                              {
                                  // in case the location is in station range -> use station relation.
                                  if ($row->location_id < 64000000)
                                      return $row->station->name;

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

                              public function postChangeCharacter(Request $request)
                              {
                                  $request->validate([
                                      'character_id' => 'integer|exists:character_infos,character_id|required',
                                  ]);
                          Severity: Minor
                          Found in src/Http/Controllers/Profile/ProfileController.php - About 1 hr to fix

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

                                public function draw(Model $row)
                                {
                                    if ($row->location_type == 'station')
                                        return $row->station->name;
                            
                            
                            Severity: Minor
                            Found in src/Http/DataTables/Character/Intel/Assets/Columns/Station.php - About 1 hr to fix

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

                                  private function characterTopWalletJournalInteractions(Collection $character_ids): Builder
                                  {
                              
                                      return CharacterWalletJournal::select('first_party_id', 'second_party_id', 'ref_type', 'category', 'entity_id as party_id', 'name as party_name', DB::raw('count(*) as total'),
                                          DB::raw("
                              Severity: Minor
                              Found in src/Http/Controllers/Character/IntelController.php - About 1 hr to fix

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

                                    public function ajax()
                                    {
                                        $station_column = $this->getStationColumn($this);
                                        $location_column = $this->getLocationFlagColumn($this);
                                
                                

                                  Method data has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      public function data()
                                      {
                                          return datatables()
                                              ->eloquent($this->applyScopes($this->query()))
                                              ->editColumn('date', function ($row) {
                                  Severity: Minor
                                  Found in src/Http/DataTables/Common/Industrial/AbstractMiningDataTable.php - About 1 hr to fix

                                    Method postAddStandingsFromCorpOrChar has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                        public function postAddStandingsFromCorpOrChar(StandingsExistingElementAdd $request)
                                        {
                                    
                                            // Get the standings profile that will be updated.
                                            $standings_profile = StandingsProfile::find($request->input('id'));
                                    Severity: Minor
                                    Found in src/Http/Controllers/Tools/StandingsController.php - About 1 hr to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language