Showing 14 of 32 total issues
File books.js
has 400 lines of code (exceeds 250 allowed). Consider refactoring. Open
var app = require('..')
var isbn = require('node-isbn')
var shuffle = require('shuffle-array')
var fs = require('fs')
var irc = require('../irc.js')
Function getStats
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
const getStats = async (loggedIn) => {
const playerCommand = loggedIn ? '/p' : '/p o'
const getImage = new Promise((resolve, reject) => {
const path = '/home/zuzak/public_html/zuzakistan.com/public/factorio/map/d-c277191a/zoom_5'
randomFile(path, (err, file) => {
Function getStats
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
const getStats = async (loggedIn) => {
const playerCommand = loggedIn ? '/p' : '/p o'
const getImage = new Promise((resolve, reject) => {
const path = '/home/zuzak/public_html/zuzakistan.com/public/factorio/map/d-c277191a/zoom_5'
randomFile(path, (err, file) => {
- 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 __
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
global.__ = function (phrase, args) {
if (getLocale() === 'qqx') {
if (args) {
return '⟨' + phrase + '|' + Object.keys(args).join('·') + '⟩'
}
- 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 getVerdict
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const getVerdict = async (user) => {
const username = user.screen_name
console.log('USERNAME', username, user)
if (user.suspended) return { verdict: 'upheld', because: 'you are suspended from Twitter' }
- 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 (newbooks) booklist.save(books)
Avoid too many return
statements within this function. Open
return __('fallback', { content: translation })
Avoid too many return
statements within this function. Open
if (await isFollowing('zuzakistan', username)) return { verdict: 'overturned', because: 'you have been vouched for' }
Avoid too many return
statements within this function. Open
return { verdict: 'referred', because: 'you were probably blocked manually' }
Avoid too many return
statements within this function. Open
if (await isFollowing('lgballiance', username)) return { verdict: 'overturned', because: 'you have been vouched for' }
Avoid too many return
statements within this function. Open
return next()
Avoid too many return
statements within this function. Open
if (await isFollowing(username, 'countdankulatv')) return { verdict: 'upheld', because: 'the reason you were originally blocked is still true' }
Avoid too many return
statements within this function. Open
if (await isFollowing(username, 'lgballiance')) return { verdict: 'overturned', because: 'you were likely blocked in error' }
Avoid too many return
statements within this function. Open
return translation