prokuranepal/inventory_app

View on GitHub

Showing 35 of 84 total issues

Function EditItemScreen has 255 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const EditItemScreen = props => {
  const dispatch = useDispatch();
  const itemId = props.navigation.getParam('itemId');
  const [isLoading, setIsLoading] = useState(false);
  const [error, setError] = useState();
Severity: Major
Found in src/screens/EditItemScreen.js - About 1 day to fix

    Function SendScreen has 168 lines of code (exceeds 25 allowed). Consider refactoring.
    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"   };
    Severity: Major
    Found in src/screens/SendScreen.js - About 6 hrs to fix

      Function EditItemScreen has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
      Open

      const EditItemScreen = props => {
        const dispatch = useDispatch();
        const itemId = props.navigation.getParam('itemId');
        const [isLoading, setIsLoading] = useState(false);
        const [error, setError] = useState();
      Severity: Minor
      Found in src/screens/EditItemScreen.js - About 5 hrs 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

      File EditItemScreen.js has 381 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import React, { useEffect, useCallback, useReducer, useState } from 'react';
      import {
        View,
        ScrollView,
        StyleSheet,
      Severity: Minor
      Found in src/screens/EditItemScreen.js - About 5 hrs to fix

        Function render has 127 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            render() {
        
                let headingText = null;
                let confirmPasswordControl = null;
        
        
        Severity: Major
        Found in src/screens/AuthScreen.js - About 5 hrs to fix

          File AuthScreen.js has 357 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          
          
          import React, { Component } from "react";
          // import { ip } from '../server/iplocation'
          
          
          Severity: Minor
          Found in src/screens/AuthScreen.js - About 4 hrs to fix

            Function InventoryItem has 106 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const InventoryItem = props => {
                const selectedItem = useSelector(state =>
                    state.items.items
                );
            
            
            Severity: Major
            Found in src/components/Component/InventoryItem.js - About 4 hrs to fix

              Function AddScreen has 102 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const AddScreen = props => {
              
                  const selectedItem = useSelector(state =>
                      state.items.items
                  );
              Severity: Major
              Found in src/screens/AddScreen.js - About 4 hrs to fix

                Function itemsReducer has 86 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                const itemsReducer = (state = initialState, action) => {
                    switch (action.type) {
                        case SET_ITEMS:
                            return {
                                ...state,
                Severity: Major
                Found in src/store/reducers/items.js - About 3 hrs to fix

                  Function ReceivedItemScreen has 69 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  const ReceivedItemScreen = props => {
                      // const [isLoading, setIsLoading] = useState(false);
                      const data = props.navigation.getParam('data');
                      receiveditems = [
                          Order = {
                  Severity: Major
                  Found in src/screens/ReceivedItemScreen.js - About 2 hrs to fix

                    Function ItemListScreen has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    const ItemListScreen = props => {
                    
                        const catTitle = props.navigation.getParam('title');
                        const [text, settext] = useState('');
                        const [dataSource, setdataSource] = useState('');
                    Severity: Major
                    Found in src/screens/ItemListScreen.js - About 2 hrs to fix

                      Function CartScreen has 60 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      const CartScreen = props => {
                          const [isLoading, setIsLoading] = useState(false);
                          const cartItems = useSelector(state => {
                              const transformedCartItems = [];
                              for (const key in state.cart.items) {
                      Severity: Major
                      Found in src/screens/CartScreen.js - About 2 hrs to fix

                        File SendScreen.js has 262 lines of code (exceeds 250 allowed). Consider refactoring.
                        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'
                        Severity: Minor
                        Found in src/screens/SendScreen.js - About 2 hrs to fix

                          Function Input has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          const Input = props => {
                              const [inputState, dispatch] = useReducer(inputReducer, {
                                  value: props.initialValue ? props.initialValue : '',
                                  isValid: props.initiallyValid,
                                  // touched: false
                          Severity: Minor
                          Found in src/components/UI/Input.js - About 1 hr to fix

                            Function CategoriesScreen has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            const CategoriesScreen = props => {
                                // const dispatch = useDispatch();
                                // useEffect(() => {
                                //     dispatch(itemsActions.setItems())
                                // }, [])
                            Severity: Minor
                            Found in src/screens/CategoriesScreen.js - About 1 hr to fix

                              Function Input has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                              Open

                              const Input = props => {
                                  const [inputState, dispatch] = useReducer(inputReducer, {
                                      value: props.initialValue ? props.initialValue : '',
                                      isValid: props.initiallyValid,
                                      // touched: false
                              Severity: Minor
                              Found in src/components/UI/Input.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

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

                              const ScannerScreen = props => {
                                  const dispatch = useDispatch();
                                  const [items, setitems] = useState();
                                  const [hasPermission, setHasPermission] = useState(null);
                                  const [scanned, setScanned] = useState(false);
                              Severity: Minor
                              Found in src/screens/ScannerScreen.js - About 1 hr to fix

                                Function ManageList has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                const ManageList = props => {
                                
                                    const renderInventoryItem = (itemData, index) => {
                                        // console.log("manage list ", itemData)
                                
                                
                                Severity: Minor
                                Found in src/components/UI/ManageList.js - About 1 hr to fix

                                  Function submitHandler has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                                  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' }
                                  Severity: Minor
                                  Found in src/screens/EditItemScreen.js - About 1 hr to fix

                                    Function renderGridItem has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                        const renderGridItem = (itemData) => {
                                            return (
                                    
                                                <CategoryGridTile title={itemData.item.title}
                                                    iconValue={itemData.item.icon}
                                    Severity: Minor
                                    Found in src/screens/CategoriesScreen.js - About 1 hr to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language