eveseat/notifications

View on GitHub

Showing 405 of 405 total issues

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

    public function toSlack($notifiable)
    {
        $message = (new SlackMessage)
            ->content('A Moon Mining Extraction has been successfully completed.')
            ->from('SeAT Moon Tracker')
Severity: Minor
Found in src/Notifications/Structures/Slack/MoonMiningExtractionFinished.php - About 1 hr to fix

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

        public function toSlack($notifiable)
        {
            $message = (new SlackMessage)
                ->content('A Moon Mining Extraction has been started.')
                ->from('SeAT Moon Tracker')
    Severity: Minor
    Found in src/Notifications/Structures/Slack/MoonMiningExtractionStarted.php - About 1 hr to fix

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

          public function toSlack($notifiable)
          {
              return (new SlackMessage)
                  ->content('A structure service has been shutdown!')
                  ->from('SeAT Structure Monitor')
      Severity: Minor
      Found in src/Notifications/Structures/Slack/StructureServicesOffline.php - About 1 hr to fix

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

            public function toSlack($notifiable)
            {
                return (new SlackMessage)
                    ->content('A sovereignty structure has been reinforced!')
                    ->from('SeAT Sovereignty Health')
        Severity: Minor
        Found in src/Notifications/Sovereignties/Slack/SovStructureReinforced.php - About 1 hr to fix

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

              public function toSlack($notifiable)
              {
                  return (new SlackMessage)
                      ->from('SeAT War Observer')
                      ->content('A war has been invalidated!')
          Severity: Minor
          Found in src/Notifications/Wars/Slack/AllWarInvalidatedMsg.php - About 1 hr to fix

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

                public function toSlack($notifiable)
                {
            
                    $message = (new SlackMessage)
                        ->content('A kill has been recorded for your corporation!')
            Severity: Minor
            Found in src/Notifications/Characters/Slack/Killmail.php - About 1 hr to fix

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

                  public function toSlack($notifiable)
                  {
                      return (new SlackMessage)
                          ->from('SeAT Alliance Weather')
                          ->content('Capital has been modified!')
              Severity: Minor
              Found in src/Notifications/Alliances/Slack/AllianceCapitalChanged.php - About 1 hr to fix

                Avoid variables with short names like $id. Configured minimum length is 3.
                Open

                    public function zKillBoardToSlackLink(string $type, int $id, string $name): string
                Severity: Minor
                Found in src/Traits/NotificationTools.php by phpmd

                ShortVariable

                Since: 0.2

                Detects when a field, local, or parameter has a very short name.

                Example

                class Something {
                    private $q = 15; // VIOLATION - Field
                    public static function main( array $as ) { // VIOLATION - Formal
                        $r = 20 + $this->q; // VIOLATION - Local
                        for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                            $r += $this->q;
                        }
                    }
                }

                Source https://phpmd.org/rules/naming.html#shortvariable

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

                                $attachment->field(function ($field) {
                                    $system = MapDenormalize::find($this->notification->text['solarsystemID']);
                
                                    $field->title('System')
                                        ->content(
                Severity: Minor
                Found in src/Notifications/Structures/Slack/StructureFuelAlert.php and 1 other location - About 45 mins to fix
                src/Notifications/Structures/Slack/OwnershipTransferred.php on lines 78..85

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

                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

                                $attachment->field(function ($field) {
                                    $system = MapDenormalize::find($this->notification->text['solarSystemID']);
                
                                    $field->title('System')
                                        ->content(
                Severity: Minor
                Found in src/Notifications/Structures/Slack/OwnershipTransferred.php and 1 other location - About 45 mins to fix
                src/Notifications/Structures/Slack/StructureFuelAlert.php on lines 77..88

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

                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

                The class GroupsController has a coupling between objects value of 16. Consider to reduce the number of dependencies under 13.
                Open

                class GroupsController extends Controller
                {
                    /**
                     * @param  \Seat\Notifications\Http\DataTables\NotificationGroupDataTable  $data_table
                     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View

                CouplingBetweenObjects

                Since: 1.1.0

                A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability

                Example

                class Foo {
                    /**
                     * @var \foo\bar\X
                     */
                    private $x = null;
                
                    /**
                     * @var \foo\bar\Y
                     */
                    private $y = null;
                
                    /**
                     * @var \foo\bar\Z
                     */
                    private $z = null;
                
                    public function setFoo(\Foo $foo) {}
                    public function setBar(\Bar $bar) {}
                    public function setBaz(\Baz $baz) {}
                
                    /**
                     * @return \SplObjectStorage
                     * @throws \OutOfRangeException
                     * @throws \InvalidArgumentException
                     * @throws \ErrorException
                     */
                    public function process(\Iterator $it) {}
                
                    // ...
                }

                Source https://phpmd.org/rules/design.html#couplingbetweenobjects

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

                                $attachment
                                    ->field(function ($field) {
                                        $alliance = Alliance::firstOrNew(
                                            ['alliance_id' => $this->notification->text['allianceID']],
                                            ['name' => trans('web::seat.unknown')]
                Severity: Minor
                Found in src/Notifications/Alliances/Slack/AllianceCapitalChanged.php and 1 other location - About 30 mins to fix
                src/Notifications/Corporations/Slack/CorpAppNewMsg.php on lines 74..102

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

                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

                                $attachment
                                    ->field(function ($field) {
                                        $corporation = UniverseName::firstOrNew(
                                            ['entity_id' => $this->notification->text['corpID']],
                                            ['name' => trans('web::seat.unknown')]
                Severity: Minor
                Found in src/Notifications/Corporations/Slack/CorpAppNewMsg.php and 1 other location - About 30 mins to fix
                src/Notifications/Alliances/Slack/AllianceCapitalChanged.php on lines 75..97

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

                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

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

                    public function toMail($notifiable)
                    {
                        $mail = (new MailMessage)
                            ->subject('Character Left Corp Notification!')
                            ->line('A character has left the corporation!');
                Severity: Minor
                Found in src/Notifications/Corporations/Mail/CharLeftCorpMsg.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

                Avoid using static access to class '\Illuminate\Support\Facades\Schema' in method 'down'.
                Open

                        Schema::dropIfExists('notification_histories');

                StaticAccess

                Since: 1.4.0

                Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

                Example

                class Foo
                {
                    public function bar()
                    {
                        Bar::baz();
                    }
                }

                Source https://phpmd.org/rules/cleancode.html#staticaccess

                Avoid using static access to class '\Seat\Notifications\Models\NotificationGroup' in method 'store'.
                Open

                        NotificationGroup::create([
                            'name' => $request->input('name'),
                        ]);

                StaticAccess

                Since: 1.4.0

                Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

                Example

                class Foo
                {
                    public function bar()
                    {
                        Bar::baz();
                    }
                }

                Source https://phpmd.org/rules/cleancode.html#staticaccess

                Avoid using static access to class '\Seat\Notifications\Models\Integration' in method 'getEditGroup'.
                Open

                        $integrations = Integration::all();

                StaticAccess

                Since: 1.4.0

                Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

                Example

                class Foo
                {
                    public function bar()
                    {
                        Bar::baz();
                    }
                }

                Source https://phpmd.org/rules/cleancode.html#staticaccess

                Avoid unused parameters such as '$notifiable'.
                Open

                    public function toArray($notifiable)

                UnusedFormalParameter

                Since: 0.2

                Avoid passing parameters to methods or constructors and then not using those parameters.

                Example

                class Foo
                {
                    private function bar($howdy)
                    {
                        // $howdy is not used
                    }
                }

                Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

                Avoid using static access to class '\Illuminate\Support\Facades\Schema' in method 'down'.
                Open

                        Schema::dropIfExists('integrations');

                StaticAccess

                Since: 1.4.0

                Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

                Example

                class Foo
                {
                    public function bar()
                    {
                        Bar::baz();
                    }
                }

                Source https://phpmd.org/rules/cleancode.html#staticaccess

                Avoid using static access to class '\Illuminate\Support\Facades\Schema' in method 'up'.
                Open

                        Schema::table('notification_groups', function (Blueprint $table) {
                            $table->dropColumn('type');
                        });

                StaticAccess

                Since: 1.4.0

                Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

                Example

                class Foo
                {
                    public function bar()
                    {
                        Bar::baz();
                    }
                }

                Source https://phpmd.org/rules/cleancode.html#staticaccess

                Severity
                Category
                Status
                Source
                Language