Showing 479 of 479 total issues

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 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 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

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                      if ($this->requested_characters != null) {
                          $character_ids = collect($this->requested_characters)->filter(function ($item) {
                              return Gate::allows('character.mail', [$item]);
                          });
          
          
          Severity: Major
          Found in src/Http/DataTables/Scopes/CharacterMailScope.php and 1 other location - About 1 hr to fix
          src/Http/DataTables/Scopes/CharacterNoteScope.php on lines 61..69

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 107.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                  if ($this->requested_characters != null) {
                      $character_ids = collect($this->requested_characters)->filter(function ($item) {
                          return Gate::allows('character.intel', [$item]);
                      });
          
          
          Severity: Major
          Found in src/Http/DataTables/Scopes/CharacterNoteScope.php and 1 other location - About 1 hr to fix
          src/Http/DataTables/Scopes/CharacterMailScope.php on lines 64..72

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 107.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          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

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

                private function characterWalletTransactionInteraction(Collection $character_ids, int $client_id): Builder
                {
            
                    return CharacterWalletTransaction::with('party', 'type', 'location')
                        ->select(DB::raw('
            Severity: Minor
            Found in src/Http/Controllers/Character/IntelController.php - About 1 hr to fix

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

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

                  Method getJournalGraphBalance has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function getJournalGraphBalance(CharacterInfo $character)
                      {
                  
                          $data = CharacterWalletJournal::with('first_party', 'second_party')
                              ->where('character_id', $character->character_id)
                  Severity: Minor
                  Found in src/Http/Controllers/Character/WalletController.php - About 1 hr to fix

                    Method getTopMailFromData has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

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

                      Method applyRules has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          private function applyRules(Builder $query, string $group_verb, $rules)
                          {
                              $query_operator = $group_verb == 'whereHas' ? 'where' : 'orWhere';
                      
                              if (is_array($rules))
                      Severity: Minor
                      Found in src/Models/Filterable.php - About 1 hr to fix

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

                            private function getLocationNameFromDivision(CorporationAsset $item)
                            {
                                // item > division > office > station / structure
                                if (in_array($item->container->location_flag, ['Impounded', 'OfficeFolder'])) {
                                    if ($item->container->location_type == 'station')
                        Severity: Minor
                        Found in src/Http/DataTables/Corporation/Intel/Assets/Columns/Station.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 getChangelogFromApi has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            private function getChangelogFromApi(string $uri, string $body_attribute, string $tag_attribute): string
                            {
                                try {
                                    return cache()->remember($this->getChangelogCacheKey($uri), 30, function () use ($uri, $body_attribute, $tag_attribute) {
                                        $changelog = '';
                        Severity: Minor
                        Found in src/Http/Controllers/Configuration/SeatController.php - About 1 hr to fix

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

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

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

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

                              Similar blocks of code found in 3 locations. Consider refactoring.
                              Open

                                              switch ($row->detail->issuer->category) {
                                                  case 'alliance':
                                                      return view('web::partials.alliance', ['alliance' => $row->detail->issuer])->render();
                                                  case 'corporation':
                                                      return view('web::partials.corporation', ['corporation' => $row->detail->issuer])->render();
                              src/Http/DataTables/Common/Financial/AbstractContractDataTable.php on lines 69..78
                              src/Http/DataTables/Common/Financial/AbstractContractDataTable.php on lines 84..93

                              Duplicated Code

                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                              Tuning

                              This issue has a mass of 105.

                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                              Refactorings

                              Further Reading

                              Similar blocks of code found in 3 locations. Consider refactoring.
                              Open

                                              switch ($row->detail->acceptor->category) {
                                                  case 'alliance':
                                                      return view('web::partials.alliance', ['alliance' => $row->detail->acceptor])->render();
                                                  case 'corporation':
                                                      return view('web::partials.corporation', ['corporation' => $row->detail->acceptor])->render();
                              src/Http/DataTables/Common/Financial/AbstractContractDataTable.php on lines 54..63
                              src/Http/DataTables/Common/Financial/AbstractContractDataTable.php on lines 69..78

                              Duplicated Code

                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                              Tuning

                              This issue has a mass of 105.

                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                              Refactorings

                              Further Reading

                              Similar blocks of code found in 3 locations. Consider refactoring.
                              Open

                                              switch ($row->detail->assignee->category) {
                                                  case 'alliance':
                                                      return view('web::partials.alliance', ['alliance' => $row->detail->assignee])->render();
                                                  case 'corporation':
                                                      return view('web::partials.corporation', ['corporation' => $row->detail->assignee])->render();
                              src/Http/DataTables/Common/Financial/AbstractContractDataTable.php on lines 54..63
                              src/Http/DataTables/Common/Financial/AbstractContractDataTable.php on lines 84..93

                              Duplicated Code

                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                              Tuning

                              This issue has a mass of 105.

                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                              Refactorings

                              Further Reading

                              Severity
                              Category
                              Status
                              Source
                              Language