Showing 4,231 of 14,884 total issues
Function UNSAFE_componentWillReceiveProps
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
UNSAFE_componentWillReceiveProps(nextProps) {
// Once the login logic is all done...
// This will occur even for unauthenticated users and should only occur once.
if (this.props.user.profile.loading && !nextProps.user.profile.loading) {
const userProfile = nextProps.user.profile;
- 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 LandingPage
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
const LandingPage = () => {
const dispatch = useDispatch();
const fullState = useSelector(state => state);
const displayNotes = useSelector(selectNotesFlag);
const displayVaccines = useSelector(selectVaccinesFlag);
- 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 buildVAPrescriptionPDFList
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
export const buildVAPrescriptionPDFList = prescription => {
const refillHistory = [...(prescription?.rxRfRecords || [])];
const originalFill = createOriginalFillRecord(prescription);
refillHistory.push(originalFill);
- 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 pharmacyPhoneNumber
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
export const pharmacyPhoneNumber = prescription => {
if (!prescription) {
return null;
}
if (prescription.cmopDivisionPhone) {
- 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 PrescriptionDetailsDocumentation
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
const PrescriptionDetailsDocumentation = () => {
const { prescriptionId } = useParams();
const contentRef = useRef();
const {
prescription,
- 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 getSubmenu
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
getSubmenu(item, currentSection) {
if (this.mobileMediaQuery?.matches) {
const menuSections = [
item.menuSections.mainColumn,
item.menuSections.columnOne,
Function createRoutes
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function createRoutes(formConfig) {
// Validate the config while creating the routes because this is really the
// entry point for applications to use the forms library.
// TODO: Tree shake this config validation in prod
validateConfig(formConfig);
Function replaceSchema
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
replaceSchema: (formData, _schema, _uiSchema, index, path) => {
const addressPath = getAddressPath(path); // path is ['address', 'currentField']
cachedPath = addressPath;
const data = get(addressPath, formData) ?? {};
const { country } = data;
Function prefillTransformer
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function prefillTransformer(pages, formData, metadata, state) {
const vaProfile = state.user.profile;
// For reference, I _think_ the vapContactInfo has the follow form:
// const vapContactInfo = {
Function pactAct
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
const pactAct = (state = initialState, action) => {
switch (action.type) {
case PAW_UPDATE_SERVICE_PERIOD:
return updateFormValue(SERVICE_PERIOD, false, state, action);
case PAW_UPDATE_BURN_PIT_2_1:
Function fetchFormStatus
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const fetchFormStatus = () => async dispatch => {
dispatch(initiateApiCall());
const sessionExpiration = localStorage.getItem('sessionExpiration');
const remainingSessionTime = moment(sessionExpiration).diff(moment());
if (!remainingSessionTime) {
Function render
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
return (
<div>
<va-button onClick={this.openModal} text="Opt Out" />
<VaModal
Function mailInfo
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
const mailInfo = (address, officeName, faxNum, preamble, appType) => {
const faxNumMarkup = (
<VaTelephone
contact={JSON.stringify({
phoneNumber: faxNum ?? '3033317809',
Function fetchPersonalInfo
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const fetchPersonalInfo = () => {
return async (dispatch, getState) => {
dispatch({ type: FETCH_PERSONAL_INFO });
const {
checkClaimant: { claimantId },
Function YourAppointment
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
const YourAppointment = props => {
const { avs } = props;
return (
<div className="avs-accordion-item">
Function render
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const { form } = this.props;
const { submission, formId, data } = form;
const submitDate = new Date(submission?.timestamp);
Function verifyDependents
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
function verifyDependents(state = initialState, action) {
switch (action.type) {
case DEPENDENCY_VERIFICATION_CALL_SUCCESS:
return {
...state,
Function createRecurringEvents
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
const createRecurringEvents = () => {
const recurEventData = { id: 'upcoming' };
const eventA = createEvent(
now
.clone()
Function FinancialConfirmation
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
const FinancialConfirmation = props => {
const { goBack, goForward } = props;
return (
<va-alert
Function MFA
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
const MFA = () => {
const verifyLink = useCallback(async policy => {
await verify({ policy, isLink: true, isSignup: false });
}, []);