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: {
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);
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());
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, {
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')) {
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.
- Read upRead up
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, {
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;
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');
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'.
- Read upRead up
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'.
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';
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");
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;
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)
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.
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());
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");
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
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);
- Read upRead up
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"