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

View on GitHub

Showing 24 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

        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

              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

                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

                    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

                        Function GrantDemo has 69 lines of code (exceeds 50 allowed). Consider refactoring.
                        Open

                        const GrantDemo = (props) => {
                          return (
                            <Fragment>
                              <Typography variant="h5">Grant Demographics</Typography>
                              <Divider variant="middle" />
                        Severity: Major
                        Found in src/components/suggestion/formElements/GrandDemoForm.jsx - About 1 hr to fix

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

                          const filterGrants = (grants: Grant[], state: FilterState): Grant[] => {
                              const filterMethods = new Filters(state.criteria);
                              const newFilters = filterMethods.getFilters();
                              const keys = filterMethods.getKeys();
                              let filteredArray: Grant[] = [];
                          Severity: Minor
                          Found in src/store/filters/filterReducer.ts - 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 ContactUsForm has 63 lines of code (exceeds 50 allowed). Consider refactoring.
                          Open

                          const ContactUsForm = () => {
                              const actions = useContext(ActionsContext);
                              const {token} = useSelector(state => state.user);
                              const {isSuccess} = useSelector(state => state.admin);
                              const styles = emailFormStyles();
                          Severity: Major
                          Found in src/components/contact/ContactUsForm.jsx - About 1 hr to fix

                            Function AddGrant has 63 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/admin/addGrant/addGrant.jsx - About 1 hr to fix

                              Function UserTable has a Cognitive Complexity of 12 (exceeds 5 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: Minor
                              Found in src/components/admin/AdminUserTable/UserTable.js - 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 EmailFormSingle has 60 lines of code (exceeds 50 allowed). Consider refactoring.
                              Open

                              export const EmailFormSingle = () => {
                                  const actions = useContext(ActionsContext);
                                  const {token} = useSelector(state => state.user);
                                  const {isSuccess} = useSelector(state => state.admin);
                                  const styles = emailFormStyles();
                              Severity: Major
                              Found in src/components/admin/EmailFormSingle.jsx - About 1 hr to fix

                                Function LandingPage has 56 lines of code (exceeds 50 allowed). Consider refactoring.
                                Open

                                function LandingPage() {
                                  const classes = useStyles();
                                  const actions = useContext(ActionsContext);
                                  const numberOfGrants = useSelector((state) => state.grants.grants.length);
                                  const { currentUser, isLoading } = useSelector((state) => state.user);
                                Severity: Major
                                Found in src/components/landingpage/LandingPage.jsx - About 1 hr to fix

                                  Function Navbar has a Cognitive Complexity of 10 (exceeds 5 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: Minor
                                  Found in src/components/navbar/Navbar.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

                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language