Lambda-School-Labs/startup-grant-database-fe

View on GitHub

Showing 40 of 40 total issues

Function useAdminActions has 168 lines of code (exceeds 50 allowed). Consider refactoring.
Open

export const useAdminActions = () => {
    const dispatch = useDispatch();

    const fetchAdminGrants = useCallback(
        (token: string) => {
Severity: Major
Found in src/store/admin/useAdminActions.tsx - About 5 hrs to fix

    Function useUserActions has 145 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    export const useUserActions = () => {
        const dispatch = useDispatch();
        const getUserFromAuth0 = useCallback(
            (token: string) => {
                dispatch({type: UserTypes.FETCH_USER_START});
    Severity: Major
    Found in src/store/user/useUserActions.tsx - About 4 hrs to fix

      Function NewGrantTable has 137 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      function NewGrantTable() {
        const { grants } = useSelector((state) => state.admin);
        const [grantList, setGrantList] = useState([]);
        const classes = useStyles();
        const [page, setPage] = useState(0);
      Severity: Major
      Found in src/components/admin/NewGrantTable.jsx - About 4 hrs to fix

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

          paper: {
            marginTop: theme.spacing(10),
            marginBottom: theme.spacing(3),
            paddingBottom: theme.spacing(3),
        
        
        Severity: Major
        Found in src/components/suggestion/SuggestionForm.jsx and 1 other location - About 4 hrs to fix
        src/components/admin/addGrant/addGrant.jsx on lines 26..39

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

        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

          paper: {
            marginTop: theme.spacing(10),
            marginBottom: theme.spacing(3),
            paddingBottom: theme.spacing(3),
        
        
        Severity: Major
        Found in src/components/admin/addGrant/addGrant.jsx and 1 other location - About 4 hrs to fix
        src/components/suggestion/SuggestionForm.jsx on lines 30..43

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

        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 useGrantActions has 128 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        export const useGrantActions = () => {
            const dispatch = useDispatch();
        
            const fetchGrants = useCallback(() => {
                dispatch({type: GrantTypes.FETCH_GRANTS_START});
        Severity: Major
        Found in src/store/grants/useGrantActions.tsx - About 4 hrs to fix

          Function BaseDialog has 122 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

          function BaseDialog(props) {
              const classes = useStyles();
              const [open, setOpen] = useState(false);
              const actions = useContext(ActionsContext);
              const {token} = useSelector(state => state.user);
          Severity: Major
          Found in src/components/dialog/BaseDialog.jsx - About 3 hrs to fix

            Function AddGrant has 114 lines of code (exceeds 50 allowed). Consider refactoring.
            Open

            export const AddGrant = (props) => {
              const actions = useContext(ActionsContext);
              const { token } = useSelector((state) => state.user);
              const styles = useStyles();
            
            
            Severity: Major
            Found in src/components/suggestion/SuggestionForm.jsx - About 3 hrs to fix

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

              const geographicRegion = [
                {
                  value: "North America",
                  label: "North America",
                },
              Severity: Major
              Found in src/components/admin/addGrant/GrantData.js and 1 other location - About 3 hrs to fix
              src/components/suggestion/formUtils/formValues.js on lines 16..45

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

              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

              const geographicRegion = [
                {
                  value: "North America",
                  label: "North America",
                },
              Severity: Major
              Found in src/components/suggestion/formUtils/formValues.js and 1 other location - About 3 hrs to fix
              src/components/admin/addGrant/GrantData.js on lines 16..45

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

              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 Navbar has 99 lines of code (exceeds 50 allowed). Consider refactoring.
              Open

              const Navbar = () => {
                const actions = useContext(ActionsContext);
                const [isOpen, setIsOpen] = useState(false);
                const { currentUser, isLoading } = useSelector((state) => state.user);
                const { isModerator } = useSelector((state) => state.admin);
              Severity: Major
              Found in src/components/navbar/Navbar.jsx - About 2 hrs to fix

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

                    layout: {
                        width: "auto",
                        marginLeft: theme.spacing(2),
                        marginRight: theme.spacing(2),
                        [theme.breakpoints.up(600 + theme.spacing(2) * 2)]: {
                Severity: Major
                Found in src/components/suggestion/formElements/formStyles.js and 1 other location - About 2 hrs to fix
                src/components/suggestion/SuggestionForm.jsx on lines 18..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 93.

                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

                  layout: {
                    width: "auto",
                    marginLeft: theme.spacing(2),
                    marginRight: theme.spacing(2),
                    [theme.breakpoints.up(600 + theme.spacing(2) * 2)]: {
                Severity: Major
                Found in src/components/suggestion/SuggestionForm.jsx and 1 other location - About 2 hrs to fix
                src/components/suggestion/formElements/formStyles.js on lines 4..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 93.

                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 useSuggestionActions has 96 lines of code (exceeds 50 allowed). Consider refactoring.
                Open

                export const useSuggestionActions = () => {
                    const dispatch = useDispatch();
                
                    const fetchSuggestions = useCallback(
                        (token: string, grant_id: number) => {
                Severity: Major
                Found in src/store/suggestions/useSuggestionActions.tsx - About 2 hrs to fix

                  Function UserSettings has 95 lines of code (exceeds 50 allowed). Consider refactoring.
                  Open

                  const UserSettings = () => {
                    const actions = useContext(ActionsContext);
                    const [isEditing, setIsEditing] = useState(false);
                    const [data, setData] = useState({});
                    const { token, currentUser } = useSelector((state) => state.user);
                  Severity: Major
                  Found in src/components/userProfile/userSettings.js - About 2 hrs to fix

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

                    const targetDemographic = [
                      {
                        value: "N/A",
                        label: "N/A",
                      },
                    Severity: Major
                    Found in src/components/suggestion/formUtils/formValues.js and 1 other location - About 2 hrs to fix
                    src/components/admin/addGrant/GrantData.js on lines 49..74

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

                    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

                    const targetDemographic = [
                      {
                        value: "N/A",
                        label: "N/A",
                      },
                    Severity: Major
                    Found in src/components/admin/addGrant/GrantData.js and 1 other location - About 2 hrs to fix
                    src/components/suggestion/formUtils/formValues.js on lines 49..74

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

                    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 UserTable has 82 lines of code (exceeds 50 allowed). Consider refactoring.
                    Open

                    const UserTable = props => {
                        const actions = useContext(ActionsContext);
                        const {token} = useSelector(state => state.user);
                        const {users, isUserLoading} = useSelector(state => state.admin);
                        const roleId = useSelector(
                    Severity: Major
                    Found in src/components/admin/AdminUserTable/UserTable.js - About 2 hrs to fix

                      Function NewGrantTable has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function NewGrantTable() {
                        const { grants } = useSelector((state) => state.admin);
                        const [grantList, setGrantList] = useState([]);
                        const classes = useStyles();
                        const [page, setPage] = useState(0);
                      Severity: Minor
                      Found in src/components/admin/NewGrantTable.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 GrantContainer has 72 lines of code (exceeds 50 allowed). Consider refactoring.
                      Open

                      function GrantContainer(props) {
                        const { isAuthenticated } = useAuth0();
                        const grants = useSelector((state) => state.filters.grants);
                        const { pristine } = useSelector((state) => state.filters);
                        const allGrants = useSelector((state) => state.grants.grants);
                      Severity: Major
                      Found in src/components/grants/GrantContainer.jsx - About 1 hr to fix
                        Severity
                        Category
                        Status
                        Source
                        Language