Showing 161 of 430 total issues
Function render
has 154 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render () {
return (
<div className='center-container'>
{
this.state.active === 'form' &&
File index.js
has 372 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
const Comment = require('lib/models').Comment
const privileges = require('lib/privileges/forum')
const scopes = require('./scopes')
/**
Function render
has 115 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render () {
const {
comment,
user,
forum,
Function render
has 109 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render () {
return (
<div className='center-container'>
{
this.state.active === 'form' &&
Function render
has 106 lines of code (exceeds 25 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 || {}
Function up
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
Open
exports.up = function up (done) {
// mediaTitle 225
// author 100
// authorUrl 250
// source 250
- 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 index.js
has 332 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
const ObjectID = require('mongoose').Types.ObjectId
const Topic = require('lib/models').Topic
const Vote = require('lib/models').Vote
const Comments = require('../comments')
const scopes = require('./scopes')
Function render
has 95 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render () {
const form = (
<FormAsync
action='/api/signin'
onSubmit={this.handleSubmit}
Function render
has 95 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render () {
const {
topic,
forum,
user
Function render
has 93 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render () {
const {
tags,
sort,
selectedTags,
Function render
has 83 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render () {
return (
<div className='article-container'>
<div className='article-content markdown-cheatsheet'>
<h3>{t('democracyos.markdown.flavored')}</h3>
Function commentsSyncFactory
has 79 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function commentsSyncFactory () {
let items = []
const params = {
topicId: null,
Function render
has 78 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render () {
return (
<div className='center-container'>
<div id='reset-form'>
<div className='title-page'>
Function render
has 77 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render () {
const { comment } = this.props
return (
<header className={`meta ${comment.author.badge ? ' has-badge' : ''}`}>
Function parseUpdateableKeys
has 76 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
exports.parseUpdateableKeys = function parseUpdateableKeys (req, res, next) {
const custom = (req.forum.topicsAttrs || []).map((attr) => {
return `attrs.${attr.name}`
})
File index.js
has 292 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
const express = require('express')
const validate = require('../validate')
const middlewares = require('../middlewares')
const api = require('../db-api')
Function render
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render () {
const { title, name, summary, coverUrl, updated } = this.state
return (
<article className='forum-edit-form col-xs-12 col-md-8 col-md-offset-2'>
File component.js
has 290 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import React, { Component } from 'react'
import Chart from 'chart.js'
import t from 't-component'
import topicStore from 'lib/stores/topic-store/topic-store'
import userConnector from 'lib/site/connectors/user'
Function getTags
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
exports.getTags = function getTags (opts) {
const forum = new ObjectID(opts.forum._id)
let sort = { 'count': -1 }
if (opts.sort) {
switch (opts.sort) {
Function resetPassowrd
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
Open
exports.resetPassword = function resetPassowrd (formData, callback) {
log('password reset requested. token : [%s]', formData.token)
exports.verifyToken(formData.token, function (err, token) {
if (err) return callback(err)
log('password reset requested. token : [%s]. token verified', formData.token)
- 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"