Showing 12 of 24 total issues
Function install
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
install (Vue) {
Vue.processQueue = () => {
setImmediate(function () {
const queue = store.state.graphqlModule.mutationsQueue
if (!store.state.graphqlModule.mutationsQueueLock && !_.isEmpty(queue)) {
Function install
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
install (Vue) {
Vue.processQueue = () => {
setImmediate(function () {
const queue = store.state.graphqlModule.mutationsQueue
if (!store.state.graphqlModule.mutationsQueueLock && !_.isEmpty(queue)) {
- 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 itemManager
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function itemManager (config) {
let itemName = config.itemName || config.singleQuery.definitions[0].selectionSet.selections[0].name.value
return function () {
let fullConfig = _.clone(config)
fullConfig.itemName = config.itemName || config.singleQuery.definitions[0].selectionSet.selections[0].name.value
Function install
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
install (Vue) {
if (localStorage.getItem(AUTH_TOKEN)) { // TODO DRY as it is used elsewhere
apolloClient.query({query: ME_QUERY}).then((res) => {
store.commit(types.SET_USER, res.data.me)
})
Function defineAbilitiesFor
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function defineAbilitiesFor (user) {
return AbilityBuilder.define(
{ subjectName },
can => {
if (user && user.username) {
Function refetch
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
refetch (itemName, immediate = true) {
let itName = getItemName(this, itemName)
if ((REFETCH_ATTEMPS === -1) || ((this.config[itName].intervalCount || 0) < REFETCH_ATTEMPS)) {
this.loading += 1
this.config[itName].intervalCount = (this.config[itName].intervalCount || 0) + 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 timeDifference
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function timeDifference (current, previous) {
const milliSecondsPerMinute = 60 * 1000
const milliSecondsPerHour = milliSecondsPerMinute * 60
const milliSecondsPerDay = milliSecondsPerHour * 24
const milliSecondsPerMonth = milliSecondsPerDay * 30
- 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 too many return
statements within this function. Open
return Math.round(elapsed / milliSecondsPerDay) + ' days ago'
Avoid too many return
statements within this function. Open
return Math.round(elapsed / milliSecondsPerMonth) + ' mo ago'
Avoid too many return
statements within this function. Open
return Math.round(elapsed / milliSecondsPerYear) + ' years ago'
Function cssLoaders
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
exports.cssLoaders = function (options) {
options = options || {}
const cssLoader = {
loader: 'css-loader',
- 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 exports
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function () {
const warnings = []
for (let i = 0; i < versionRequirements.length; i++) {
const mod = versionRequirements[i]
if (!semver.satisfies(mod.currentVersion, mod.versionRequirement)) {
- 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"