BookStackApp/BookStack

View on GitHub

Showing 203 of 288 total issues

Function showPopup has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

function showPopup(editor, code, language, direction, callback) {
Severity: Minor
Found in resources/js/wysiwyg/plugin-codeeditor.js - About 35 mins to fix

    Method createJointPermissionData has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        protected function createJointPermissionData(SimpleEntityData $entity, int $roleId, MassEntityPermissionEvaluator $permissionMap, array $rolePermissionMap, bool $isAdminRole): array
    Severity: Minor
    Found in app/Permissions/JointPermissionBuilder.php - About 35 mins to fix

      Method replaceValueInTable has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

              Connection $db,
              string $table,
              string $column,
              string $oldUrl,
              string $newUrl
      Severity: Minor
      Found in app/Console/Commands/UpdateUrlCommand.php - About 35 mins to fix

        Method sendNotificationToUserIds has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            protected function sendNotificationToUserIds(string $notification, array $userIds, User $initiator, string|Loggable $detail, Entity $relatedModel): void
        Severity: Minor
        Found in app/Activity/Notifications/Handlers/BaseNotificationHandler.php - About 35 mins to fix

          Method __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                  $name,
                  UserProvider $provider,
                  Session $session,
                  LdapService $ldapService,
                  RegistrationService $registrationService
          Severity: Minor
          Found in app/Access/Guards/LdapSessionGuard.php - About 35 mins to fix

            Method resizeImageData has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                    string $imageData,
                    ?int $width,
                    ?int $height,
                    bool $keepRatio,
                    ?string $format = null,
            Severity: Minor
            Found in app/Uploads/ImageResizer.php - About 35 mins to fix

              Method getDefault has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  public static function getDefault(string $event, Webhook $webhook, $detail, User $initiator, int $initiatedTime): self
              Severity: Minor
              Found in app/Activity/Tools/WebhookFormatter.php - About 35 mins to fix

                Method __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    public function __construct(string $event, Webhook $webhook, string|Loggable $detail, User $initiator, int $initiatedTime)
                Severity: Minor
                Found in app/Activity/Tools/WebhookFormatter.php - About 35 mins to fix

                  Method resizeToThumbnailUrl has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                          Image $image,
                          ?int $width,
                          ?int $height,
                          bool $keepRatio = false,
                          bool $shouldCreate = false
                  Severity: Minor
                  Found in app/Uploads/ImageResizer.php - About 35 mins to fix

                    Method __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                            protected TagRepo $tagRepo,
                            protected ImageRepo $imageRepo,
                            protected ReferenceUpdater $referenceUpdater,
                            protected ReferenceStore $referenceStore,
                            protected PageQueries $pageQueries,
                    Severity: Minor
                    Found in app/Entities/Repos/BaseRepo.php - About 35 mins to fix

                      Method __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                              public BookshelfQueries $shelves,
                              public BookQueries $books,
                              public ChapterQueries $chapters,
                              public PageQueries $pages,
                              public PageRevisionQueries $revisions,
                      Severity: Minor
                      Found in app/Entities/Queries/EntityQueries.php - About 35 mins to fix

                        Method __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            public function __construct(int $id, int $sort, ?int $parentChapterId, string $type, int $parentBookId)
                        Severity: Minor
                        Found in app/Entities/Tools/BookSortMapItem.php - About 35 mins to fix

                          Method isSortChangePermissible has 5 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                              protected function isSortChangePermissible(BookSortMapItem $sortMapItem, BookChild $model, ?Entity $currentParent, ?Entity $newBook, ?Entity $newChapter): bool
                          Severity: Minor
                          Found in app/Entities/Tools/BookContents.php - About 35 mins to fix

                            Method __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                                    protected BookshelfRepo $shelfRepo,
                                    protected BookshelfQueries $queries,
                                    protected BookQueries $bookQueries,
                                    protected ShelfContext $shelfContext,
                                    protected ReferenceFetcher $referenceFetcher,
                            Severity: Minor
                            Found in app/Entities/Controllers/BookshelfController.php - About 35 mins to fix

                              Method __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                                      protected ShelfContext $shelfContext,
                                      protected BookRepo $bookRepo,
                                      protected BookQueries $queries,
                                      protected BookshelfQueries $shelfQueries,
                                      protected ReferenceFetcher $referenceFetcher,
                              Severity: Minor
                              Found in app/Entities/Controllers/BookController.php - About 35 mins to fix

                                Function registerUser has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    public function registerUser(array $userData, ?SocialAccount $socialAccount = null, bool $emailConfirmed = false): User
                                    {
                                        $userEmail = $userData['email'];
                                        $authSystem = $socialAccount ? $socialAccount->driver : auth()->getDefaultDriver();
                                
                                
                                Severity: Minor
                                Found in app/Access/RegistrationService.php - About 35 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

                                Function updateContent has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                Open

                                async function updateContent(pngData) {
                                    const loadingImage = window.baseUrl('/loading.gif');
                                
                                    const handleUploadError = error => {
                                        if (error.status === 413) {
                                Severity: Minor
                                Found in resources/js/wysiwyg/plugin-drawio.js - About 35 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

                                Function checkUserHasAccessToRelationOfImageAtPath has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    protected function checkUserHasAccessToRelationOfImageAtPath(string $path): bool
                                    {
                                        if (str_starts_with($path, 'uploads/images/')) {
                                            $path = substr($path, 15);
                                        }
                                Severity: Minor
                                Found in app/Uploads/ImageService.php - About 35 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

                                Function parseRefs has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                Open

                                function parseRefs(name, element) {
                                    const refs = {};
                                    const manyRefs = {};
                                
                                    const prefix = `${name}@`;
                                Severity: Minor
                                Found in resources/js/services/components.js - About 35 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

                                Function selectItem has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    selectItem(item) {
                                        const isDblClick = this.isDoubleClick();
                                        const type = item.getAttribute('data-entity-type');
                                        const id = item.getAttribute('data-entity-id');
                                        const isSelected = (!item.classList.contains('selected') || isDblClick);
                                Severity: Minor
                                Found in resources/js/components/entity-selector.js - About 35 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

                                Severity
                                Category
                                Status
                                Source
                                Language