onejgordon/flow-dashboard

View on GitHub
src/js/components/MiniJournalWidget.js

Summary

Maintainability
D
1 day
Test Coverage

File MiniJournalWidget.js has 321 lines of code (exceeds 250 allowed). Consider refactoring.
Open

var React = require('react');
import PropTypes from 'prop-types';
import {Link} from 'react-router';
var AppConstants = require('constants/AppConstants');
var MobileDialog = require('components/common/MobileDialog');
Severity: Minor
Found in src/js/components/MiniJournalWidget.js - About 3 hrs to fix

    MiniJournalWidget has 25 functions (exceeds 20 allowed). Consider refactoring.
    Open

    @changeHandler
    export default class MiniJournalWidget extends React.Component {
      static propTypes = {
        include_location: PropTypes.bool,
        tomorrow_top_tasks: PropTypes.bool,
    Severity: Minor
    Found in src/js/components/MiniJournalWidget.js - About 2 hrs to fix

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

        render() {
          let {form, open, submitted_date} = this.state;
          let {questions} = this.props;
          let in_window = this.in_journal_window();
          let actions = [
      Severity: Minor
      Found in src/js/components/MiniJournalWidget.js - About 1 hr to fix

        Function render_history_section has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          render_history_section() {
            let {historical, historical_date, historical_incomplete_dates, today} = this.state;
            let _selector;
            if (historical) {
              let today = util.printDateObj(this.current_submission_date());
        Severity: Minor
        Found in src/js/components/MiniJournalWidget.js - About 1 hr to fix

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

            change_task(i, event) {
              let {tasks} = this.state;
              tasks[i] = event.target.value;
              this.setState({tasks});
            }
          Severity: Major
          Found in src/js/components/MiniJournalWidget.js and 1 other location - About 1 hr to fix
          src/js/components/common/ReactJsonEditor.js on lines 62..66

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

          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

            static propTypes = {
              include_location: PropTypes.bool,
              tomorrow_top_tasks: PropTypes.bool,
              questions: PropTypes.array,
              window_start_hr: PropTypes.number,
          Severity: Major
          Found in src/js/components/MiniJournalWidget.js and 1 other location - About 1 hr to fix
          src/js/components/common/ProgressLine.js on lines 8..15

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

                          <MenuItem key="refresh" primaryText="Refresh" onClick={this.maybe_check_if_not_submitted.bind(this)} leftIcon={<FontIcon className="material-icons">refresh</FontIcon>} />
          Severity: Major
          Found in src/js/components/MiniJournalWidget.js and 6 other locations - About 1 hr to fix
          src/js/components/HabitWidget.js on lines 430..430
          src/js/components/HabitWidget.js on lines 432..432
          src/js/components/ProjectViewer.js on lines 247..247
          src/js/components/ReadWidget.js on lines 138..138
          src/js/components/ReadWidget.js on lines 139..139
          src/js/components/ReadWidget.js on lines 140..140

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

          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

                          <Link to="/app/journal/history"><MenuItem key="hist" primaryText="Journal History" leftIcon={<FontIcon className="material-icons">list</FontIcon>} /></Link>
          Severity: Major
          Found in src/js/components/MiniJournalWidget.js and 1 other location - About 1 hr to fix
          src/js/components/analysis/AnalysisMisc.js on lines 121..121

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

          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

                      <JournalEditor ref="je" form={form} onChange={this.journal_form_change.bind(this)} questions={questions} />
          Severity: Minor
          Found in src/js/components/MiniJournalWidget.js and 1 other location - About 30 mins to fix
          src/js/components/JournalHistory.js on lines 102..105

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

          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