onejgordon/flow-dashboard

View on GitHub

Showing 432 of 434 total issues

File models.py has 1434 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#!/usr/bin/python
# -*- coding: utf8 -*-

from datetime import datetime, timedelta, time
from google.appengine.ext import ndb
Severity: Major
Found in models.py - About 3 days to fix

    File api.py has 1398 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    from datetime import datetime, timedelta, time, date
    from models import Project, Habit, HabitDay, Goal, MiniJournal, User, Task, \
        Readable, TrackingDay, Event, JournalTag, Report, Quote, Snapshot
    from constants import READABLE, GOAL
    from google.appengine.ext import ndb
    Severity: Major
    Found in api.py - About 3 days to fix

      util has 75 functions (exceeds 20 allowed). Consider refactoring.
      Open

      var util = {
      
          ListPop: function(keyval, list, _key) {
              var key = _key || "id";
              for (var i=0; i<list.length; i++) {
      Severity: Major
      Found in src/js/utils/util.js - About 1 day to fix

        File agent.py has 608 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        #!/usr/bin/python
        # -*- coding: utf-8 -*-
        
        # API calls to interact with API.AI (Google Assistant / Actions / Home, Facebook Messenger)
        
        
        Severity: Major
        Found in services/agent.py - About 1 day to fix

          Function role has a Cognitive Complexity of 67 (exceeds 5 allowed). Consider refactoring.
          Open

          def role(role=None):
              def wrapper(handler_method):
                  def check_login(self, *args, **kwargs):
                      d = {
                          'SITENAME': SITENAME,
          Severity: Minor
          Found in authorized.py - About 1 day 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 util.js has 592 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          var $ = require('jquery');
          var moment = require('moment-timezone');
          import {findIndexById} from 'utils/store-utils';
          
          var util = {
          Severity: Major
          Found in src/js/utils/util.js - About 1 day to fix

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

                render() {
                    let _content;
                    let {form, settings, subtab} = this.state;
                    let {user} = this.props;
                    let weekday_start = get(settings, ['weekday_start'], AppConstants.DEFAULT_WEEK_START)
            Severity: Major
            Found in src/js/components/Settings.js - About 1 day to fix

              Function _journal has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring.
              Open

                  def _journal(self, message=""):
                      DONE_MESSAGES = ["done", "that's all", "exit", "finished", "no"]
                      MODES = ['questions', 'tasks', 'end']
                      settings = tools.getJson(self.user.settings, {})
                      questions = settings.get('journals', {}).get('questions', [])
              Severity: Minor
              Found in services/agent.py - About 1 day 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_habit has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring.
              Open

                render_habit(h) {
                  let {commitments, days} = this.props;
                  let {habitdays, cancellable_habitday} = this.state;
                  let cursor = new Date()
                  let today = new Date()
              Severity: Minor
              Found in src/js/components/HabitWidget.js - About 1 day 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 fetch_daily_panel_data has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring.
              Open

                  def fetch_daily_panel_data(self, since=None, until=None):
                      self._maybe_get_habits()
                      self._maybe_get_journal_questions()
                      if not since:
                          since = datetime.combine((datetime.now() - timedelta(days=self.days_ago)).date(), time(0, 0))
              Severity: Minor
              Found in services/flow_bigquery.py - About 1 day 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 HabitWidget.js has 487 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              var React = require('react');
              import { IconButton, IconMenu, MenuItem, Dialog,
                RaisedButton, TextField, FontIcon, FlatButton,
                Toggle } from 'material-ui';
              var util = require('utils/util');
              Severity: Minor
              Found in src/js/components/HabitWidget.js - About 7 hrs to fix

                Function gets has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
                Open

                def gets(self, strings=[], lists=[], floats=[], integers=[], booleans=[],
                         dates=[], times=[], json=[], multi=False, addMultiBrackets=False,
                         getDefault=None, ignoreMissing=True, supportTextBooleans=False):
                    '''
                    Use ignoreMissing if resulting dictionary should not contain params that were not passed via request
                Severity: Minor
                Found in tools.py - About 7 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 AnalysisJournals.js has 459 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                var React = require('react');
                var util = require('utils/util');
                import {AutoComplete, FlatButton,
                    Checkbox, DropDownMenu, MenuItem} from 'material-ui';
                var AppConstants = require('constants/AppConstants');
                Severity: Minor
                Found in src/js/components/analysis/AnalysisJournals.js - About 7 hrs to fix

                  File tools.py has 447 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  import os, time, random, string, logging, re, cgi
                  import uuid
                  from datetime import datetime, timedelta, date
                  import hashlib
                  import pytz
                  Severity: Minor
                  Found in tools.py - About 6 hrs to fix

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

                                for q in Quote.query().fetch(limit=PAGE_SIZE, offset=page * PAGE_SIZE):
                                    sd, index = q.update_sd(index_put=False)
                                    if index and index.name not in index_lookup:
                                        index_lookup[index.name] = (index, [sd])
                                    else:
                    Severity: Major
                    Found in actions/adminActions.py and 1 other location - About 6 hrs to fix
                    actions/adminActions.py on lines 53..58

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

                    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

                                for r in Readable.query().fetch(limit=PAGE_SIZE, offset=page * PAGE_SIZE):
                                    sd, index = r.update_sd(index_put=False)
                                    if index and index.name not in index_lookup:
                                        index_lookup[index.name] = (index, [sd])
                                    else:
                    Severity: Major
                    Found in actions/adminActions.py and 1 other location - About 6 hrs to fix
                    actions/adminActions.py on lines 47..52

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

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

                    def sync(user, access_token):
                        '''
                        Return JSON array {title, author, isbn, image}
                    
                        Sample dict from pocket:
                    Severity: Minor
                    Found in services/pocket.py - About 6 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 get has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def get(self, d):
                            hack_id = self.request.get('hack_id')
                            res = {}
                            if hack_id == 'index_quotes_readables':
                                page = self.request.get_range('page')
                    Severity: Minor
                    Found in actions/adminActions.py - About 5 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 140 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        render() {
                            let {user} = this.props;
                            let {snapshots, form, dimensions, loading} = this.state;
                            let data = this.get_data();
                            if (data == null) return <div></div>
                    Severity: Major
                    Found in src/js/components/analysis/AnalysisSnapshot.js - About 5 hrs to fix

                      Function render_content has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
                      Open

                        render_content() {
                          let {habit, days} = this.props;
                          let {habitdays} = this.state;
                          let _squares = [];
                          let cursor = new Date();
                      Severity: Minor
                      Found in src/js/components/HabitAnalysis.js - About 5 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

                      Severity
                      Category
                      Status
                      Source
                      Language