Showing 5 of 6 total issues
Function getPState
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const getPState = () => {
/* eslint-disable complexity */
$.get(`../api/vm/${uuid}/pstate`).done((rsvp) => {
if (rsvp.Status === 'Success') {
$('#pstate').html(rsvp.Value.power_state);
Function HTTPPatchJSONClient
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const HTTPPatchJSONClient = (endpoint, postData) => {
let url = URL.parse(endpoint);
let promise = new Promise((fulfill, reject) => {
Request.patch({
uri: url,
Function HTTPPostJSONClient
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const HTTPPostJSONClient = (endpoint, postData) => {
let url = URL.parse(endpoint);
let promise = new Promise((fulfill, reject) => {
Request.post({
uri: url,
Function User_Strategy
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
const User_Strategy = new LocalStrategy((username, password, callback) => {
if (env !== 'development') {
HTTP.PostJSON('http://api:3000/user/validate', {
username: username,
password: password
- 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 deSerialize
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
const deSerialize = (uid, cb) => {
if (uid === 1) {
// Administrator
return cb(null, {
id: 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"