Showing 62 of 222 total issues
Function mediaQuery
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
export const mediaQuery = (media) => {
const mql = localMatchMedia(media);
const listeners = [];
let index = 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 _disabledDay
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
_disabledDay(day) {
let disabled = false;
if (this.props.isDisablePastDay) {
disabled = DateUtils.isPastDay(day);
}
- 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 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const { postImpersonateState } = this.props;
const errorCode = postImpersonateState ? postImpersonateState.get('error') : undefined;
const data = postImpersonateState ? postImpersonateState.get('data') : undefined;
Function _getButtonsToDisplay
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
_getButtonsToDisplay(props = this.props) {
const currentRoute = SaveBarHandler.getCurrentRouteSegment(props);
const currentModeName = props.params &&
props.params.mode &&
props.params.mode.length ?
Function Select
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
const Select = (props) => {
const arrowRenderer = () =>
<span className={styles.Select_icon}>
<Icon id="chevron-small-down" />
</span>;
Function render
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const { user } = this.props;
if (! user || user.expired) return null;
return <div className={classnames(styles.App, testClass('app'))}>
Function ColourLabel
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const ColourLabel = (props) => {
const { text, initial, colour } = props;
if (is.string(initial) && is.not.empty(initial)) {
return renderSmall();
Function createSignInRedirectMiddleware
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function createSignInRedirectMiddleware() {
return (store) => (next) => (action) => {
// bounce any 401s to the login page
if (ApiCall.Action.isApiAction(action) &&
ApiCall.Action.isFailure(action) &&
Function _renderNotificationFooter
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
_renderNotificationFooter(notifications) {
const markBtnClassName = classnames(styles.NotificationsTray_notification_footer_mark,
testClass('notification-mark'));
if (this.state.isMarkingMode) {
return <div className={styles.NotificationsTray_notification_footer}>
Function fetch
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const fetch = (url, options = {}) => {
invariant(is.string(url), 'url must be a string');
invariant(is.object(options), 'options must be a plain object');
const user = Store.get().getState().get('singleSignOn').get('user') || {};
Function _getButtonsToDisplay
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
_getButtonsToDisplay(props = this.props) {
const currentRoute = SaveBarHandler.getCurrentRouteSegment(props);
const currentModeName = props.params &&
props.params.mode &&
props.params.mode.length ?
- 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 _updateIntermediateCrumbsCollapsedState
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
_updateIntermediateCrumbsCollapsedState() {
if (! this.props.singleLineMode || ! this.listNode) return;
const navBoxSizing = this.navNode.style.boxSizing;
this.navNode.style.boxSizing = 'content-box'; // to get width without padding
- 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 _renderHeading
has a Cognitive Complexity of 10 (exceeds 5 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);
- 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 mapDispatchToProps
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function mapDispatchToProps(dispatch) {
const markAsReadDispatchConfig = Config.get('notificationsTray').markAsRead.dispatch;
const apiUrl = buildUrl(markAsReadDispatchConfig.apiUrl);
const method = markAsReadDispatchConfig.method;
return {
Function mediaQuery
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const mediaQuery = (media) => {
const mql = localMatchMedia(media);
const listeners = [];
let index = 0;
Function AuthorizationHandler
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const AuthorizationHandler = (props) => {
const { user, permissionChecks, children, havePrivilegesLoaded } = props;
const spinner = <PageLoadingSpinner />;
Function _updateIntermediateCrumbsCollapsedState
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
_updateIntermediateCrumbsCollapsedState() {
if (! this.props.singleLineMode || ! this.listNode) return;
const navBoxSizing = this.navNode.style.boxSizing;
this.navNode.style.boxSizing = 'content-box'; // to get width without padding
Function Field
has a Cognitive Complexity of 9 (exceeds 5 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) {
- 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 fetch
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export const fetch = (url, options = {}) => {
invariant(is.string(url), 'url must be a string');
invariant(is.object(options), 'options must be a plain object');
const user = Store.get().getState().get('singleSignOn').get('user') || {};
- 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 _onValueChanged
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
_onValueChanged({ target: { value: newValue } }) {
if (is.empty(newValue)) {
return this._sendCallbackWithNewValue(null);
}
- 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"