Showing 66 of 178 total issues
Function RequireAuthentication
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function RequireAuthentication(InnerComponent) {
class RequireAuthenticationContainer extends React.Component {
static propTypes = {
push: PropTypes.func.isRequired,
auth: PropTypes.object.isRequired,
Function render
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const { logId, error, loading, onClose, settings } = this.props;
if (logId === null) {
return <div></div>;
}
Function loadCredentials
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function loadCredentials() {
return (dispatch) => {
if (window.location.hash) {
dispatch({
type: constants.LOGIN_PENDING
Function getLanguageDictionary
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getLanguageDictionary(response, onSuccess) {
const settings = _.get(response, 'data.settings', {});
let promise = Promise.resolve({ data: {} });
if (settings.languageDictionary) {
if (_.isObject(settings.languageDictionary)) {
Function parseFieldSection
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
const parseFieldSection = (property, sectionInfo, sectionName, inheritedDisplay) => {
if (sectionInfo && _.isObject(sectionInfo)) {
const sectionDisplay = parseFunction(property, `${sectionName}.display`, sectionInfo.display);
const display = sectionDisplay !== undefined ? sectionDisplay : inheritedDisplay;
if (display !== undefined) sectionInfo.display = display;
- 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 10 (exceeds 5 allowed). Consider refactoring. Open
render() {
const {
loading,
error,
users,
- 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 addExtraUserInfo
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
const addExtraUserInfo = (token, user) => {
global.daeUser = global.daeUser || {};
global.daeUser[user.sub] = global.daeUser[user.sub] || { exp: 0, token: '' };
if (_.isFunction(global.daeUser[user.sub].then)) {
Function render
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const { auth, languageDictionary } = this.props;
if (auth.error) {
return (
Function render
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const fields = this.props.customFields || [];
if (fields.length === 0) return null;
Function fetchUsers
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function fetchUsers(search, reset = false, page = 0, filterBy, sort, onSuccess) {
return (dispatch, getState) => {
const { sortProperty, sortOrder, searchValue, selectedFilter } = getState().users.toJS();
const meta = { page, sortProperty, sortOrder, searchValue, onSuccess };
meta.selectedFilter = reset ? '' : filterBy || selectedFilter;
Function fetchUsers
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
export function fetchUsers(search, reset = false, page = 0, filterBy, sort, onSuccess) {
Function getName
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
getName(iss, user) {
let thisMenuName = this.props.getDictValue('menuName');
thisMenuName = thisMenuName || (user && user.get('name'));
thisMenuName = thisMenuName || (user && user.get('nickname'));
- 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 checkCustomFieldValidation
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const checkCustomFieldValidation = (req, context, isEditRequest, onlyTheseFields) => {
/* Exit early if no custom fields */
if (!context.userFields) return context.payload;
const requiredErrorText = (req.query && req.query.requiredErrorText) || 'required';
- 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 { field, isEditField } = this.props;
const formType = isEditField ? 'edit' : 'create';
/* End early if property is not defined or edit/create is not defined */
- 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 (field.property === 'picture') {
return (
<TableCell>
<img
className="img-circle"
Consider simplifying this complex logical expression. Open
if (response.statusCode < 200 || response.statusCode >= 300) {
logger.error('Log response failed: ', response.headers);
return next(new Error((body && (body.error || body.message || body.code)) || `Request Error: ${response.statusCode}`));
}
Consider simplifying this complex logical expression. Open
if (err && (err.status || err.statusCode)) {
res.status(err.status || err.statusCode);
return res.json({
error: err.code || err.name,
message: err.message || err.name
Function render
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
render() {
const fields = this.props.customFields || [];
if (fields.length === 0) return 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"
Further reading
Function requestUserBlocks
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export const requestUserBlocks = (token, userId) =>
new Promise((resolve, reject) => {
request
.get(`https://${config('AUTH0_DOMAIN')}/api/v2/user-blocks/${userId}`)
.set('Authorization', `Bearer ${token}`)
- 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 useConnectionsField
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export const useConnectionsField = (isEditField, fields, connections, onConnectionChange) => {
const type = isEditField ? 'edit' : 'create';
// if we have exactly one connection then don't show this field and use that connection
// however if we have zero connections, we should show the free text connections field
if (!connections || connections.length === 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"