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);
Function SplashTeam
has 87 lines of code (exceeds 25 allowed). Consider refactoring. Open
const SplashTeam = () => {
return (
<Container>
<SplashNav />
<ContentContainer>
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, {
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([]);
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" });
Function renderPage
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
function renderPage(step, theme) {
switch (step) {
case 1:
return (
<CenterContainer>
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
Function SplashNav
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
const SplashNav = () => {
const [selectedPage, setSelectedPage] = useState(0);
const { pathname } = useLocation();
useEffect(() => {
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
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
- 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 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;
- 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
Avoid too many return
statements within this function. Open
if (name.includes("#7")) return 7;
Avoid too many return
statements within this function. Open
if (name.includes("#6")) return 6;
Avoid too many return
statements within this function. Open
if (name.includes("#5")) return 5;
Avoid too many return
statements within this function. Open
return 7;
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);
- 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"