codeforbtv/cvoeo-app

View on GitHub

Showing 83 of 83 total issues

Function parseClientCSVAndSaveToFireStore has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

 function parseClientCSVAndSaveToFireStore(fileContent) {
  // TODO: Ideally data validation will be handled in the user/goal class but add any validations that are needed here
   Papa.parse(fileContent, {
    //papaparse (https://www.papaparse.com)returns 'results' which has an array 'data'.
    // Each entry in 'data' is an object, a set of key/values that match the header at the head of the csv file.
Severity: Minor
Found in functions/index.js - About 4 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

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

export function logout() {
    return (dispatch: Object => *) => {
        dataSource.logout()
            .then((results) => {
                dispatch({
Severity: Major
Found in screens/goal-details/actions.js and 1 other location - About 4 hrs to fix
screens/dashboard/actions.js on lines 8..21

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

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 2 locations. Consider refactoring.
Open

export function logout() {
    return (dispatch: Object => *) => {
        dataSource.logout()
            .then((results) => {
                dispatch({
Severity: Major
Found in screens/dashboard/actions.js and 1 other location - About 4 hrs to fix
screens/goal-details/actions.js on lines 8..21

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

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 render has 88 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    render() {
        return (
            <SafeAreaView style={{flex: 1, backgroundColor: '#04a0c6' }}>
                <View style={styles.frame}>
                    <View style={[styles.container, {
Severity: Major
Found in screens/login/forgot-password.js - About 3 hrs to fix

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

        render() {
    
            let icon = icons.open;
            if (this.state.expanded) {
                icon = icons.close;
    Severity: Major
    Found in components/upcoming.js - About 3 hrs to fix

      File index.js has 302 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      const functions = require('firebase-functions');
      const Client = require('ssh2-sftp-client');
      const AdmZip = require('adm-zip');
      const sort = require('fast-sort');
      const Papa = require('papaparse');
      Severity: Minor
      Found in functions/index.js - About 3 hrs to fix

        Function parseGoalCSVAndSaveToFireStore has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
        Open

            function parseGoalCSVAndSaveToFireStore(fileContent) {
              //*** Known issue: When parsing a csv file with multiple lines that have goal data, saving to firestore is not working properly */
             // TODO: Ideally data validation will be handles in the user class but add any validations that are needed here
              Papa.parse(fileContent, {
               //papaparse (https://www.papaparse.com)returns 'results' which has an array 'data'.
        Severity: Minor
        Found in functions/index.js - About 2 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 3 locations. Consider refactoring.
        Open

            static create(args: ?Object = {}, id?: string) {
                const _args = {...args};
                if (Boolean(id)) {
                    _args.id = id;
                }
        Severity: Major
        Found in models/goal.js and 2 other locations - About 2 hrs to fix
        models/reminder.js on lines 32..39
        models/user.js on lines 36..43

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

        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

            static create(args: ?Object = {}, id?: string) {
                const _args = {...args};
                if (Boolean(id)) {
                    _args.id = id;
                }
        Severity: Major
        Found in models/reminder.js and 2 other locations - About 2 hrs to fix
        models/goal.js on lines 49..56
        models/user.js on lines 36..43

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

        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

            static create(args: ?Object = {}, id?: string) {
                const _args = {...args};
                if (Boolean(id)) {
                    _args.id = id;
                }
        Severity: Major
        Found in models/user.js and 2 other locations - About 2 hrs to fix
        models/goal.js on lines 49..56
        models/reminder.js on lines 32..39

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

        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 2 locations. Consider refactoring.
        Open

            onButtonPress() {
                if (isValidEmail(this.state.email)) {
                    this.props.actions.resetPassword(this.state.email);
                    this.setState({ passwordResetSent: true });
                } else {
        Severity: Major
        Found in screens/login/register.js and 1 other location - About 2 hrs to fix
        screens/login/forgot-password.js on lines 40..47

        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

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

            onButtonPress() {
                if (isValidEmail(this.state.email)) {
                    this.props.actions.resetPassword(this.state.email);
                    this.setState({ passwordResetSent: true });
                } else {
        Severity: Major
        Found in screens/login/forgot-password.js and 1 other location - About 2 hrs to fix
        screens/login/register.js on lines 40..47

        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 parseGoalCSVAndSaveToFireStore has 63 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function parseGoalCSVAndSaveToFireStore(fileContent) {
              //*** Known issue: When parsing a csv file with multiple lines that have goal data, saving to firestore is not working properly */
             // TODO: Ideally data validation will be handles in the user class but add any validations that are needed here
              Papa.parse(fileContent, {
               //papaparse (https://www.papaparse.com)returns 'results' which has an array 'data'.
        Severity: Major
        Found in functions/index.js - About 2 hrs to fix

          File index.js has 270 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          // @flow
          
          import React, { Component } from 'react';
          import { bindActionCreators } from 'redux';
          import { Container } from 'native-base';
          Severity: Minor
          Found in screens/dashboard/index.js - About 2 hrs to fix

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

                constructor(props) {
                    super(props);
                    this.onButtonPress = this.onButtonPress.bind(this);
                    this.onChangeState = this.onChangeState.bind(this);
                    this.state = { email: '', passwordResetSent: false };
            Severity: Major
            Found in screens/login/forgot-password.js and 1 other location - About 2 hrs to fix
            screens/login/register.js on lines 27..32

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

            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 2 locations. Consider refactoring.
            Open

                constructor(props) {
                    super(props);
                    this.onButtonPress = this.onButtonPress.bind(this);
                    this.onChangeState = this.onChangeState.bind(this);
                    this.state = { email: '', passwordResetSent: false };
            Severity: Major
            Found in screens/login/register.js and 1 other location - About 2 hrs to fix
            screens/login/forgot-password.js on lines 27..32

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

            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 2 locations. Consider refactoring.
            Open

                ellipsisLogoutAlert() {
                    const logoutCallback = this.props.actions.logout;
            
                    Alert.alert(
                        'Do you want to logout?',
            Severity: Major
            Found in screens/dashboard/index.js and 1 other location - About 2 hrs to fix
            screens/goal-details/index.js on lines 87..99

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

            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 2 locations. Consider refactoring.
            Open

                ellipsisLogoutAlert() {
                    const logoutCallback = this.props.actions.logout;
            
                    Alert.alert(
                        'Do you want to logout?',
            Severity: Major
            Found in screens/goal-details/index.js and 1 other location - About 2 hrs to fix
            screens/dashboard/index.js on lines 87..99

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

            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 complete has 57 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                     complete: function(results) {
                       console.log("Found "+ results.data.length + " lines in file content\n");
                       for (let i = 0;i<results.data.length ;i++) {
                         if(!results.data[i]['System Name ID']) {          
                           console.log ("Missing 'System Name ID' field in file. This field is mandatory for creating and updating data in db"); 
            Severity: Major
            Found in functions/index.js - About 2 hrs to fix

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

                                      <TouchableHighlight
                                          onPress={update({remind: resetReminder(1)})}
                                          style={[myStyles.detailButton, {backgroundColor: '#F88E6D'}]}
                                      >
                                          <Text style={myStyles.detailButtonText}>tomorrow</Text>
              Severity: Major
              Found in screens/goal-details/index.js and 2 other locations - About 2 hrs to fix
              screens/goal-details/index.js on lines 217..222
              screens/goal-details/index.js on lines 223..228

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

              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