prokuranepal/inventory_app

View on GitHub

Showing 84 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

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

      SupplierContactScreen.navigationOptions = navData => {
          return {
              headerTitle: "Supplier Contact",
              headerStyle: {
                  backgroundColor: Platform.OS === 'android' ? Colors.primaryColor : ''
      Severity: Major
      Found in src/screens/SupplierContactScreen.js and 2 other locations - About 5 hrs to fix
      src/screens/CartScreen.js on lines 96..113
      src/screens/SettingsScreen.js on lines 20..37

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 141.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

      CartScreen.navigationOptions = navData => {
          return {
              headerTitle: "Your Cart",
              headerStyle: {
                  backgroundColor: Platform.OS === 'android' ? Colors.primaryColor : ''
      Severity: Major
      Found in src/screens/CartScreen.js and 2 other locations - About 5 hrs to fix
      src/screens/SettingsScreen.js on lines 20..37
      src/screens/SupplierContactScreen.js on lines 63..80

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 141.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

      SettingsScreen.navigationOptions = navData => {
          return {
              headerTitle: "Setting",
              headerStyle: {
                  backgroundColor: Platform.OS === 'android' ? Colors.primaryColor : ''
      Severity: Major
      Found in src/screens/SettingsScreen.js and 2 other locations - About 5 hrs to fix
      src/screens/CartScreen.js on lines 96..113
      src/screens/SupplierContactScreen.js on lines 63..80

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 141.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      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

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

                  <View style={styles.SectionStyle}>
                      <Ionicons style={styles.ImageStyle}
                          name={Platform.OS === 'android' ? 'md-search' : 'ios-search'}
                          size={20} color="#000" />
                      <TextInput
      Severity: Major
      Found in src/screens/ItemListScreen.js and 1 other location - About 5 hrs to fix
      src/screens/ManageItemScreen.js on lines 28..42

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 138.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

                  <View style={styles.SectionStyle}>
                      <Ionicons style={styles.ImageStyle}
                          name={Platform.OS === 'android' ? 'md-search' : 'ios-search'}
                          size={20} color="#000" />
                      <TextInput
      Severity: Major
      Found in src/screens/ManageItemScreen.js and 1 other location - About 5 hrs to fix
      src/screens/ItemListScreen.js on lines 63..77

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 138.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      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

          Identical blocks of code found in 3 locations. Consider refactoring.
          Open

            const pickerSelectStyles = StyleSheet.create({
              inputIOS: {
                fontSize: 16,
                paddingVertical: 12,
                paddingHorizontal: 10,
          Severity: Major
          Found in src/screens/SendScreen.js and 2 other locations - About 4 hrs to fix
          src/screens/AddScreen.js on lines 238..263
          src/screens/EditItemScreen.js on lines 403..428

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 127.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Identical blocks of code found in 3 locations. Consider refactoring.
          Open

          const pickerSelectStyles = StyleSheet.create({
              inputIOS: {
                  fontSize: 16,
                  paddingVertical: 12,
                  paddingHorizontal: 10,
          Severity: Major
          Found in src/screens/AddScreen.js and 2 other locations - About 4 hrs to fix
          src/screens/EditItemScreen.js on lines 403..428
          src/screens/SendScreen.js on lines 263..288

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 127.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Identical blocks of code found in 3 locations. Consider refactoring.
          Open

          const pickerSelectStyles = StyleSheet.create({
            inputIOS: {
              fontSize: 16,
              paddingVertical: 12,
              paddingHorizontal: 10,
          Severity: Major
          Found in src/screens/EditItemScreen.js and 2 other locations - About 4 hrs to fix
          src/screens/AddScreen.js on lines 238..263
          src/screens/SendScreen.js on lines 263..288

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 127.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          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

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                export const ITEMS = [
                
                  new Item(
                    'i1',
                    'Paracetamol',
                Severity: Major
                Found in src/data/dummy-data.js and 1 other location - About 3 hrs to fix
                src/store/reducers/orders.js on lines 7..110

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 110.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                    requestedItems:[
                        new Item(
                          'i1',
                          'Paracetamol',
                          10,
                Severity: Major
                Found in src/store/reducers/orders.js and 1 other location - About 3 hrs to fix
                src/data/dummy-data.js on lines 35..149

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 110.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                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

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                           <TouchableOpacity onPress={()=>showDate(true)} data-test="touchDate" >
                           <View style={styles.calendar} >
                              <Text style={{marginLeft:20,   fontSize: 16, fontFamily: 'open-sans-bold',}}>{ newDate.toLocaleDateString("en-US", options)}</Text>
                            </View>
                            </TouchableOpacity>
                  Severity: Major
                  Found in src/screens/SendScreen.js and 1 other location - About 3 hrs to fix
                  src/screens/SendScreen.js on lines 185..189

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 102.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Severity
                  Category
                  Status
                  Source
                  Language