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) => {
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});
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);
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});
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);
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();
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);
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) => {
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);
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(
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);
- Read upRead up
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);
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" />
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[] = [];
- Read upRead up
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();
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();
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(
- Read upRead up
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();
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);
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);
- Read upRead up
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"