Showing 35 of 84 total issues
Function EditItemScreen
has 255 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const EditItemScreen = props => {
const dispatch = useDispatch();
const itemId = props.navigation.getParam('itemId');
const [isLoading, setIsLoading] = useState(false);
const [error, setError] = useState();
Function SendScreen
has 168 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const SendScreen = props => {
const [time, showTime] = useState(false);
const [date, showDate] = useState(false);
const[ newDate,setDate]= useState(new Date());
let options = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' , hour: "2-digit", minute: "2-digit" };
Function EditItemScreen
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
Open
const EditItemScreen = props => {
const dispatch = useDispatch();
const itemId = props.navigation.getParam('itemId');
const [isLoading, setIsLoading] = useState(false);
const [error, setError] = useState();
- 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
File EditItemScreen.js
has 381 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import React, { useEffect, useCallback, useReducer, useState } from 'react';
import {
View,
ScrollView,
StyleSheet,
Function render
has 127 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
let headingText = null;
let confirmPasswordControl = null;
File AuthScreen.js
has 357 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import React, { Component } from "react";
// import { ip } from '../server/iplocation'
Function InventoryItem
has 106 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const InventoryItem = props => {
const selectedItem = useSelector(state =>
state.items.items
);
Function AddScreen
has 102 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const AddScreen = props => {
const selectedItem = useSelector(state =>
state.items.items
);
Function itemsReducer
has 86 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const itemsReducer = (state = initialState, action) => {
switch (action.type) {
case SET_ITEMS:
return {
...state,
Function ReceivedItemScreen
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const ReceivedItemScreen = props => {
// const [isLoading, setIsLoading] = useState(false);
const data = props.navigation.getParam('data');
receiveditems = [
Order = {
Function ItemListScreen
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const ItemListScreen = props => {
const catTitle = props.navigation.getParam('title');
const [text, settext] = useState('');
const [dataSource, setdataSource] = useState('');
Function CartScreen
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const CartScreen = props => {
const [isLoading, setIsLoading] = useState(false);
const cartItems = useSelector(state => {
const transformedCartItems = [];
for (const key in state.cart.items) {
File SendScreen.js
has 262 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import React from 'react';
import { View, Text, StyleSheet,Alert, Platform, KeyboardAvoidingView, ScrollView, SafeAreaView} from 'react-native';
import HeaderButton from '../components/Component/HeaderButton';
import { HeaderButtons, Item } from 'react-navigation-header-buttons';
import Colors from '../constants/Colors'
Function Input
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const Input = props => {
const [inputState, dispatch] = useReducer(inputReducer, {
value: props.initialValue ? props.initialValue : '',
isValid: props.initiallyValid,
// touched: false
Function CategoriesScreen
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const CategoriesScreen = props => {
// const dispatch = useDispatch();
// useEffect(() => {
// dispatch(itemsActions.setItems())
// }, [])
Function Input
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
Open
const Input = props => {
const [inputState, dispatch] = useReducer(inputReducer, {
value: props.initialValue ? props.initialValue : '',
isValid: props.initiallyValid,
// touched: false
- 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 ScannerScreen
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const ScannerScreen = props => {
const dispatch = useDispatch();
const [items, setitems] = useState();
const [hasPermission, setHasPermission] = useState(null);
const [scanned, setScanned] = useState(false);
Function ManageList
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const ManageList = props => {
const renderInventoryItem = (itemData, index) => {
// console.log("manage list ", itemData)
Function submitHandler
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const submitHandler = useCallback(async () => {
// console.log(formState.formIsValid, editedItem, !!editedItem)
if (!formState.formIsValid) {
Alert.alert('Wrong input!', 'Please check the errors in the form.', [
{ text: 'Okay' }
Function renderGridItem
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const renderGridItem = (itemData) => {
return (
<CategoryGridTile title={itemData.item.title}
iconValue={itemData.item.icon}