Showing 62 of 222 total issues
Function testButtonClick
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
function testButtonClick(props = {}) {
describe('when clicked', () => {
test('calls onClick', () => {
const onClick = jest.fn();
const wrapper = shallow(<Button {...props} onClick={onClick} />);
File index.jsx
has 278 lines of code (exceeds 250 allowed). Consider refactoring. Open
import styles from './style.postcss';
import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import { Set } from 'immutable';
Function render
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
if (! this.props.items || this.props.items.length < 1) return null;
// make a copy of props.items so that we can mangle it
let itemsToRender = this.props.items;
Function fetchPrivilegesIfNeeded
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function fetchPrivilegesIfNeeded() {
return (dispatch, getState) => {
const state = getState();
const userId = getSSOUserId(state);
if (! userId) return false;
Function render
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const {
optionKeys,
optionList,
className,
Function postImpersonate
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function postImpersonate(email, token) {
return (dispatch) => {
const url = getTokenEndPoint();
const method = 'POST';
Function create
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
const create = (apiResponse) => {
if (apiResponse instanceof ApiResponse) {
return apiResponse;
}
- 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 _renderCalloutPopupContent
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
_renderCalloutPopupContent() {
const { notifications } = this.props;
const { viewingNotification } = this.state;
const headerBtnClassName = classnames(styles.NotificationsTray_popup_heading_btn,
testClass('mark-as-read'),
Function _renderHeading
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
_renderHeading() {
const { title, rootLinkTitle, hideRootLink } = this.props;
const headerClassName = classnames(this.props.headerClassName,
styles.SelectionTable_header);
const routes = this._cloneArray(this.state.route);
Function Field
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const Field = (props) => {
const classes = classnames(styles.Field, props.className, getValidationClasses(), {
[styles.__stackedHorizontally]: props.neighborStackMode === 'horizontal',
});
if (props.useLabel === true) {
Function create
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
static create(originalAction) {
const action = Object.assign({}, originalAction);
if (is.not.object(action)) {
throw new InvalidAction('An action should be an object');
}
Function render
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
render() {
const {
optionKeys,
optionList,
className,
- 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 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const inputBorderStyle = classnames(styles.CalendarPicker,
this.props.isValid ? '' : styles.CalendarPicker_error);
return (
<div onMouseDown={this.handleContainerMouseDown}
Function render
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const { suffix } = this.props;
const _this = this;
const classes = classnames(styles.TextInput, this.props.className);
const inputClasses = ! suffix ?
Function createNotificationsMiddleware
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function createNotificationsMiddleware(config = {}) {
invariant(is.string(config.strategy), 'trigger strategy must be a string');
invariant(is.object(config.dispatch), 'trigger dispatch must be an object');
invariant(is.string(config.dispatch.apiUrl), 'dispatch apiUrl must be a string');
Function render
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const { children, isAnyApiCallSaving } = this.props; // eslint-disable-line
const { isVisible } = this.state;
const barClasses = {
[styles.SaveBar]: true,
Function create
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
static create(originalAction) {
const action = Object.assign({}, originalAction);
if (is.not.object(action)) {
throw new InvalidAction('An action should be an object');
}
- 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 buildWithProps
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
buildWithProps: (props) => {
const { params, routes, buildRoute } = props;
const getRouteSegments = () =>
routes.filter((route) => is.string(route.path));
Function render
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const inputValue = this._getValidNumber(this._value, this._defaultValue);
const classes = classnames(styles.NumberInput_inputContainer,
this.props.className,
{ [styles.__focused]: this.state.focused });
Function createApiActionCreator
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
(dispatch) => {
const prefix = (() => {
switch (method.toUpperCase()) {
case 'DELETE': return 'DELETE_';
case 'POST': case 'PUT': return 'SUBMIT_';