Lambda-School-Labs/kansha-fe

View on GitHub

Showing 187 of 187 total issues

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

            <div
                onClick={() => {
                    setTitle(titleArr[0]);
                    setContent(titleContentArr[0]);
                }}
Severity: Major
Found in src/components/HelpModal/HelpModalMenu.jsx and 3 other locations - About 1 hr to fix
src/components/HelpModal/HelpModalMenu.jsx on lines 35..43
src/components/HelpModal/HelpModalMenu.jsx on lines 44..52
src/components/HelpModal/HelpModalMenu.jsx on lines 53..61

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

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

            <div
                onClick={() => {
                    setTitle(titleArr[1]);
                    setContent(titleContentArr[1]);
                }}
Severity: Major
Found in src/components/HelpModal/HelpModalMenu.jsx and 3 other locations - About 1 hr to fix
src/components/HelpModal/HelpModalMenu.jsx on lines 26..34
src/components/HelpModal/HelpModalMenu.jsx on lines 44..52
src/components/HelpModal/HelpModalMenu.jsx on lines 53..61

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

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

export default function Footer() {
    return (
        <footer className="landing-footer-container">
            <div>
                <section>
Severity: Minor
Found in src/components/Landing/Footer.jsx - About 1 hr to fix

    Function ReactionButton has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    export const ReactionButton = ({ reactions, rec_id, id, open, inModal }) => {
        const dispatch = useDispatch();
    
        // checks whether the current logged in user is among those who liekd the post
        const userReaction = useMemo(() => {
    Severity: Minor
    Found in src/components/Feed/ReactionButton.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 2 locations. Consider refactoring.
    Open

                ) : deleteTeamFromOrg ? (
                    <section className="delete-container">
                        <div className="delete-text-cont">
                            <h5>
                                Are you sure you want to permanently delete this
    Severity: Major
    Found in src/components/AdminTeams/DeleteModal.jsx and 1 other location - About 1 hr to fix
    src/components/AdminTeams/DeleteModal.jsx on lines 20..52

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

    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

                {deleteMemberFromOrg ? (
                    <section className="delete-container">
                        <div className="delete-text-cont">
                            <h5>
                                Are you sure you want to permanently delete this
    Severity: Major
    Found in src/components/AdminTeams/DeleteModal.jsx and 1 other location - About 1 hr to fix
    src/components/AdminTeams/DeleteModal.jsx on lines 31..52

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

    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 userReaction = useMemo(() => {
            if (reactions) {
                return reactions.reduce(
                    (a, reaction) => (id === reaction.user_id ? reaction.id : a),
                    0,
    Severity: Major
    Found in src/components/Feed/ReactionButton.jsx and 1 other location - About 1 hr to fix
    src/components/Feed/CommentButton.jsx on lines 11..20

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

    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 userComment = useMemo(() => {
            if (comments) {
                return comments.reduce(
                    (a, comment) => (id === comment.user_id ? comment.id : a),
                    0,
    Severity: Major
    Found in src/components/Feed/CommentButton.jsx and 1 other location - About 1 hr to fix
    src/components/Feed/ReactionButton.jsx on lines 10..19

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

    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 [user, setUser] = useState({
            first_name: '',
            last_name: '',
            email: '',
            job_title: '',
    Severity: Major
    Found in src/components/Onboarding/Onboarding.jsx and 1 other location - About 1 hr to fix
    src/components/UserUpload/UserUpload.jsx on lines 9..22

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

    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 [user] = useState({
            first_name: '',
            last_name: '',
            email: '',
            job_title: '',
    Severity: Major
    Found in src/components/UserUpload/UserUpload.jsx and 1 other location - About 1 hr to fix
    src/components/Onboarding/Onboarding.jsx on lines 19..32

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

    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 ProfileTeamList has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

    function ProfileTeamList({ myProfile }) {
        const [modal, setModal] = useState(false);
        const [teamDetails, setTeamDetails] = useState();
        const [loadingState] = useState();
        const [organizationMembers, setOrganizationMembers] = useState([]);
    Severity: Minor
    Found in src/components/Profile/ProfileTeamList.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

    Function Nav has 38 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export default function Nav() {
        const [open, setOpen] = React.useState(false);
        return (
            <nav className="nav">
                <a
    Severity: Minor
    Found in src/components/Landing/Nav.jsx - About 1 hr to fix

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

                              <div>
                                  <input
                                      type="radio"
                                      id="no"
                                      name="drone"
      Severity: Major
      Found in src/components/Onboarding/S4AUserUpload.jsx and 1 other location - About 1 hr to fix
      src/components/Onboarding/S4AUserUpload.jsx on lines 45..54

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

      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

                              <div>
                                  <input
                                      type="radio"
                                      id="yes"
                                      name="drone"
      Severity: Major
      Found in src/components/Onboarding/S4AUserUpload.jsx and 1 other location - About 1 hr to fix
      src/components/Onboarding/S4AUserUpload.jsx on lines 56..65

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

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

      test('renders continue button', () => {
          const wrapper = shallow(
              <S1GetStarted />
          );
          const button = wrapper.find("[data-test='S1Button']");
      Severity: Major
      Found in src/tests/onboarding tests/S1GetStarted.spec.js and 3 other locations - About 1 hr to fix
      src/tests/landing tests/Nav.spec.js on lines 35..39
      src/tests/landing tests/Nav.spec.js on lines 41..45
      src/tests/onboarding tests/S1GetStarted.spec.js on lines 9..15

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

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

      it("renders correctly", () => {
          const wrapper = shallow(
              <S1GetStarted />
          );
          const S1Component = wrapper.find("[data-test='S1Component']");
      Severity: Major
      Found in src/tests/onboarding tests/S1GetStarted.spec.js and 3 other locations - About 1 hr to fix
      src/tests/landing tests/Nav.spec.js on lines 35..39
      src/tests/landing tests/Nav.spec.js on lines 41..45
      src/tests/onboarding tests/S1GetStarted.spec.js on lines 17..24

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

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

          it('renders 4 links', () => {
              const wrapper = shallow(<Nav />);
              const links = wrapper.find('a');
              expect(links.length).toBe(4);
          });
      Severity: Major
      Found in src/tests/landing tests/Nav.spec.js and 3 other locations - About 1 hr to fix
      src/tests/landing tests/Nav.spec.js on lines 35..39
      src/tests/onboarding tests/S1GetStarted.spec.js on lines 9..15
      src/tests/onboarding tests/S1GetStarted.spec.js on lines 17..24

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

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

          it('renders Login twice', () => {
              const wrapper = shallow(<Nav />);
              const Login = wrapper.find("[data-test='login']");
              expect(Login.length).toBe(2);
          });
      Severity: Major
      Found in src/tests/landing tests/Nav.spec.js and 3 other locations - About 1 hr to fix
      src/tests/landing tests/Nav.spec.js on lines 41..45
      src/tests/onboarding tests/S1GetStarted.spec.js on lines 9..15
      src/tests/onboarding tests/S1GetStarted.spec.js on lines 17..24

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

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

      export const liveFeedListeners = sse => dispatch => {
          // Listening for NEW events
          sse.addEventListener(FEED_EVENT_NEW_REC, event =>
              dispatch({
                  type: FEED_EVENT_NEW_REC,
      Severity: Minor
      Found in src/store/actions/feed-actions.js - About 1 hr to fix

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

                        <span className="previousarrow">
                            <i className="fas fa-arrow-left" />
                            <div onClick={handlePrevious}>
                                <p> Previous step</p>
                            </div>
        Severity: Major
        Found in src/components/Onboarding/S4AUserUpload.jsx and 1 other location - About 1 hr to fix
        src/components/Onboarding/S5AccountCustomization.jsx on lines 75..80

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

        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