codeforbtv/cvoeo-app

View on GitHub

Showing 83 of 83 total issues

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

                        <TouchableHighlight
                            onPress={update({remind: resetReminder(3)})}
                            style={[myStyles.detailButton, {backgroundColor: '#FFD4C6'}]}
                        >
                            <Text style={myStyles.detailButtonText}>in 3 days</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 211..216
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

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

                        <TouchableHighlight
                            onPress={update({remind: resetReminder(7)})}
                            style={[myStyles.detailButton, {backgroundColor: '#F6F4D6'}]}
                        >
                            <Text style={myStyles.detailButtonText}>in 1 week</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 211..216
screens/goal-details/index.js on lines 217..222

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

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

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

                      <LinearGradient
                          colors={['#fff', '#EFF0BE']}
                          style={
                              {
                                  position: 'absolute',
      Severity: Major
      Found in screens/goal-details/index.js and 1 other location - About 1 hr to fix
      screens/dashboard/index.js on lines 190..202

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

      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

                      <LinearGradient
                          colors={['#fff', '#04a0c6']}
                          style={
                              {
                                  position: 'absolute',
      Severity: Major
      Found in screens/dashboard/index.js and 1 other location - About 1 hr to fix
      screens/goal-details/index.js on lines 181..193

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

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

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

              const statusIcon = R.cond([
                  [goal => Boolean(goal.completed), () => 'check-circle'],
                  [goal => Boolean(goal.submittedForReview), () => 'dot-circle'],
                  [R.T, () => 'circle']
              ]);
              Severity: Major
              Found in components/goal-message-box/index.js and 1 other location - About 1 hr to fix
              components/goal-message-box/index.js on lines 22..26

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

              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 status = R.cond([
                  [goal => Boolean(goal.completed), () => 'Done!'],
                  [goal => Boolean(goal.submittedForReview), () => 'Submitted!'],
                  [R.T, () => 'Submit?']
              ]);
              Severity: Major
              Found in components/goal-message-box/index.js and 1 other location - About 1 hr to fix
              components/goal-message-box/index.js on lines 16..20

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

              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 constructor has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                  constructor(args = {}) {
                      this.id = typeof args.id === 'string'
                          ? args.id
                          : null;
                      this.parentGoalId = typeof args.parentGoalId === 'string'
              Severity: Minor
              Found in models/goal.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 34 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  render() {
                      return (
                          <View style={{marginBottom: 10, backgroundColor: '#04a0c6'}}>
                              <View>
                                  <Text style={styles.label}>{'Username'}</Text>
              Severity: Minor
              Found in components/login-form.js - About 1 hr to fix

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

                            "User uid: " + this.useruid + "\n" +
                            "Goal uid: " + this.goaluid + "\n" +
                            "Goal category: " + this.goalCategory + "\n" +
                            "Goal date: " + this.goalDate + "\n" +
                Severity: Major
                Found in functions/models/goal.js and 1 other location - About 1 hr to fix
                functions/models/user.js on lines 22..25

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

                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

                        "uid: " + this.uid + "\n" +
                        "First name: " + this.firstName + "\n" +
                        "Last name: " + this.lastName + "\n" +
                        "email: " + this.email + "\n")
                Severity: Major
                Found in functions/models/user.js and 1 other location - About 1 hr to fix
                functions/models/goal.js on lines 23..26

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

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

                export function reducers(state = initialState.login, action) {
                    switch (action.type) {
                        case types.FETCH_GOALS_FAIL:
                            return {
                                ...state,
                Severity: Minor
                Found in screens/dashboard/reducers.js - About 1 hr to fix

                  Function reducers has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export function reducers(state = initialState.login, action) {
                      switch (action.type) {
                          case types.FETCH_GOALS_FAIL:
                              return {
                                  ...state,
                  Severity: Minor
                  Found in screens/goal-details/reducers.js - About 1 hr to fix

                    Function constructor has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        constructor(args = {}) {
                            this.id = typeof args.id === 'string'
                                ? args.id
                                : null;
                            this.parentGoalId = typeof args.parentGoalId === 'string'
                    Severity: Minor
                    Found in models/goal.js - About 1 hr to fix
                      Severity
                      Category
                      Status
                      Source
                      Language