Showing 4 of 17 total issues
Function addLibraryEntry
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
Open
async addLibraryEntry (media) {
for (let mediaEntry in await media) {
try {
await api.post('libraryEntries', {
media: { type: this.type, id: media[mediaEntry].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
Consider simplifying this complex logical expression. Open
Open
if (!KITSU.USERNAME || KITSU.USERNAME === 'yourUsername' ||
!KITSU.PASSWORD || KITSU.PASSWORD === 'yourPassword' ||
!KITSU.CLIENT_ID || KITSU.CLIENT_ID === 'yourClientID' ||
!KITSU.CLIENT_SECRET || KITSU.CLIENT_SECRET === 'yourClientSecret') {
console.log('\nKitsu needs some user info to authorise\n\n' +
Function anilist
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export default function anilist (service, type) {
top(service, type, ANILIST.username)
const clientId = ANILIST.client_id
const clientSecret = ANILIST.client_secret
Function setup
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
async setup (ID) {
try {
// Prevent service from running if token hasn't been set
if (!ANNICT.PERSONAL_TOKEN || ANNICT.PERSONAL_TOKEN === 'yourPersonalToken') {
console.log('\nAnnict needs a personal access token to authorise.\n\n' +
- 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"