Showing 151 of 386 total issues
Avoid deeply nested control flow statements. Open
if (credentials) {
this.setState({ needCredentials: false, credentials: null,
editBase: false, busy: 'Verifying' });
this.props.dispatch(verifyDirectory(directory, credentials));
} else {
Function render
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
render () {
const { index, role } = this.props;
const { filterActive, searchText } = this.state;
const result = index.result || {};
- 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 _renderNodeFields
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
_renderNodeFields (node, index) {
const { nodes } = this.state;
const errors = this.state.errors.nodes[index] || {};
let addressField;
- 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 (item.associationContext.parentUri) {
reducedItem = reducedItemsMap[item.associationContext.parentUri];
if (! reducedItem) {
reducedItem = {
association: {
Function render
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
render () {
const { index } = this.props;
const { filterActive, searchText, selection } = this.state;
const result = index.result || {};
- 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 buildItem
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function buildItem (options) { //categoryName, index, name, date) {
const category = options.category;
const resource = {
name: options.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"
Further reading
Avoid deeply nested control flow statements. Open
if (childIndex < children.length) {
const child = children[childIndex];
addAssociation(name, parent.uri, child.uri);
if (schema.childUriAttribute) {
child[schema.childUriAttribute] = parent.uri;
Function componentWillReceiveProps
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
componentWillReceiveProps (nextProps) {
const { context, notifications } = this.props;
const { context: nextContext, notifications: nextNotifications,
preservePriorRunningTasks} = nextProps;
if (context.uri !== nextContext.uri ||
- 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 render
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
render () {
const { virtualMachine, nav, notifications, role, category } = this.props;
let state;
if (! notifications.alert && ! notifications.aggregate &&
- 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 normalize
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
normalize (options) {
let result = { ...options };
while (result.value >= 1000) {
result.value = Math.round(result.value / 100) / 10;
if (result.units) {
- 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
if (! req.body.userName || ! req.body.password ||
'error' === req.body.userName ||
('Gru' === req.body.userName && 'freeze ray' !== req.body.password)) {
res.status(401, "Invalid username or password.").send();
} else {
Consider simplifying this complex logical expression. Open
if (resource.status && 'OK' !== resource.status &&
'Disabled' !== resource.status &&
'alerts' !== category.name && 'tasks' !== category.name &&
'appliances' !== category.name) {
alertForResource(resource, options.index);
Function sessionLoginSuccess
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
export function sessionLoginSuccess (host, userName, token, role,
needPasswordReset) {
Function add
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function add(name, uri, result, associations, callback) {
Function distribute
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function distribute (values) {
let result;
for (var i = 0; i < values.length; i++) {
if (Array.isArray(values[i])) {
if (random(values[i][1]) === 0) {
- 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 updateAggregateCounts
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function updateAggregateCounts (counts, resource, value, intervals) {
let count = null;
for (let i = 0; i < counts.length; i++) {
if (value === counts[i].value) {
count = counts[i];
- 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 _renderNameFields
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
_renderNameFields () {
const { count, naming, template, errors } = this.state;
let nameFields;
if (1 === count) {
- 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 render
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
render () {
const { status } = this.props;
let progress;
if (status.progress) {
- 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 render
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
render () {
const { productName, role, software, onAction } = this.props;
let menu, details;
- 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(delta / 86400000).toString() + 'd';