wahanegi/vibereport

View on GitHub

Showing 56 of 274 total issues

Avoid too many return statements within this function.
Open

          return
Severity: Major
Found in app/javascript/components/UI/rich-text/RichInputElement.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

      return <Fragment>
        <GifList {...{gifs, gifUrl, setGifUrl, selectedGifIndex, setSelectedGifIndex, category, isCustomGif}} />
      </Fragment>
    Severity: Major
    Found in app/javascript/components/Pages/Gifs/SearchResults.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

                  return 0
      Severity: Major
      Found in app/javascript/components/UI/rich-text/RichInputElement.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                return 0
        Severity: Major
        Found in app/javascript/components/UI/rich-text/RichInputElement.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                    return 0;
          Severity: Major
          Found in app/javascript/components/UI/rich-text/rich-text.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                        return 0
            Severity: Major
            Found in app/javascript/components/UI/rich-text/RichInputElement.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                        || RichText.contentBtwTags(textHTML, cursorPos, END_TAG_AT, 1).length !== cursorPos.focusOffset-1) return 0
              Severity: Major
              Found in app/javascript/components/UI/rich-text/RichInputElement.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                        return 0
                Severity: Major
                Found in app/javascript/components/UI/rich-text/RichInputElement.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                          return 0
                  Severity: Major
                  Found in app/javascript/components/UI/rich-text/RichInputElement.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                            if (indexOfSelection === -1 ) return
                    Severity: Major
                    Found in app/javascript/components/UI/rich-text/RichInputElement.js - About 30 mins to fix

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

                      const ShoutoutButton = ({ data, setData,  num = 0, isMove = false, hideShoutout}) => {
                          if (hideShoutout) return null;
                      
                          const [ shoutOutForm, setShoutOutForm ] = useState(false)
                          const [ blink, setBlink ] = useState('')
                      Severity: Minor
                      Found in app/javascript/components/UI/ShoutoutButton.js - 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

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

                      const closePickerCallback = (modalRef, showEmojiPicker, setShowEmojiPicker, setPickerPosition) => {
                        useEffect(() => {
                          function handleClickOutside(event) {
                            if (modalRef.current && !modalRef.current.contains(event.target)) {
                              setShowEmojiPicker(false);
                      Severity: Minor
                      Found in app/javascript/components/Pages/ResultsPage/Emojis/EmojiRow.js - 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

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

                      export const ResultsManager = ({ data, setData, steps, draft, service, nextTimePeriod}) => {
                        const [showResultsManager, setShowResultsManager] = useState(false);
                        const navigate = useNavigate()
                        const slug = useParams().slug
                      
                      
                      Severity: Minor
                      Found in app/javascript/components/UI/ShareContent.js - 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

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

                      const Recognition = ({data, setData, saveDataToDb, steps, service, draft}) => {
                        const [ shoutOutForm, setShoutOutForm ] = useState( { status: false, editObj: {}} )
                        const [ isModal, setIsModal ] = useState(false)
                        const [idShoutout, setIdShoutout] = useState()
                        const [isDraft, setIsDraft] = useState(draft)
                      Severity: Minor
                      Found in app/javascript/components/Pages/Recognition.js - 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

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

                      const AnimatedEmotion = ({word, category, addBlur = false, count = 1}) => {
                        const shift = Math.round(Math.random() * 10)/10
                        const minOpacity = (shift - 0.3) > 0 ? (shift - 0.3) : 0.1
                        const springProps = useSpring({
                          from: { fontSize: `${shift ** 2}rem`, opacity: minOpacity },
                      Severity: Minor
                      Found in app/javascript/components/Pages/ResultsPage/EmotionSection.js - 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

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

                      const EmotionType = ({data, setData, saveDataToDb, steps, service, draft}) => {
                        const {isLoading, error} = service
                        const {category} = data.emotion
                        const [selectedType, setSelectedType] = useState(category);
                        const [emotion, setEmotion] = useState({word: data.emotion.word, category: data.emotion.category});
                      Severity: Minor
                      Found in app/javascript/components/Pages/EmotionType.js - 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

                      Severity
                      Category
                      Status
                      Source
                      Language