asenka0301/frontend-bootcamp-project-12

View on GitHub

Showing 21 of 21 total issues

Function SignUpPage has 113 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const SignUpPage = () => {
  const auth = useAuth();
  const inputRef = useRef();
  const navigate = useNavigate();
  const { t } = useTranslation();
Severity: Major
Found in frontend/src/components/pages/SignUpPage.jsx - About 4 hrs to fix

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

                  <Form.Control
                    type="password"
                    id="password"
                    name="password"
                    placeholder="password"
    Severity: Major
    Found in frontend/src/components/pages/SignUpPage.jsx and 1 other location - About 3 hrs to fix
    frontend/src/components/pages/SignUpPage.jsx on lines 107..119

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

    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

                  <Form.Control
                    type="password"
                    id="passwordConfirmation"
                    name="passwordConfirmation"
                    placeholder="passwordConfirmation"
    Severity: Major
    Found in frontend/src/components/pages/SignUpPage.jsx and 1 other location - About 3 hrs to fix
    frontend/src/components/pages/SignUpPage.jsx on lines 91..102

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

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

    const LoginPage = () => {
      const auth = useAuth();
      const inputRef = useRef();
      const navigate = useNavigate();
      const { t } = useTranslation();
    Severity: Major
    Found in frontend/src/components/pages/LoginPage.jsx - About 3 hrs to fix

      Function ChannelModal has 65 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const ChannelModal = (props) => {
        const { handleClose } = props;
        const socket = useSocket();
        const { t } = useTranslation();
        const inputRef = useRef();
      Severity: Major
      Found in frontend/src/components/modals/ChannelModal.jsx - About 2 hrs to fix

        Function SignUpPage has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
        Open

        const SignUpPage = () => {
          const auth = useAuth();
          const inputRef = useRef();
          const navigate = useNavigate();
          const { t } = useTranslation();
        Severity: Minor
        Found in frontend/src/components/pages/SignUpPage.jsx - About 2 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

        Function ModalRenameChannel has 59 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const ModalRenameChannel = (props) => {
          const { handleClose } = props;
          const socket = useSocket();
          const inputRef = useRef();
          const { t } = useTranslation();
        Severity: Major
        Found in frontend/src/components/modals/ModalRenameChannel.jsx - About 2 hrs to fix

          Function MessageForm has 56 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const MessageForm = () => {
            const inputRef = useRef();
            const { t } = useTranslation();
            const socket = useSocket();
            const activeChannelId = useSelector((state) => {

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

                  username: Yup.string('')
                    .min(3, `${t('usernameLength')}`)
                    .max(20, `${t('usernameLength')}`)
                    .required(`${t('requiredField')}`),
            Severity: Major
            Found in frontend/src/components/pages/SignUpPage.jsx and 1 other location - About 2 hrs to fix
            frontend/src/components/pages/LoginPage.jsx on lines 26..29

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

            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

                  username: Yup.string('')
                    .min(3, `${t('usernameLength')}`)
                    .max(20, `${t('usernameLength')}`)
                    .required(`${t('requiredField')}`),
            Severity: Major
            Found in frontend/src/components/pages/LoginPage.jsx and 1 other location - About 2 hrs to fix
            frontend/src/components/pages/SignUpPage.jsx on lines 26..29

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

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

            const ChatPage = () => {
              const auth = useAuth();
              const dispatch = useDispatch();
              const { t } = useTranslation();
            
            
            Severity: Major
            Found in frontend/src/components/pages/ChatPage/ChatPage.jsx - About 2 hrs to fix

              Function App has 50 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const App = () => {
                const ruDictionary = leoProfanity.getDictionary('ru');
                leoProfanity.loadDictionary(ruDictionary);
                const socket = io();
                const dispatch = useDispatch();
              Severity: Minor
              Found in frontend/src/App.jsx - About 2 hrs to fix

                Function Channels has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                const Channels = () => {
                  const dispatch = useDispatch();
                  const channels = useSelector(channelsSelectors.selectAll);
                  const activeChannelId = useSelector((state) => {
                    const { currentChannelId } = state.channels;

                  Function ModalDeleteChannel has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  const ModalDeleteChannel = (props) => {
                    const { handleClose } = props;
                    const socket = useSocket();
                    const dispatch = useDispatch();
                    const { t } = useTranslation();
                  Severity: Minor
                  Found in frontend/src/components/modals/ModalDeleteChannel.jsx - About 1 hr to fix

                    Function DropdownChannel has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    const DropdownChannel = (props) => {
                      const { item, activeChannelId, handleClick } = props;
                    
                      const { t } = useTranslation();
                      const dispatch = useDispatch();

                      Function LoginPage has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                      Open

                      const LoginPage = () => {
                        const auth = useAuth();
                        const inputRef = useRef();
                        const navigate = useNavigate();
                        const { t } = useTranslation();
                      Severity: Minor
                      Found in frontend/src/components/pages/LoginPage.jsx - 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

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

                            <Modal.Header closeButton={handleClose}>
                              <Modal.Title>{t('renameChannel')}</Modal.Title>
                            </Modal.Header>
                      Severity: Major
                      Found in frontend/src/components/modals/ModalRenameChannel.jsx and 2 other locations - About 55 mins to fix
                      frontend/src/components/modals/ChannelModal.jsx on lines 54..56
                      frontend/src/components/modals/ModalDeleteChannel.jsx on lines 29..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 54.

                      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

                            <Modal.Header closeButton={handleClose}>
                              <Modal.Title>{t('addChannel')}</Modal.Title>
                            </Modal.Header>
                      Severity: Major
                      Found in frontend/src/components/modals/ChannelModal.jsx and 2 other locations - About 55 mins to fix
                      frontend/src/components/modals/ModalDeleteChannel.jsx on lines 29..31
                      frontend/src/components/modals/ModalRenameChannel.jsx on lines 46..48

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

                      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

                            <Modal.Header closeButton={handleClose}>
                              <Modal.Title>{t('deleteChannel')}</Modal.Title>
                            </Modal.Header>
                      Severity: Major
                      Found in frontend/src/components/modals/ModalDeleteChannel.jsx and 2 other locations - About 55 mins to fix
                      frontend/src/components/modals/ChannelModal.jsx on lines 54..56
                      frontend/src/components/modals/ModalRenameChannel.jsx on lines 46..48

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

                      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

                        const handleChannelModal = (id) => {
                          dispatch(channelsActions.setCurrentChannelId(id));
                          toast.success(`${t('channelCreated')}`);
                          handleClose();
                        };
                      Severity: Minor
                      Found in frontend/src/components/modals/ChannelModal.jsx and 1 other location - About 40 mins to fix
                      frontend/src/components/modals/ModalDeleteChannel.jsx on lines 17..21

                      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