prokuranepal/inventory_app

View on GitHub

Showing 84 of 84 total issues

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

         <TouchableOpacity onPress={()=>showDate(true)} data-test="touchTime">
         <View style={styles.calendar} >
            <Text style={{marginLeft:20,   fontSize: 16, fontFamily: 'open-sans-bold',}}>{ newTime.toLocaleTimeString("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 168..172

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

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

        const newData = availableItems.filter(function (item) {
            //applying filter for the inserted text in search bar
            const itemData = item.title ? item.title.toUpperCase() : ''.toUpperCase();
            const textData = text1.toUpperCase();
            return itemData.indexOf(textData) > -1;
Severity: Major
Found in src/screens/ItemListScreen.js and 1 other location - About 2 hrs to fix
src/screens/ManageItemScreen.js on lines 17..22

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 91.

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

        const newData = availableItems.filter(function (item) {
            //applying filter for the inserted text in search bar
            const itemData = item.title ? item.title.toUpperCase() : ''.toUpperCase();
            const textData = text.toUpperCase();
            return itemData.indexOf(textData) > -1;
Severity: Major
Found in src/screens/ManageItemScreen.js and 1 other location - About 2 hrs to fix
src/screens/ItemListScreen.js on lines 47..52

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 91.

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

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

    const SupplierContactScreenNavigator = createStackNavigator({
        SupplierContact: SupplierContactScreen
    }, {
        navigationOptions: {
            drawerIcon: drawerConfig => (
    Severity: Major
    Found in src/navigation/InventoryNavigator.js and 1 other location - About 2 hrs to fix
    src/navigation/InventoryNavigator.js on lines 182..199

    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 86.

    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

    const CartScreenNavigator = createStackNavigator({
        Cart: CartScreen
    }, {
        navigationOptions: {
            drawerIcon: drawerConfig => (
    Severity: Major
    Found in src/navigation/InventoryNavigator.js and 1 other location - About 2 hrs to fix
    src/navigation/InventoryNavigator.js on lines 163..180

    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 86.

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

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

                    const styles = StyleSheet.create({
                        screen: {
                            margin: 20,
                            flex: 1
                        },
                    Severity: Major
                    Found in src/screens/CartScreen.js and 1 other location - About 1 hr to fix
                    src/screens/OrderScreen.js on lines 38..52

                    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 64.

                    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

                    const styles = StyleSheet.create({
                        screen: {
                            margin: 20,
                            flex: 1
                        },
                    Severity: Major
                    Found in src/screens/OrderScreen.js and 1 other location - About 1 hr to fix
                    src/screens/CartScreen.js on lines 115..130

                    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 64.

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

                      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

                      Severity
                      Category
                      Status
                      Source
                      Language