onejgordon/flow-dashboard

View on GitHub

Showing 241 of 434 total issues

Function doc_from_fields has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

    def doc_from_fields(self, text_fields=None, atom_fields=None, repeated_attom_fields=None):
        fields = []
        if text_fields:
            for tf in text_fields:
                fields.append(search.TextField(name=tf, value=getattr(self, tf)))
Severity: Minor
Found in models.py - About 3 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 aggregate_activity_durations has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

    def aggregate_activity_durations(self, date):
        '''
        Return mapping of activity (str) to seconds of duration on date
        '''
        start = datetime.combine(date, time(0, 0))
Severity: Minor
Found in services/gfit.py - About 3 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_content has 83 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  render_content() {
    let {habit, days} = this.props;
    let {habitdays} = this.state;
    let _squares = [];
    let cursor = new Date();
Severity: Major
Found in src/js/components/HabitAnalysis.js - About 3 hrs to fix

    Function evernote_webhook has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

        def evernote_webhook(self, d):
            '''
            Evernote notifies us of a change
    
            Webhook request for note creation of the form:
    Severity: Minor
    Found in api.py - About 3 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_annual_viewer has 76 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        render_annual_viewer() {
            let {form, annual_viewer_journals, data_ranges} = this.state
            let options = this.numeric_questions().map((q) => {
                return {value: q.name, label: q.text}
            })
    Severity: Major
    Found in src/js/components/analysis/AnalysisJournals.js - About 3 hrs to fix

      File AppConstants.js has 292 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      var AppConstants = {
          YEAR: "2017",
          SITENAME: "Flow",
          AUTHOR: "Jeremy Gordon",
          AUTHOR_URL: "http://jgordon.io",
      Severity: Minor
      Found in src/js/constants/AppConstants.js - About 3 hrs to fix

        Function _habit_status has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
        Open

            def _habit_status(self):
                habits = Habit.All(self.user)
                today = self.user.local_time().date()
                habitday_keys = [ndb.Key('HabitDay', HabitDay.ID(h, today), parent=self.user.key) for h in habits]
                habitdays = ndb.get_multi(habitday_keys)
        Severity: Minor
        Found in services/agent.py - 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

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

              render() {
                  let {form, batch_dialog_open} = this.state;
                  let {user} = this.props;
                  if (!user) return <div></div>
                  let DOB = this.props.user.birthday;
          Severity: Major
          Found in src/js/components/Timeline.js - About 2 hrs to fix

            Function Update has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
            Open

                def Update(self, **params):
                    from constants import TASK_DONE_REPLIES
                    message = None
                    if 'title' in params:
                        self.title = params.get('title')
            Severity: Minor
            Found in models.py - 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 render has 68 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              render() {
                let {form} = this.state;
                let {fts_url} = this.props;
                let _search_box;
                var _items = this.state.items.map(function(item, i, arr) {
            Severity: Major
            Found in src/js/components/common/FetchedList.js - About 2 hrs to fix

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

                  render() {
                      let {user} = this.props;
                      let _feedback;
                      if (user) _feedback = (
                          <div>
              Severity: Major
              Found in src/js/components/About.js - About 2 hrs to fix

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

                  render() {
                    let {readable} = this.props;
                    let {form, editing} = this.state;
                    let title, content;
                    let open = readable != null;
                Severity: Major
                Found in src/js/components/ReadingDetail.js - About 2 hrs to fix

                  Function batch_create has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def batch_create(self, d):
                          try:
                              events = json.loads(self.request.get('events'))
                          except ValueError, e:
                              self.message = "Malformed JSON"
                  Severity: Minor
                  Found in api.py - 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 Create has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def Create(user, activity=None, place=None, people=None, metrics=None, lat=None, lon=None, date=None):
                          if not date:
                              date = datetime.now()
                          location = activity_sub = None
                          if lat and lon:
                  Severity: Minor
                  Found in models.py - 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

                  File GoalViewer.js has 272 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  var React = require('react');
                  import { RaisedButton, FlatButton, TextField,
                    IconButton, Slider } from 'material-ui';
                  var MobileDialog = require('components/common/MobileDialog');
                  var api = require('utils/api');
                  Severity: Minor
                  Found in src/js/components/GoalViewer.js - About 2 hrs to fix

                    Function render_goal has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      render_goal(g, type) {
                        let {assessment_form, assessment_showing} = this.state;
                        let goal_list, create_prompt, assess_prompt
                        let date_printed = "";
                        let date = new Date();
                    Severity: Major
                    Found in src/js/components/GoalViewer.js - About 2 hrs to fix

                      ConversationAgent has 23 functions (exceeds 20 allowed). Consider refactoring.
                      Open

                      class ConversationAgent(object):
                      
                          COMPLY_BANTER = [
                              "Sure",
                              "No problem",
                      Severity: Minor
                      Found in services/agent.py - About 2 hrs to fix

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

                          render() {
                            let {project} = this.props;
                            let title, subhead;
                            let links;
                            if (!project || !project.urls) return null;
                        Severity: Major
                        Found in src/js/components/list_items/ProjectLI.js - About 2 hrs to fix

                          User has 22 functions (exceeds 20 allowed). Consider refactoring.
                          Open

                          class User(ndb.Model):
                              """
                              Key - ID
                              """
                              name = ndb.StringProperty()
                          Severity: Minor
                          Found in models.py - About 2 hrs to fix
                            Severity
                            Category
                            Status
                            Source
                            Language