Showing 161 of 430 total issues
Function up
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
Open
exports.up = function up (done) {
// firstName 100
// lastName 100
// username 100
// email 200
- Read upRead up
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 view.js
has 281 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import React from 'react'
import { render as ReactRender } from 'react-dom'
import closest from 'component-closest'
import confirm from 'democracyos-confirmation'
import Datepicker from 'democracyos-datepicker'
Function render
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render () {
var learnMore = null
if (config.learnMoreUrl) {
learnMore = (
<div className='alert alert-warning alert-dismissable system-alert'>
Function render
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render () {
return (
<div className='center-container'>
<div className='notifications-page'>
<h1>{t('notifications.title')}</h1>
FormView
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
Open
export default class FormView extends View {
constructor (template, options = {}) {
super(template, options)
this.autovalidate('form[autovalidate]')
this.autosubmit('form[autosubmit]')
Function render
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render () {
const { user, topic } = this.props
const votes = this.state.votes
const votesTotal = topic.action.count
Function render
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render () {
const currentSort = this.props.sorts[this.props.currentSort]
return (
<div className='sidebar-filter'>
Function render
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render () {
const { value, changingVote, colored } = this.state
const { topic, user } = this.props
const votesTotal = topic.action.count
Function render
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render () {
const styles = {
color: config.headerFontColor,
backgroundColor: config.headerBackgroundColor
}
Function render
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render () {
const { value, changingVote, items } = this.state
const { topic, user } = this.props
const votesTotal = topic.action.count
File component.js
has 264 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import React, { Component } from 'react'
import InputRange from 'react-input-range'
import { VictoryChart, VictoryBar, Bar, VictoryAxis, VictoryTooltip } from 'victory'
import t from 't-component'
import userConnector from 'lib/site/connectors/user'
Dropdown
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
Open
export class Dropdown {
constructor (options = {}) {
if (!options.container) {
throw new Error('Dropdown needs a container element.')
}
Function render
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render () {
const { reply } = this.props
return (
<header className={`meta ${(reply.author.badge ? ' has-badge' : '')}`}>
<img
Function render
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render () {
return (
<div className='center-container'>
<div id='forgot-form'>
<div className='title-page'>
Function render
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render () {
const userAttrs = this.props.user.state.value
let menuItemAdmin = null
if (userAttrs.privileges && userAttrs.privileges.canManage) {
Function render
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render () {
if (this.props.user.state.pending) return null
const { user, topic } = this.props
const { results, changingVote, selected } = this.state
Function render
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render () {
const { commentsFetch } = this.props
return (
<div className='topic-comments'>
Function authMongoose
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = function authMongoose (schema, options) {
const digestAlgorithm = 'sha512'
schema.plugin(passportLocalMongoose, {
usernameField: 'email',
Function render
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render () {
const {
topic,
user
} = this.props
Function render
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
Open
render () {
if (this.state.loadingUserForms) return null
if (this.props.user.state.pending) return null
const user = this.props.user.state.value || {}
- Read upRead up
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"