BookStackApp/BookStack

View on GitHub

Showing 1,485 of 1,485 total issues

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

    protected function renderUsingCommand(string $html): string
    {
        $command = config('exports.pdf_command');
        $inputHtml = tempnam(sys_get_temp_dir(), 'bs-pdfgen-html-');
        $outputPdf = tempnam(sys_get_temp_dir(), 'bs-pdfgen-output-');
Severity: Minor
Found in app/Entities/Tools/PdfGenerator.php - About 1 hr to fix

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

        public function searchEntities(SearchOptions $searchOpts, string $entityType = 'all', int $page = 1, int $count = 20): array
        {
            $entityTypes = array_keys($this->entityProvider->all());
            $entityTypesToSearch = $entityTypes;
    
    
    Severity: Minor
    Found in app/Search/SearchRunner.php - About 1 hr to fix

      Function $syncEvent has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function $syncEvent(binding: Binding, event: any): void {
        const {target} = event;
        const collabNode = $getOrInitCollabNodeFromSharedType(binding, target);
      
        if (collabNode instanceof CollabElementNode && event instanceof YTextEvent) {
      Severity: Minor
      Found in resources/js/wysiwyg/lexical/yjs/SyncEditorStates.ts - About 1 hr to fix

        Function $getOrInitCollabNodeFromSharedType has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export function $getOrInitCollabNodeFromSharedType(
          binding: Binding,
          sharedType: XmlText | YMap<unknown> | XmlElement,
          parent?: CollabElementNode,
        ):
        Severity: Minor
        Found in resources/js/wysiwyg/lexical/yjs/Utils.ts - About 1 hr to fix

          Function syncLexicalUpdateToYjs has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export function syncLexicalUpdateToYjs(
            binding: Binding,
            provider: Provider,
            prevEditorState: EditorState,
            currEditorState: EditorState,
          Severity: Minor
          Found in resources/js/wysiwyg/lexical/yjs/SyncEditorStates.ts - About 1 hr to fix

            Function $removeSegment has 30 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function $removeSegment(
              node: TextNode,
              isBackward: boolean,
              offset: number,
            ): void {
            Severity: Minor
            Found in resources/js/wysiwyg/lexical/core/LexicalSelection.ts - About 1 hr to fix

              Function collectBuildInformation has 30 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function collectBuildInformation(): string {
                let compatibleEditors = 0;
                const incompatibleEditors = new Set<string>();
                const thisVersion = LexicalEditor.version;
                if (typeof window !== 'undefined') {
              Severity: Minor
              Found in resources/js/wysiwyg/lexical/core/LexicalUpdates.ts - About 1 hr to fix

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

                  if (selection !== null) {
                    let clone = $cloneWithProperties(currentNode);
                    clone =
                      $isTextNode(clone) && selection !== null
                        ? $sliceSelectedTextNodeContent(selection, clone)
                Severity: Major
                Found in resources/js/wysiwyg/lexical/html/index.ts and 1 other location - About 1 hr to fix
                resources/js/wysiwyg/lexical/clipboard/clipboard.ts on lines 266..273

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

                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 2 locations. Consider refactoring.
                Open

                  if (selection !== null) {
                    let clone = $cloneWithProperties(currentNode);
                    clone =
                      $isTextNode(clone) && selection !== null
                        ? $sliceSelectedTextNodeContent(selection, clone)
                Severity: Major
                Found in resources/js/wysiwyg/lexical/clipboard/clipboard.ts and 1 other location - About 1 hr to fix
                resources/js/wysiwyg/lexical/html/index.ts on lines 103..110

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

                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

                          expect({
                            key: selection.anchor.key,
                            offset: selection.anchor.offset,
                            type: selection.anchor.type,
                          }).toEqual(expectedSelection.anchor);
                resources/js/wysiwyg/lexical/core/nodes/__tests__/unit/LexicalElementNode.test.ts on lines 563..567

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

                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 (
                      prevSibling &&
                      nextSibling &&
                      isNestedListNode(prevSibling) &&
                      isNestedListNode(nextSibling)
                Severity: Major
                Found in resources/js/wysiwyg/lexical/list/LexicalListItemNode.ts and 1 other location - About 1 hr to fix
                resources/js/wysiwyg/lexical/list/formatList.ts on lines 202..210

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

                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 (
                    listItem1 &&
                    listItem2 &&
                    isNestedListNode(listItem1) &&
                    isNestedListNode(listItem2)
                Severity: Major
                Found in resources/js/wysiwyg/lexical/list/formatList.ts and 1 other location - About 1 hr to fix
                resources/js/wysiwyg/lexical/list/LexicalListItemNode.ts on lines 247..255

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

                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 ($isTableSelection(selection)) {
                          tableObserver.formatCells(payload);
                
                          return true;
                        } else if ($isRangeSelection(selection)) {
                resources/js/wysiwyg/lexical/table/LexicalTableSelectionHelpers.ts on lines 342..359

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

                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 ($isTableSelection(selection)) {
                      if (event) {
                        event.preventDefault();
                        event.stopPropagation();
                      }
                resources/js/wysiwyg/lexical/table/LexicalTableSelectionHelpers.ts on lines 420..433

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

                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

                          expect({
                            key: selection.focus.key,
                            offset: selection.focus.offset,
                            type: selection.focus.type,
                          }).toEqual(expectedSelection.focus);
                resources/js/wysiwyg/lexical/core/nodes/__tests__/unit/LexicalElementNode.test.ts on lines 558..562

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

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

                    return function setupCallback(editor) {
                        function editorChange() {
                            if (options.darkMode) {
                                editor.contentDocument.documentElement.classList.add('dark-mode');
                            }
                Severity: Minor
                Found in resources/js/wysiwyg-tinymce/config.js - About 1 hr to fix

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

                      protected function orientImageToOriginalExif(InterventionImage $image, string $originalData): void
                      {
                          if (!extension_loaded('exif')) {
                              return;
                          }
                  Severity: Minor
                  Found in app/Uploads/ImageResizer.php - About 1 hr to fix

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

                        public function handleLoginCallback(string $socialDriver, SocialUser $socialUser)
                        {
                            $socialDriver = trim(strtolower($socialDriver));
                            $socialId = $socialUser->getId();
                    
                    
                    Severity: Minor
                    Found in app/Access/SocialAuthService.php - About 1 hr to fix

                      Method registerUser has 29 lines of code (exceeds 25 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 1 hr to fix

                        Function detailsDialog has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        function detailsDialog(editor) {
                            return {
                                title: 'Edit collapsible block',
                                body: {
                                    type: 'panel',
                        Severity: Minor
                        Found in resources/js/wysiwyg-tinymce/plugins-details.js - About 1 hr to fix
                          Severity
                          Category
                          Status
                          Source
                          Language