prokuranepal/inventory_app

View on GitHub

Showing 35 of 84 total issues

Function itemsReducer has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

const itemsReducer = (state = initialState, action) => {
    switch (action.type) {
        case SET_ITEMS:
            return {
                ...state,
Severity: Minor
Found in src/store/reducers/items.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 render has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    render() {

        let headingText = null;
        let confirmPasswordControl = null;

Severity: Minor
Found in src/screens/AuthScreen.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 TestInput has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const TestInput = (props) => {
    let textInput = <TextInput
    data-test="container1"
        style={styles.input}
        {...props}
Severity: Minor
Found in src/components/Component/testInput.js - About 1 hr to fix

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

    const SupplierContactScreen = props => {
    
        const dialCall = () => {
    
            let phoneNumber = '';
    Severity: Minor
    Found in src/screens/SupplierContactScreen.js - About 1 hr to fix

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

      const ManageItemScreen = props => {
          const availableItems = useSelector(state => state.items.items);
          const [text, settext] = useState('');
          const [dataSource, setdataSource] = useState('');
      
      
      Severity: Minor
      Found in src/screens/ManageItemScreen.js - About 1 hr to fix

        Function ItemList has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const ItemList = props => {
        
            const renderInventoryItem = itemData => {
        
                return (
        Severity: Minor
        Found in src/components/UI/ItemList.js - About 1 hr to fix

          Function signUp has 33 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export const signUp = (email, password) => {
              // console.log("authentication", email, password)
              return async dispatch => {
                  const data = {
          
          
          Severity: Minor
          Found in src/store/actions/auth.js - About 1 hr to fix

            Function AddScreen has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

            const AddScreen = props => {
            
                const selectedItem = useSelector(state =>
                    state.items.items
                );
            Severity: Minor
            Found in src/screens/AddScreen.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 login has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export const login = (email, password) => {
                return async (dispatch, getState) => {
                    const data = {
            
                        username: email,
            Severity: Minor
            Found in src/store/actions/auth.js - About 1 hr to fix

              Function deleteHandler has 30 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  const deleteHandler = useCallback(() => {
                    let action =
                      itemsActions.deleteItem(
                        itemId
                      )
              Severity: Minor
              Found in src/screens/EditItemScreen.js - About 1 hr to fix

                Function ItemCategoryScreen has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

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

                  Function SendScreen has a Cognitive Complexity of 10 (exceeds 5 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: Minor
                  Found in src/screens/SendScreen.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

                  Avoid too many return statements within this function.
                  Open

                      return state;
                  Severity: Major
                  Found in src/store/reducers/cart.js - About 30 mins to fix

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

                    const ItemListScreen = props => {
                    
                        const catTitle = props.navigation.getParam('title');
                        const [text, settext] = useState('');
                        const [dataSource, setdataSource] = useState('');
                    Severity: Minor
                    Found in src/screens/ItemListScreen.js - 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

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

                    export const signUp = (email, password) => {
                        // console.log("authentication", email, password)
                        return async dispatch => {
                            const data = {
                    
                    
                    Severity: Minor
                    Found in src/store/actions/auth.js - 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