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

View on GitHub

Showing 40 of 40 total issues

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

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

        setGrantInfo({
          competition_name: "",
          area_focus: "",
          sponsoring_entity: "",
          website: "",
    Severity: Major
    Found in src/components/suggestion/SuggestionForm.jsx and 1 other location - About 1 hr to fix
    src/components/admin/addGrant/addGrant.jsx on lines 134..147

    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

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

        setGrantInfo({
          competition_name: "",
          area_focus: "",
          sponsoring_entity: "",
          website: "",
    Severity: Major
    Found in src/components/admin/addGrant/addGrant.jsx and 1 other location - About 1 hr to fix
    src/components/suggestion/SuggestionForm.jsx on lines 167..180

    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

    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

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

          button: {
            display: "flex",
            bottom: theme.spacing(5),
            paddingLeft: theme.spacing(6),
            marginTop: theme.spacing(3),
        Severity: Major
        Found in src/components/admin/addGrant/addGrant.jsx and 1 other location - About 1 hr to fix
        src/components/suggestion/SuggestionForm.jsx on lines 47..53

        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

        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

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

            button: {
              display: "flex",
              bottom: theme.spacing(5),
              paddingLeft: theme.spacing(6),
              marginTop: theme.spacing(3),
          Severity: Major
          Found in src/components/suggestion/SuggestionForm.jsx and 1 other location - About 1 hr to fix
          src/components/admin/addGrant/addGrant.jsx on lines 43..49

          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

          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

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

              const handleChanges = (event) => {
                event.preventDefault();
                setGrantInfo({
                  ...grantInfo,
                  [event.target.name]: event.target.value,
            Severity: Major
            Found in src/components/admin/addGrant/addGrant.jsx and 1 other location - About 1 hr to fix
            src/components/suggestion/SuggestionForm.jsx on lines 128..134

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

            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 handleChanges = (event) => {
                event.preventDefault();
                setGrantInfo({
                  ...grantInfo,
                  [event.target.name]: event.target.value,
            Severity: Major
            Found in src/components/suggestion/SuggestionForm.jsx and 1 other location - About 1 hr to fix
            src/components/admin/addGrant/addGrant.jsx on lines 122..128

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

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

            export function textDisplay(str, grant) {
            
                switch (str) {
                    case 'amount':
                        return grant[str] ? `$${formatNumber(grant[str])}` : `See website for details`;
            Severity: Minor
            Found in src/utils/helpers.js - About 55 mins 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 filter has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                public filter(param1: Grant[], param2: string | number | null, param3?: string | number | null) {
                    if (typeof param2 === 'string') {
                        return param1.filter(grant => grant[param2] === param3);
                    } else {
                        if (!param2 && param3) {
            Severity: Minor
            Found in src/store/filters/Filters.ts - About 55 mins 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 AddGrant has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

            export const AddGrant = (props) => {
              const actions = useContext(ActionsContext);
              const { token } = useSelector((state) => state.user);
              const styles = useStyles();
            
            
            Severity: Minor
            Found in src/components/suggestion/SuggestionForm.jsx - About 45 mins 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

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

            const Transition = React.forwardRef(function Transition(props, ref) {
              return <Slide direction="up" ref={ref} {...props} />;
            });
            Severity: Minor
            Found in src/components/admin/ConfirmedModel.jsx and 1 other location - About 40 mins to fix
            src/components/admin/values/EditGrantDialog.jsx on lines 12..14

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

            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 Transition = React.forwardRef(function Transition(props, ref) {
              return <Slide direction="up" ref={ref} {...props} />;
            });
            Severity: Minor
            Found in src/components/admin/values/EditGrantDialog.jsx and 1 other location - About 40 mins to fix
            src/components/admin/ConfirmedModel.jsx on lines 10..12

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

            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

            Avoid too many return statements within this function.
            Open

                            return param1;
            Severity: Major
            Found in src/store/filters/Filters.ts - About 30 mins to fix
              Severity
              Category
              Status
              Source
              Language