Showing 151 of 386 total issues
Function NOTIFICATIONS_LOAD_SUCCESS
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
[NOTIFICATIONS_LOAD_SUCCESS]: (state, action) => {
const result = convertTimestamps(action.result);
let alert, tasks, busy;
let preserveUris = state.preserveUris.slice(0);
result.items.forEach((item) => {
Function getItems
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function getItems (categoryName, raw) {
let result = [];
if (categoryName) {
if (Array.isArray(categoryName)) {
for (var i = 0; i < categoryName.length; i++) {
Function IdentitySection
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
const IdentitySection = (props) => {
const { productName, role, settings, onOpen } = props;
let control;
if ('read only' !== role) {
Function createAssociations
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function createAssociations () {
SCHEMA.forEach(category => {
if (category.hasOwnProperty('associations')) {
for (let name in category.associations) {
Function _onSubmit
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
_onSubmit () {
let hypervisor = {...this.props.hypervisor};
if (hypervisor.address && ! hypervisor.certificate) {
this.setState({ busy: 'Connecting' });
this.props.dispatch(loadHypervisorCertificate(hypervisor));
Function NOTIFICATIONS_LOAD_AGGREGATE_SUCCESS
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
[NOTIFICATIONS_LOAD_AGGREGATE_SUCCESS]: (state, action) => {
// convert to a more useful format
let status, count;
action.result.forEach((value) => {
if ('critical' === value.value.toLowerCase() ||
Function filterUserQuery
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function filterUserQuery (items, userQuery) {
// handle quoted strings, e.g. 'a b' c "d e"
const regexp = /'([^']+)'|"([^"]+)"|(\w+)/g;
let matches;
let terms = [];
Function render
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
render () {
const { productName, settings } = this.props;
const { nodes } = this.state;
const unmanagedNodes = this.state.nodes.filter(node => ! node.managed);
Function render
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
render () {
const { productName, software } = this.props;
return (
<LayerForm title="Update Software" submitLabel="Update"
Function _renderSizeTiles
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
_renderSizeTiles () {
const { sizes, template, errors } = this.state;
let selectedIndex;
const sizeTiles = sizes.map((size, index) => {
if (size.name === template.size.name) {
Function getIndex
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getIndex (url, queryParams) {
let items = getItems(queryParams.category) || [];
const unfilteredTotal = items.length;
items = filteredItems(items, queryParams);
Function updateAggregateCounts
has 26 lines of code (exceeds 25 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];
Function initialize
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
export function initialize (socketUrl, getFunction) {
if (!_state.initialized) {
if (_wsAvailable() && (_state.socketUrl || socketUrl)) {
if (!_state.ws) {
_state.socketUrl = _state.socketUrl || socketUrl;
- 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 respondToRequest
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function respondToRequest (connection, request) {
let response = {op: 'update', id: request.id};
try {
if ('/rest/index/resources' === request.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 9 (exceeds 5 allowed). Consider refactoring. Open
render () {
const { settings, setup, productName, role } = this.props;
let sessionMenu;
if (setup) {
- 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 runTask
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function runTask (task, resource, handler) {
// allow caller to preset the percent complete
if (! task.percentComplete) {
task.percentComplete = 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 render
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
render() {
const { item, includeResource } = this.props;
let icon;
if ('Active' === item.state || 'Locked' === item.state) {
- 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 (! credentials.userName) {
errors.userName = 'required';
noErrors = false;
}
Avoid deeply nested control flow statements. Open
while (usedRoles[roles[index]]) index += 1;
Avoid deeply nested control flow statements. Open
if (! credentials.password) {
errors.password = 'required';
noErrors = false;
}