Showing 3,724 of 12,675 total issues
Function prescriptionsReducer
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
Open
export const prescriptionsReducer = (state = initialState, action) => {
switch (action.type) {
case Actions.Prescriptions.SET_DETAILS:
case Actions.Prescriptions.GET_DETAILS: {
return {
- 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
Open
render() {
const { enrollment, id } = this.props;
const amendments = enrollment.amendments || [];
const yellowRibbonStatus = enrollment.yellowRibbonAmount > 0 && (
<div className="yellow-ribbon-school">
- 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 fillAvailableFields
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const fillAvailableFields = () => {
getFieldSelectors().then(fieldSelector => {
cy.get(APP_SELECTOR, NO_LOG_OPTION)
.then($form => {
// Get the starting number of array items and fields to compare
Function sendDraft
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const sendDraft = (req, res) => {
const { body, category, recipientId, subject } = req.body;
return res.json({
data: {
Function commonFieldMapping
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export default function commonFieldMapping(props) {
const { label, required, error, uiOptions, childrenProps } = props;
const labelHeaderLevelStyle = uiOptions?.labelHeaderLevelStyle;
const headerStyle = labelHeaderLevelStyle
Function startReactApp
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export default function startReactApp(
component,
root = document.getElementById('react-root'),
) {
// Detect if this is a child frame. If yes, initialize the react devtools hook to work around
Function yesNoUI
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const yesNoUI = options => {
const {
title,
tile,
labels,
Function removeHiddenData
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function removeHiddenData(schema, data) {
// null is necessary here because Rails 4 will convert empty arrays to null
// In the forms, there's no difference between an empty array and null or undefined
if (isHiddenField(schema) || typeof data === 'undefined' || data === null) {
return undefined;
Function SSNWidget
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export default function SSNWidget(props) {
const [val, setVal] = useState(props.value);
const [displayVal, setDisplayVal] = useState(props.value);
const handleChange = value => {
Function readAndCheckFile
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export default function readAndCheckFile(file, checks) {
return new Promise((resolve, reject) => {
// Don't load file if there's nothing to check
if (Object.keys(checks).length === 0) {
resolve({});
Function renderAlert
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const renderAlert = (alertType, statements) => {
const alertInfo = alertMessage(alertType, APP_TYPES.DEBT);
const showOther = statements > 0;
const showVAReturnLink = !showOther && alertType !== ALERT_TYPES.ALL_ERROR;
Function applyFocus
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const applyFocus = (parentId, headerHasFocused, setHeaderHasFocused) => {
if (!headerHasFocused) {
setTimeout(() => {
const header = document
.getElementById(parentId)
Function renderAlert
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const renderAlert = (alertType, debts) => {
const alertInfo = alertMessage(alertType, APP_TYPES.COPAY);
const showOther = debts > 0;
const showVAReturnLink = !showOther && alertType !== ALERT_TYPES.ALL_ERROR;
Function addressValidationSuccessSingleConfirmedSuggestion
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
addressValidationSuccessSingleConfirmedSuggestion() {
return asyncReturn(
{
addresses: [
{
Function captureError
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const captureError = (error, details) => {
if (environment.isLocalhost()) {
// eslint-disable-next-line no-console
console.error({ error, details });
}
Function addressValidationSuccessSingleLowConfidenceSuggestion
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
addressValidationSuccessSingleLowConfidenceSuggestion() {
return asyncReturn(
{
addresses: [
{
Function getDynamicContent
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const getDynamicContent = formResponses => {
// Final content to show on the results page
const dynamicContentMatchingAnswer = [];
// Get array of short names with responses in the store minus SERVICE_PERIOD and any question ending in '_A'
Function renderContent
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const renderContent = () => {
if (isNotEnrolledInHealthCare) {
return <MCPAlerts type="no-health-care" />;
}
if (mcpError) {
Function buildAddressArray
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function buildAddressArray(location, titleCaseText = false) {
if (location && location.type === LocationType.CC_PROVIDER) {
const { address } = location.attributes;
if (!isEmpty(address)) {
Function SearchResultReducer
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const SearchResultReducer = (state = INITIAL_STATE, action) => {
switch (action.type) {
case FETCH_LOCATIONS:
return {
...state,