Showing 47 of 96 total issues
Function handleUserPartner
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
async handleUserPartner(user) {
try {
if (Object.keys(partnerLevels).includes(user.referrer.identification)) {
const partnerLevelAlreadyGiven = await LevelHistory.findOne({
user: user.uuid,
- 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 getProfileCompletenessMessage
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
getProfileCompletenessMessage(progress) {
const medals = ['Ferro', 'Bronze', 'Prata', 'Ouro', 'Diamante']
const ranges = [20, 40, 60, 80, 100]
- 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 formatAchievement
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const formatAchievement = ({ name, displayAchievement, medals }) => {
const achievement = []
for (const medal of medals) {
for (const [index, target] of medal.targets.entries()) {
achievement.push({
- 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 updateUserScore
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
async updateUserScore({ user, scoreEarned }) {
const score = {
value: user.score.value + scoreEarned,
lastUpdate: moment()
}
- 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 getAchievements
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
getAchievements({ achievementRanges, currentAchievement }) {
let newAchievement, nextAchievement, nextIndex
for (const [index, currentRange] of achievementRanges.entries()) {
if (nextIndex !== undefined) {
- 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 createGeneralRanking
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
async createGeneralRanking() {
try {
const limit = 10000
let skip = 0
let position = 1
- 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 handleClickOnProduct
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const handleClickOnProduct = async data => {
try {
const { properties, impulser_uuid, time } = data
if (!properties.name || !Object.keys(products).includes(properties.name))
- 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"