Lambda-School-Labs/trashpanda-fe

View on GitHub

Showing 16 of 33 total issues

Function App has 126 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const App = () => {
  const history = useHistory();
  const [theme, toggleTheme] = useDarkMode();
  const themeMode = theme === "light" ? lightTheme : darkTheme;
  const [shutterPress, setShutterPress] = useState(false);
Severity: Major
Found in src/App.js - About 5 hrs to fix

    Function SplashTeam has 87 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const SplashTeam = () => {
      return (
        <Container>
          <SplashNav />
          <ContentContainer>
    Severity: Major
    Found in src/molecules/SplashTeam.jsx - About 3 hrs to fix

      Function MaterialPage has 49 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const MaterialPage = () => {
        const history = useHistory();
        const { materialId } = useParams();
      
        const matInfo = useQuery(GET_MATERIAL, {
      Severity: Minor
      Found in src/organisms/MaterialPage.jsx - About 1 hr to fix

        Function SubCategoryPage has 43 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const SubCategoryPage = () => {
          const { subCategoryId } = useParams();
          const [currentData, setCurrentData] = useState(null);
          const history = useHistory();
          const [materialList, setMaterialList] = useState([]);
        Severity: Minor
        Found in src/organisms/SubCategoryPage.jsx - About 1 hr to fix

          Function AppCache has 42 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const AppCache = props => {
            const [client, setClient] = useState(undefined);
          
            useEffect(() => {
              const link = new HttpLink({ uri: "https://trashpanda-be.herokuapp.com" });
          Severity: Minor
          Found in src/AppCache.js - About 1 hr to fix

            Function renderPage has 35 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function renderPage(step, theme) {
              switch (step) {
                case 1:
                  return (
                    <CenterContainer>
            Severity: Minor
            Found in src/organisms/TutorialPage.jsx - About 1 hr to fix

              Function SplashMainContent has 34 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const SplashMainContent = () => {
                return (
                  <Container>
                    <OverlapTitle>
                      We want to help you create better recycling habits
              Severity: Minor
              Found in src/molecules/SplashMainContent.jsx - About 1 hr to fix

                Function SplashNav has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                const SplashNav = () => {
                  const [selectedPage, setSelectedPage] = useState(0);
                  const { pathname } = useLocation();
                
                  useEffect(() => {
                Severity: Minor
                Found in src/molecules/SplashNav.jsx - About 1 hr to fix

                  Function renderLocations has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function renderLocations(locations, loaded, theme) {
                    return locations.length > 0 ? (
                      <CardsContainer>
                        {locations.map((loc, key) => (
                          <LocationCard
                  Severity: Minor
                  Found in src/organisms/LocationsPage.jsx - About 1 hr to fix

                    Function renderLocations has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function renderLocations(locations, loaded, theme) {
                      return locations.length > 0 ? (
                        <CardsContainer>
                          {locations.map((loc, key) => (
                            <LocationCard
                    Severity: Minor
                    Found in src/organisms/LocationsPage.jsx - About 35 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 getPlasticNumberFromName has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function getPlasticNumberFromName(name) {
                      if (name.includes("#1")) return 1;
                      if (name.includes("#2")) return 2;
                      if (name.includes("#3")) return 3;
                      if (name.includes("#4")) return 4;
                    Severity: Minor
                    Found in src/organisms/SubCategoryPage.jsx - About 35 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

                    Avoid too many return statements within this function.
                    Open

                      if (name.includes("#7")) return 7;
                    Severity: Major
                    Found in src/organisms/SubCategoryPage.jsx - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                        if (name.includes("#6")) return 6;
                      Severity: Major
                      Found in src/organisms/SubCategoryPage.jsx - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                          if (name.includes("#5")) return 5;
                        Severity: Major
                        Found in src/organisms/SubCategoryPage.jsx - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                            return 7;
                          Severity: Major
                          Found in src/organisms/SubCategoryPage.jsx - About 30 mins to fix

                            Function HomeSearchBar has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                            Open

                            const HomeSearchBar = ({ searchFocus, setSearchFocus }) => {
                              const [searchTerm, setSearchTerm] = useState("");
                              const [filtered, setFiltered] = useState([]);
                              const searchBarRef = useRef();
                              const { loading, data } = useQuery(GET_MATERIALS);
                            Severity: Minor
                            Found in src/molecules/HomeSearchBar.jsx - About 25 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

                            Severity
                            Category
                            Status
                            Source
                            Language