Showing 161 of 430 total issues
Function render
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
render () {
let renderState
if (!this.props.isLoading && !this.props.noMoreResults) {
renderState = (
Function render
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
render () {
const voted = this.props.user.state.fulfilled && this.props.item.voted
return (
<li className='sidebar-link' data-id={this.props.item.id}>
Function mixin
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function mixin (Base, ...theMixins) {
let constructors = []
if (typeof Base !== 'function') {
theMixins.unshift(Base)
Function doSignUp
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.doSignUp = function doSignUp (profile, meta, callback) {
const strategySignup = () => {
profile.email = normalizeEmail(profile.email)
var user = new User(profile)
Function watch
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
watch: function () {
const log = newLog('js:watch')
const bs = Object.keys(entries).map(function (target) {
const opts = {
Function up
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.up = function up (done) {
dbReady()
.then(() => config.blackListEmails ? Promise.resolve() : Promise.reject())
.then(() => User.collection.find({ email: { $in: config.blackListEmails.map((d) => new RegExp(`@${d}*$`)) } }).toArray())
.then((users) => User.collection.deleteMany({ email: { $in: config.blackListEmails.map((d) => new RegExp(`@${d}*$`)) } })
Function getTopics
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getTopics (req, res, next) {
Promise.all([
api.topics.list({
user: req.user,
forum: req.forum,
Function render
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
render () {
var learnMore = null
if (config.learnMoreUrl) {
learnMore = (
<div className='alert alert-warning alert-dismissable system-alert'>
- 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
Function canCreateForum
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
exports.canCreateForum = function canCreateForum (req, res, next) {
if (config.multiForum) {
if (!config.restrictForumCreation) return next()
if (!req.user || !req.user.staff) {
log('Forums must be created by a staff members only.')
- 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
Function removeComment
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
exports.removeComment = (function () {
function verifyPrivileges (forum, user, comment) {
if (privileges.canDeleteComments(forum, user)) return comment
if (!comment.author.equals(user._id)) {
- 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
Function cleanup
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
cleanup () {
for (let i in this) {
if (i === '_eventCollection') continue
if (i.charAt(0) === '$') continue
if (!this.hasOwnProperty(i)) continue
- 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
Function postserialize
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
postserialize (data = {}) {
if (data['links[][text]']) {
data.links = data['links[][text]'].map((text, i) => ({
_id: data['links[][_id]'][i] || undefined,
url: data['links[][url]'][i],
- 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
Function lookup
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function lookup (formats, types) {
for (var i = 0; i < formats.length; i++) {
const format = formats[i].replace('*', '')
if (!format) continue
- 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
Avoid deeply nested control flow statements. Open
if (!attrs[key] || attrs[key] === 'false' || attrs[key] === 'off') {
attrs[key] = undefined
} else {
attrs[key] = true
}
Function guessVersion
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function guessVersion (topic) {
const migratedClauses = topic.clauses.filter(function (clause) {
return !!clause.markup
})
- 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
Function getIdString
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
exports.getIdString = function getIdString (id) {
if (!id) {
throw new Error('Invalid id 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"
Further reading
Function Setup
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function Setup (app) {
/**
* Set `production` settings
*/
- 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
Function field
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
export function field (name, options, val, ctx, print, fn) {
Consider simplifying this complex logical expression. Open
if (this.state.isSearching) {
section = (
<SearchResults isLoading={this.state.isLoadingLoadMoreSearch} noMoreResults={this.state.noMoreResults} forums={this.state.searchResults} handleLoadMoreSearch={this.handleLoadMoreSearch} />
)
} else {
Consider simplifying this complex logical expression. Open
if (
!mediaTitleInvalid &&
!authorInvalid &&
!authorUrlInvalid &&
!sourceInvalid &&