packages/core/src/period-picker/PeriodPicker.component.js

Summary

Maintainability
F
5 days
Test Coverage

File PeriodPicker.component.js has 279 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import React from 'react';
import PropTypes from 'prop-types';
import log from 'loglevel';
import SelectField from 'material-ui/SelectField';
import MenuItem from 'material-ui/MenuItem';
Severity: Minor
Found in packages/core/src/period-picker/PeriodPicker.component.js - About 2 hrs to fix

    Function getPeriod has 61 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        getPeriod() {
            const week = this.props.periodType === 'BiWeekly' && this.state.biWeek 
                ? biWeekToWeek(this.state.biWeek)
                : this.state.week;
            const date = this.state.year && week && getFirstDateOfWeek(this.state.year, week);
    Severity: Major
    Found in packages/core/src/period-picker/PeriodPicker.component.js - About 2 hrs to fix

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

          render() {
              const setDateState = (nothing, date) => {
                  const year = getYear(date);
                  const month = getTwoDigitMonth(date);
                  this.setState({ date, year, month }, this.handleChange);
      Severity: Major
      Found in packages/core/src/period-picker/PeriodPicker.component.js - About 2 hrs to fix

        Function getPeriod has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

            getPeriod() {
                const week = this.props.periodType === 'BiWeekly' && this.state.biWeek 
                    ? biWeekToWeek(this.state.biWeek)
                    : this.state.week;
                const date = this.state.year && week && getFirstDateOfWeek(this.state.year, week);
        Severity: Minor
        Found in packages/core/src/period-picker/PeriodPicker.component.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

        Avoid too many return statements within this function.
        Open

                    return false;
        Severity: Major
        Found in packages/core/src/period-picker/PeriodPicker.component.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                      return this.state.year && this.state.biWeek && `${this.state.year}BiW${this.state.biWeek}`;
          Severity: Major
          Found in packages/core/src/period-picker/PeriodPicker.component.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                        return date && isWeekValid(date, this.state.week) && `${getWeekYear(date)}SunW${this.state.week}`;
            Severity: Major
            Found in packages/core/src/period-picker/PeriodPicker.component.js - About 30 mins to fix

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

                      case 'Weekly':
                          if (date) {
                              this.setState({ invalidWeek: !isWeekValid(date, this.state.week) });
                          }
                          return date && isWeekValid(date, this.state.week) && `${getWeekYear(date)}W${this.state.week}`;
              Severity: Major
              Found in packages/core/src/period-picker/PeriodPicker.component.js and 4 other locations - About 2 hrs to fix
              packages/core/src/period-picker/PeriodPicker.component.js on lines 78..82
              packages/core/src/period-picker/PeriodPicker.component.js on lines 83..87
              packages/core/src/period-picker/PeriodPicker.component.js on lines 88..92
              packages/core/src/period-picker/PeriodPicker.component.js on lines 93..97

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

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

                      case 'WeeklyWednesday':
                          if (date) {
                              this.setState({ invalidWeek: !isWeekValid(date, this.state.week) });
                          }
                          return date && isWeekValid(date, this.state.week) && `${getWeekYear(date)}WedW${this.state.week}`;
              Severity: Major
              Found in packages/core/src/period-picker/PeriodPicker.component.js and 4 other locations - About 2 hrs to fix
              packages/core/src/period-picker/PeriodPicker.component.js on lines 73..77
              packages/core/src/period-picker/PeriodPicker.component.js on lines 83..87
              packages/core/src/period-picker/PeriodPicker.component.js on lines 88..92
              packages/core/src/period-picker/PeriodPicker.component.js on lines 93..97

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

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

                      case 'WeeklyThursday':
                          if (date) {
                              this.setState({ invalidWeek: !isWeekValid(date, this.state.week) });
                          }
                          return date && isWeekValid(date, this.state.week) && `${getWeekYear(date)}ThuW${this.state.week}`;
              Severity: Major
              Found in packages/core/src/period-picker/PeriodPicker.component.js and 4 other locations - About 2 hrs to fix
              packages/core/src/period-picker/PeriodPicker.component.js on lines 73..77
              packages/core/src/period-picker/PeriodPicker.component.js on lines 78..82
              packages/core/src/period-picker/PeriodPicker.component.js on lines 88..92
              packages/core/src/period-picker/PeriodPicker.component.js on lines 93..97

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

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

                      case 'WeeklySaturday':
                          if (date) {
                              this.setState({ invalidWeek: !isWeekValid(date, this.state.week) });
                          }
                          return date && isWeekValid(date, this.state.week) && `${getWeekYear(date)}SatW${this.state.week}`;
              Severity: Major
              Found in packages/core/src/period-picker/PeriodPicker.component.js and 4 other locations - About 2 hrs to fix
              packages/core/src/period-picker/PeriodPicker.component.js on lines 73..77
              packages/core/src/period-picker/PeriodPicker.component.js on lines 78..82
              packages/core/src/period-picker/PeriodPicker.component.js on lines 83..87
              packages/core/src/period-picker/PeriodPicker.component.js on lines 93..97

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

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

                      case 'WeeklySunday':
                          if (date) {
                              this.setState({ invalidWeek: !isWeekValid(date, this.state.week) });
                          }
                          return date && isWeekValid(date, this.state.week) && `${getWeekYear(date)}SunW${this.state.week}`;
              Severity: Major
              Found in packages/core/src/period-picker/PeriodPicker.component.js and 4 other locations - About 2 hrs to fix
              packages/core/src/period-picker/PeriodPicker.component.js on lines 73..77
              packages/core/src/period-picker/PeriodPicker.component.js on lines 78..82
              packages/core/src/period-picker/PeriodPicker.component.js on lines 83..87
              packages/core/src/period-picker/PeriodPicker.component.js on lines 88..92

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

              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

                      case 'SixMonthlyApril':
                          return (
                              <div style={styles.line}>
                                  {this.renderYearPicker()}
                                  {this.renderOptionPicker('sixMonth', { 1: 'apr-sep', 2: 'oct-mar' })}
              Severity: Major
              Found in packages/core/src/period-picker/PeriodPicker.component.js and 2 other locations - About 1 hr to fix
              packages/core/src/period-picker/PeriodPicker.component.js on lines 255..261
              packages/core/src/period-picker/PeriodPicker.component.js on lines 269..275

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

                      case 'SixMonthlyNov':
                          return (
                              <div style={styles.line}>
                                  {this.renderYearPicker()}
                                  {this.renderOptionPicker('sixMonth', { 1: 'nov-apr', 2: 'may-oct' })}
              Severity: Major
              Found in packages/core/src/period-picker/PeriodPicker.component.js and 2 other locations - About 1 hr to fix
              packages/core/src/period-picker/PeriodPicker.component.js on lines 255..261
              packages/core/src/period-picker/PeriodPicker.component.js on lines 262..268

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

                      case 'SixMonthly':
                          return (
                              <div style={styles.line}>
                                  {this.renderYearPicker()}
                                  {this.renderOptionPicker('sixMonth', { 1: 'jan-jun', 2: 'jul-dec' })}
              Severity: Major
              Found in packages/core/src/period-picker/PeriodPicker.component.js and 2 other locations - About 1 hr to fix
              packages/core/src/period-picker/PeriodPicker.component.js on lines 262..268
              packages/core/src/period-picker/PeriodPicker.component.js on lines 269..275

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

                      case 'Quarterly':
                          return this.state.year && this.state.quarter && `${this.state.year}Q${this.state.quarter}`;
              Severity: Major
              Found in packages/core/src/period-picker/PeriodPicker.component.js and 5 other locations - About 1 hr to fix
              packages/core/src/period-picker/PeriodPicker.component.js on lines 103..104
              packages/core/src/period-picker/PeriodPicker.component.js on lines 105..106
              packages/core/src/period-picker/PeriodPicker.component.js on lines 109..110
              packages/core/src/period-picker/PeriodPicker.component.js on lines 111..112
              packages/core/src/period-picker/PeriodPicker.component.js on lines 113..114

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

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

                      case 'BiMonthly':
                          return this.state.year && this.state.biMonth && `${this.state.year}0${this.state.biMonth}B`;
              Severity: Major
              Found in packages/core/src/period-picker/PeriodPicker.component.js and 5 other locations - About 1 hr to fix
              packages/core/src/period-picker/PeriodPicker.component.js on lines 103..104
              packages/core/src/period-picker/PeriodPicker.component.js on lines 107..108
              packages/core/src/period-picker/PeriodPicker.component.js on lines 109..110
              packages/core/src/period-picker/PeriodPicker.component.js on lines 111..112
              packages/core/src/period-picker/PeriodPicker.component.js on lines 113..114

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

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

                      case 'SixMonthlyApril':
                          return this.state.year && this.state.sixMonth && `${this.state.year}AprilS${this.state.sixMonth}`;
              Severity: Major
              Found in packages/core/src/period-picker/PeriodPicker.component.js and 5 other locations - About 1 hr to fix
              packages/core/src/period-picker/PeriodPicker.component.js on lines 103..104
              packages/core/src/period-picker/PeriodPicker.component.js on lines 105..106
              packages/core/src/period-picker/PeriodPicker.component.js on lines 107..108
              packages/core/src/period-picker/PeriodPicker.component.js on lines 109..110
              packages/core/src/period-picker/PeriodPicker.component.js on lines 113..114

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

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

                      case 'SixMonthly':
                          return this.state.year && this.state.sixMonth && `${this.state.year}S${this.state.sixMonth}`;
              Severity: Major
              Found in packages/core/src/period-picker/PeriodPicker.component.js and 5 other locations - About 1 hr to fix
              packages/core/src/period-picker/PeriodPicker.component.js on lines 103..104
              packages/core/src/period-picker/PeriodPicker.component.js on lines 105..106
              packages/core/src/period-picker/PeriodPicker.component.js on lines 107..108
              packages/core/src/period-picker/PeriodPicker.component.js on lines 111..112
              packages/core/src/period-picker/PeriodPicker.component.js on lines 113..114

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

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

                      case 'Monthly':
                          return this.state.year && this.state.month && `${this.state.year}${this.state.month}`;
              Severity: Major
              Found in packages/core/src/period-picker/PeriodPicker.component.js and 5 other locations - About 1 hr to fix
              packages/core/src/period-picker/PeriodPicker.component.js on lines 105..106
              packages/core/src/period-picker/PeriodPicker.component.js on lines 107..108
              packages/core/src/period-picker/PeriodPicker.component.js on lines 109..110
              packages/core/src/period-picker/PeriodPicker.component.js on lines 111..112
              packages/core/src/period-picker/PeriodPicker.component.js on lines 113..114

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

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

                      case 'SixMonthlyNov':
                          return this.state.year && this.state.sixMonth && `${this.state.year}NovS${this.state.sixMonth}`;
              Severity: Major
              Found in packages/core/src/period-picker/PeriodPicker.component.js and 5 other locations - About 1 hr to fix
              packages/core/src/period-picker/PeriodPicker.component.js on lines 103..104
              packages/core/src/period-picker/PeriodPicker.component.js on lines 105..106
              packages/core/src/period-picker/PeriodPicker.component.js on lines 107..108
              packages/core/src/period-picker/PeriodPicker.component.js on lines 109..110
              packages/core/src/period-picker/PeriodPicker.component.js on lines 111..112

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

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

                      case 'WeeklySunday':
                          return <div style={styles.line}>{this.renderYearPicker()}{this.renderWeekPicker()}</div>;
              Severity: Major
              Found in packages/core/src/period-picker/PeriodPicker.component.js and 4 other locations - About 40 mins to fix
              packages/core/src/period-picker/PeriodPicker.component.js on lines 247..248
              packages/core/src/period-picker/PeriodPicker.component.js on lines 249..250
              packages/core/src/period-picker/PeriodPicker.component.js on lines 251..252
              packages/core/src/period-picker/PeriodPicker.component.js on lines 253..254

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

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

                      case 'Monthly':
                          return <div style={styles.line}>{this.renderYearPicker()}{this.renderMonthPicker()}</div>;
              Severity: Major
              Found in packages/core/src/period-picker/PeriodPicker.component.js and 4 other locations - About 40 mins to fix
              packages/core/src/period-picker/PeriodPicker.component.js on lines 245..246
              packages/core/src/period-picker/PeriodPicker.component.js on lines 247..248
              packages/core/src/period-picker/PeriodPicker.component.js on lines 251..252
              packages/core/src/period-picker/PeriodPicker.component.js on lines 253..254

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

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

                      case 'BiMonthly':
                          return <div style={styles.line}>{this.renderYearPicker()}{this.renderBiMonthPicker()}</div>;
              Severity: Major
              Found in packages/core/src/period-picker/PeriodPicker.component.js and 4 other locations - About 40 mins to fix
              packages/core/src/period-picker/PeriodPicker.component.js on lines 245..246
              packages/core/src/period-picker/PeriodPicker.component.js on lines 247..248
              packages/core/src/period-picker/PeriodPicker.component.js on lines 249..250
              packages/core/src/period-picker/PeriodPicker.component.js on lines 253..254

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

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

                      case 'BiWeekly':
                          return <div style={styles.line}>{this.renderYearPicker()}{this.renderBiWeekPicker()}</div>;
              Severity: Major
              Found in packages/core/src/period-picker/PeriodPicker.component.js and 4 other locations - About 40 mins to fix
              packages/core/src/period-picker/PeriodPicker.component.js on lines 245..246
              packages/core/src/period-picker/PeriodPicker.component.js on lines 249..250
              packages/core/src/period-picker/PeriodPicker.component.js on lines 251..252
              packages/core/src/period-picker/PeriodPicker.component.js on lines 253..254

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

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

                      case 'Quarterly':
                          return <div style={styles.line}>{this.renderYearPicker()}{this.renderQuarterPicker()}</div>;
              Severity: Major
              Found in packages/core/src/period-picker/PeriodPicker.component.js and 4 other locations - About 40 mins to fix
              packages/core/src/period-picker/PeriodPicker.component.js on lines 245..246
              packages/core/src/period-picker/PeriodPicker.component.js on lines 247..248
              packages/core/src/period-picker/PeriodPicker.component.js on lines 249..250
              packages/core/src/period-picker/PeriodPicker.component.js on lines 251..252

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

              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

              There are no issues that match your filters.

              Category
              Status