codeforbtv/cvoeo-app

View on GitHub

Showing 33 of 83 total issues

File common.js has 539 lines of code (exceeds 250 allowed). Consider refactoring.
Open

// @flow
import colors from '../constants/colors';

const common = {
    bigBlock: {
Severity: Major
Found in styles/common.js - About 1 day to fix

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

        render() {
            const { actions, profile, completedGoals, incompleteGoals, submittedGoals, navigation } = this.props;
            const incentivesEarned = profile.incentivesEarned || 0;
            const incentivesAvailable = 750;
            const percentComplete = Math.floor((incentivesEarned / incentivesAvailable) * 100);
    Severity: Major
    Found in screens/dashboard/index.js - About 6 hrs to fix

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

          render() {
              const dots = this.icons.dots;
              const {navigation, uid, actions} = this.props;
              const goal = navigation.getParam('goal');
              const resetReminder = addDaysToDate(new Date());
      Severity: Major
      Found in screens/goal-details/index.js - About 5 hrs to fix

        Function render has 120 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/register.js - About 4 hrs to fix

          Function pullDataFromSftp has 116 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          exports.pullDataFromSftp= functions.https.onRequest((request, response) => {
            // TODO: add more error handlng to this function
             let clientOrGoalCSV = "";
             clientOrGoalCSV = request.body.clientOrGoalCSV;
             if (!(clientOrGoalCSV == 'client' || clientOrGoalCSV =='goal')) {
          Severity: Major
          Found in functions/index.js - About 4 hrs to fix

            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

            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

                  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

                      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

                        Function pullDataFromLocalCSVFileTEST has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        exports.pullDataFromLocalCSVFileTEST = functions.https.onRequest((request, response) => {
                          let fileContent="";
                          let pathToFile="";
                          let clientOrGoalCSV = "";
                          pathToFile = request.body.pathToFile;
                        Severity: Minor
                        Found in functions/index.js - About 1 hr to fix

                          Function showUpcoming has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                  const showUpcoming = (firstOrRemaining) => {
                          
                                      const upcoming = ((this.props.profile || []).upcomingArray || [])
                                          .filter(element => (((element.date.seconds) * 1000) > Date.now()))
                                          .sort((a, b) => a.date.seconds - b.date.seconds)
                          Severity: Minor
                          Found in components/upcoming.js - About 1 hr to fix

                            Function parseClientCSVAndSaveToFireStore has 47 lines of code (exceeds 25 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 1 hr to fix

                              Function upcoming has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                              .map((event, i) => {
                              
                                                  const {title, location, date} = event;
                                                  const momentDate = moment(new Date((date.seconds) * 1000));
                                                  const localDate = moment(momentDate.toISOString());
                              Severity: Minor
                              Found in components/upcoming.js - About 1 hr to fix

                                Function complete has 41 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: Minor
                                Found in functions/index.js - About 1 hr to fix

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

                                      render() {
                                          return (
                                              <SafeAreaView style={{flex: 1, backgroundColor: '#fff'}}>
                                                  <Text style={{ transform: [{ rotate: '90deg' }], position: 'absolute', zIndex: 100, bottom: 0, top: 0}}>Version {pkg.version}</Text>
                                                  <KeyboardAvoidingView
                                  Severity: Minor
                                  Found in screens/login/login-screen.js - About 1 hr to fix

                                    Function render has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                        render() {
                                            const { actions, profile, completedGoals, incompleteGoals, submittedGoals, navigation } = this.props;
                                            const incentivesEarned = profile.incentivesEarned || 0;
                                            const incentivesAvailable = 750;
                                            const percentComplete = Math.floor((incentivesEarned / incentivesAvailable) * 100);
                                    Severity: Minor
                                    Found in screens/dashboard/index.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