wahanegi/vibereport

View on GitHub

Showing 248 of 274 total issues

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

      } else if(isEmptyStr(answerBody)) {
        apiRequest("DELETE", () => {}, () => {}, () => {}, `${url}${id}`).then(goToResultPage);
      } else {
        !isDraft && steps.push('icebreaker-question')
        saveDataToDb(steps, {draft: false})
Severity: Minor
Found in app/javascript/components/Pages/IcebreakerAnswer.js and 1 other location - About 50 mins to fix
app/javascript/components/Pages/IcebreakerQuestion.js on lines 60..64

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

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

      } else if(isEmptyStr(funQuestionBody)) {
        apiRequest("DELETE", () => {}, () => {}, () => {}, `${url}${id}`).then(goToResultPage);
      } else {
        goToResultPage()
      }
Severity: Minor
Found in app/javascript/components/Pages/IcebreakerQuestion.js and 1 other location - About 50 mins to fix
app/javascript/components/Pages/IcebreakerAnswer.js on lines 71..76

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

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

Avoid deeply nested control flow statements.
Open

                        if (node === parentElement) {
                            break;
                        }
Severity: Major
Found in app/javascript/components/UI/rich-text/cursor.js - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                            if (node.previousSibling) {
                                node = node.previousSibling;
                                charCount += node.textContent.length;
                                realPos +=
                                    (node.outerHTML === undefined ? RichText.encodeSpace(RichText.decodeSpace160(node.textContent)) : node.outerHTML).length
    Severity: Major
    Found in app/javascript/components/UI/rich-text/cursor.js - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                    if(userFromNode?.length) {
                      const filtratedUsersByName = RichText.filtrationByName(userFullName(userFromNode[0]), copyChosenUsers)
                      setCopyChosenUsers(filtratedUsersByName)
                      setChosenUsers(filtratedUsersByName)
                      setFilteredUsers(RichText.sortUsersByFullName([...filteredUsers, userFromNode[0]]))
      Severity: Major
      Found in app/javascript/components/UI/rich-text/RichInputElement.js - About 45 mins to fix

        Function removeEmoji has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        const removeEmoji = (emojiObject, emojisArr, setEmojisArr, setSelectedEmoji, current_user, setEmojiObject) => {
          axios.delete(`/api/v1/emojis/${emojiObject.id}`)
            .then(res => {
              if (res.data.message !== 'success') return;
        
        
        Severity: Minor
        Found in app/javascript/components/Pages/ResultsPage/Emojis/EmojiPicker.js - About 45 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

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

              expect(setChosenUsersMock).toHaveBeenCalledWith([{id: 2, first_name: 'Jackie', last_name: 'Chan'},
                {id: 3, first_name: 'Janice', last_name: 'Wednesday'}]);
        Severity: Major
        Found in app/javascript/components/__tests__/RichInputElement.test.js and 4 other locations - About 45 mins to fix
        app/javascript/components/__tests__/RichInputElement.test.js on lines 100..101
        app/javascript/components/__tests__/RichInputElement.test.js on lines 124..125
        app/javascript/components/__tests__/RichInputElement.test.js on lines 193..194
        app/javascript/components/__tests__/RichInputElement.test.js on lines 204..205

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

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

              expect(setChosenUsersMock).toHaveBeenCalledWith([{id: 1, first_name: 'George', last_name: 'Washington'},
                {id: 9, first_name: 'roger', last_name: ''}])
        Severity: Major
        Found in app/javascript/components/__tests__/RichInputElement.test.js and 4 other locations - About 45 mins to fix
        app/javascript/components/__tests__/RichInputElement.test.js on lines 100..101
        app/javascript/components/__tests__/RichInputElement.test.js on lines 124..125
        app/javascript/components/__tests__/RichInputElement.test.js on lines 149..150
        app/javascript/components/__tests__/RichInputElement.test.js on lines 204..205

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

        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

        Avoid deeply nested control flow statements.
        Open

                } else if (listFoundUsers.length) {
                  //delete user from text, Users, ChosenUsers and put instead of it char
        
                  const userToDel = RichText.contentBtwTags(textHTML, cursorPos, END_TAG_AT, 1)
                  const decrementedNumberChosenUsers = copyChosenUsers.filter(user => userFullName(user) !== userToDel) // delete user from chosenUsers
        Severity: Major
        Found in app/javascript/components/UI/rich-text/RichInputElement.js - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                    if (copyChosenUsers.find(user => userFullName(user) === newSearchString))
                      return 0
          Severity: Major
          Found in app/javascript/components/UI/rich-text/RichInputElement.js - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                      if (isBtwSpecialSmb) {
                        RichText.pasteNodeToHTMLobj( MARKER, textHTML, cursorPos, setTextHTML, setCaret, TAG_AT.slice(0, -1), END_TAG_AT )
                        setIsDropdownList(true)
                        setCoordinates(cursorPos.coordinates)
                        return 0
            Severity: Major
            Found in app/javascript/components/UI/rich-text/RichInputElement.js - About 45 mins to fix

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

                    expect(setChosenUsersMock).toHaveBeenCalledWith([{id: 2, first_name: 'Jackie', last_name: 'Chan'},
                      {id: 3, first_name: 'Janice', last_name: 'Wednesday'}])
              Severity: Major
              Found in app/javascript/components/__tests__/RichInputElement.test.js and 4 other locations - About 45 mins to fix
              app/javascript/components/__tests__/RichInputElement.test.js on lines 124..125
              app/javascript/components/__tests__/RichInputElement.test.js on lines 149..150
              app/javascript/components/__tests__/RichInputElement.test.js on lines 193..194
              app/javascript/components/__tests__/RichInputElement.test.js on lines 204..205

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

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

                    expect(setChosenUsersMock).toHaveBeenCalledWith([{id: 3, first_name: 'Janice', last_name: 'Wednesday'},
                      {id: 2, first_name: 'Jackie', last_name: 'Chan'}])
              Severity: Major
              Found in app/javascript/components/__tests__/RichInputElement.test.js and 4 other locations - About 45 mins to fix
              app/javascript/components/__tests__/RichInputElement.test.js on lines 100..101
              app/javascript/components/__tests__/RichInputElement.test.js on lines 124..125
              app/javascript/components/__tests__/RichInputElement.test.js on lines 149..150
              app/javascript/components/__tests__/RichInputElement.test.js on lines 193..194

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

              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

              Avoid deeply nested control flow statements.
              Open

                      if (listAllUsers.find(user => userFullName(user) === nameUserToDel) && !char.match(/[@<>]/)
                          && nameUserToDel.length === cursorPos.focusOffset - 1) {
                        //if user have in the ListUsers  and cursor at the end of firstLastName of user
                        //then dropdown turn off and put chars in the DIV after endTag
              
              
              Severity: Major
              Found in app/javascript/components/UI/rich-text/RichInputElement.js - About 45 mins to fix

                Function calculatePickerPosition has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                 const calculatePickerPosition = (inputRef, showEmojiPicker, setPickerPosition) => {
                  useEffect(() => {
                    if (inputRef.current && showEmojiPicker) {
                      const inputRect = inputRef.current.getBoundingClientRect();
                      const screenHeight = window.innerHeight;
                Severity: Minor
                Found in app/javascript/components/Pages/ResultsPage/Emojis/EmojiRow.js - About 45 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

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

                      expect(setChosenUsersMock).toHaveBeenCalledWith([{id: 1, first_name: 'George', last_name: 'Washington'},
                        {id: 2, first_name: 'Jackie', last_name: 'Chan'}])
                Severity: Major
                Found in app/javascript/components/__tests__/RichInputElement.test.js and 4 other locations - About 45 mins to fix
                app/javascript/components/__tests__/RichInputElement.test.js on lines 100..101
                app/javascript/components/__tests__/RichInputElement.test.js on lines 149..150
                app/javascript/components/__tests__/RichInputElement.test.js on lines 193..194
                app/javascript/components/__tests__/RichInputElement.test.js on lines 204..205

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

                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

                export const BtnNext = ({ addClass = '', hidden, onClick, disabled }) =>
                  <button onClick={onClick} className={`btn btn-regular c1 ${addClass}`} hidden={hidden} disabled={disabled}>
                    Next
                  </button>
                Severity: Minor
                Found in app/javascript/components/UI/ShareContent.js and 1 other location - About 45 mins to fix
                app/javascript/components/UI/ShareContent.js on lines 81..84

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

                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

                export const BtnSkip = ({ addClass = '', hidden = true, onClick, disabled }) =>
                  <button onClick={onClick} className={`btn btn-regular c1 ${addClass}`} hidden={hidden} disabled={disabled}>
                    Skip
                  </button>
                Severity: Minor
                Found in app/javascript/components/UI/ShareContent.js and 1 other location - About 45 mins to fix
                app/javascript/components/UI/ShareContent.js on lines 76..79

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

                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

                        <CornerElements data={data} setData={setData} steps={steps} draft={draft} hideBottom={true} isResult={true}/>
                Severity: Minor
                Found in app/javascript/components/Pages/ResultsPage/index.js and 1 other location - About 40 mins to fix
                app/javascript/components/Pages/ResultsPageManager/index.js on lines 131..131

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

                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

                      listItems.forEach((listItem, index) => {
                        expect(listItem.textContent).toBe(RichText.userFullName(listUsers[index]));
                      });
                Severity: Major
                Found in app/javascript/components/__tests__/RichInputElement.test.js and 2 other locations - About 40 mins to fix
                app/javascript/components/__tests__/RichInputElement.test.js on lines 113..115
                app/javascript/components/__tests__/RichInputElement.test.js on lines 536..538

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

                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