herpaderpaldent/seat-groups

View on GitHub

Showing 30 of 30 total issues

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

<?php

namespace Herpaderpaldent\Seat\SeatGroups\Http\Controllers\Notifications;

use Herpaderpaldent\Seat\SeatNotifications\Http\Controllers\BaseNotificationController;
src/Http/Controllers/Notifications/MissingRefreshTokenController.php on lines 1..116
src/Http/Controllers/Notifications/SeatGroupErrorController.php on lines 1..116

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

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

<?php
/**
 * MIT License.
 *
 * Copyright (c) 2019. Felix Huber
src/Http/Controllers/Notifications/MissingRefreshTokenController.php on lines 1..116
src/Http/Controllers/Notifications/SeatGroupSyncController.php on lines 1..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 522.

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

<?php
/**
 * MIT License.
 *
 * Copyright (c) 2019. Felix Huber
src/Http/Controllers/Notifications/SeatGroupErrorController.php on lines 1..116
src/Http/Controllers/Notifications/SeatGroupSyncController.php on lines 1..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 522.

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 isQualified has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

    public function isQualified(Group $group)
    {

        $action = new GetCurrentAffiliationAction;

Severity: Minor
Found in src/Models/SeatGroup.php - About 3 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

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

    public function dontSend($notifiable) :bool
    {
        $value = collect([
            'recipient' => $notifiable->driver_id,
            'notification' => get_called_class(),
src/Notifications/MissingRefreshToken/AbstractMissingRefreshTokenNotification.php on lines 136..153
src/Notifications/SeatGroupError/AbstractSeatGroupErrorNotification.php on lines 131..148

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

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

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

    public function dontSend($notifiable) :bool
    {
        $value = collect([
            'recipient' => $notifiable->driver_id,
            'notification' => get_called_class(),
src/Notifications/SeatGroupError/AbstractSeatGroupErrorNotification.php on lines 131..148
src/Notifications/SeatGroupSync/AbstractSeatGroupSyncNotification.php on lines 144..161

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

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

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

    public function dontSend($notifiable) :bool
    {
        $value = collect([
            'recipient' => $notifiable->driver_id,
            'notification' => get_called_class(),
src/Notifications/MissingRefreshToken/AbstractMissingRefreshTokenNotification.php on lines 136..153
src/Notifications/SeatGroupSync/AbstractSeatGroupSyncNotification.php on lines 144..161

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

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 update has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public function update(Request $request, $id)
    {

        $seatgroup = SeatGroup::find($id);

Severity: Minor
Found in src/Http/Controllers/SeatGroupUserController.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 update has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function update(Request $request, $id)
    {

        $seatgroup = SeatGroup::find($id);

Severity: Minor
Found in src/Http/Controllers/SeatGroupUserController.php - About 1 hr to fix

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

            if (! empty($event->sync['attached'])) {
    
                SeatgroupLog::create([
                    'event'   => 'attached',
                    'message' => sprintf('The user group of %s (%s) has successfully been attached to the following roles: %s.',
    Severity: Major
    Found in src/Listeners/CreateSyncedSeatLogsEntry.php and 1 other location - About 1 hr to fix
    src/Listeners/CreateSyncedSeatLogsEntry.php on lines 46..59

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

    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 (! empty($event->sync['detached'])) {
    
                SeatgroupLog::create([
                    'event'   => 'detached',
                    'message' => sprintf('The user group of %s (%s) has been detached from the following roles: %s.',
    Severity: Major
    Found in src/Listeners/CreateSyncedSeatLogsEntry.php and 1 other location - About 1 hr to fix
    src/Listeners/CreateSyncedSeatLogsEntry.php on lines 31..44

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

    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

            return DataTables::of($seatgroup_members)
                ->addColumn('name', function ($row) {
                    return view('seatgroups::partials.modal-partials.modal-name', compact('row'))->render();
                })
                ->addColumn('actions', function ($row) {
    Severity: Major
    Found in src/Http/Controllers/SeatGroupUserController.php and 1 other location - About 1 hr to fix
    src/Http/Controllers/Affiliation/SeatGroupAffiliationController.php on lines 23..31

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

    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

            return DataTables::of($affiliations)
                ->addColumn('affiliation', function ($row) {
                    return view('seatgroups::affiliation.partials.table-partials.affiliation', compact('row'))->render();
                })
                ->addColumn('remove', function ($row) {
    src/Http/Controllers/SeatGroupUserController.php on lines 255..263

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

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

        public function execute(array $data)
        {
            $seatgroup = SeatGroup::find($data['seatgroup_id']);
    
            $affiliations = collect();
    Severity: Minor
    Found in src/Actions/SeatGroups/GetCurrentAffiliationAction.php - About 1 hr to fix

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

          public function handle(GroupApplication $event)
          {
              $should_send = false;
      
              if (class_exists(SeatNotificationsServiceProvider::class))
      Severity: Minor
      Found in src/Listeners/GroupApplicationNotification.php - About 1 hr to fix

        Method up has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function up()
            {
                Schema::create('seatgroups', function ($table) {
                   $table->increments('id')->index();
                   $table->string('name');
        Severity: Minor
        Found in src/database/migrations/2018_02_11_144653_initial_deployment.php - About 1 hr to fix

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

              public function execute(Group $group)
              {
                  $this->group = $group;
                  $main_character = $this->get_main_character_action->execute($this->group);
                  $this->has_missing_refresh_token = false;
          Severity: Minor
          Found in src/Actions/Sync/CatchMissingRefreshTokenAction.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/GroupsServiceProvider.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 execute has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function execute(Group $group) : Collection
                {
            
                    $this->group = $group;
            
            
            Severity: Minor
            Found in src/Actions/Sync/GetRolesToSyncAction.php - About 1 hr to fix

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

                  public function handle(GroupSynced $event)
                  {
                      if (empty($event->sync['attached']) && empty($event->sync['detached']))
                          $this->delete();
              
              
              Severity: Minor
              Found in src/Listeners/CreateSyncedSeatLogsEntry.php - About 1 hr to fix
                Severity
                Category
                Status
                Source
                Language