Showing 3,724 of 12,675 total issues
Function validateDate
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const validateDate = (errors, rawDateString = '', fullData) => {
const date = createDateObject(rawDateString);
const error =
(fullData?.dateType || 'decisions') === 'decisions'
? sharedErrorMessages.decisions
- 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 getPhone
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const getPhone = formData => {
const data = formData || {};
const { veteran = {} } = data;
const primary = data[PRIMARY_PHONE] || '';
// we shouldn't ever get to this point without a home or mobile phone
- 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 PrevApplicationYear
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const PrevApplicationYear = ({
formResponses,
setPrevApplicationYear,
router,
viewedIntroPage,
- 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 handleTokenRequest
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const handleTokenRequest = async ({
code: authCode,
state: authState,
csp,
generateOAuthError,
- 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 useSetToggleParam
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const useSetToggleParam = toggleValue => {
useEffect(
() => {
const urlParams = new URLSearchParams(window.location.search);
if (toggleValue != null && toggleValue !== 'undefined') {
- 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 BenefitSelectionWarning
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export default function BenefitSelectionWarning(chapter, relationship) {
let warningText = '';
if (chapter === 'chapter33') {
// Fry
if (relationship === 'child') {
- 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 acceptableFileList
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export function acceptableFileList(list) {
if (list.length === 0) return <></>;
const parseItem = (item, idx) => {
// If we have nested items (we allow one layer deep nesting)
// then make a <ul> to nest
- 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 MegaMenu
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const MegaMenu = ({
isDesktop,
levelOneIndexOpen,
levelTwoMenuOpen,
megaMenuData,
- 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 ChangeOfDirectDepositWrapper
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const ChangeOfDirectDepositWrapper = ({ applicantName }) => {
const prefix = 'GI-Bill-Chapters-';
const [toggleDirectDepositForm, setToggleDirectDepositForm] = useState(false);
const [formData, setFormData] = useState();
const [showModal, setShowModal] = useState(false);
- 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 MonthReviewCard
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export default function MonthReviewCard({
month,
informationIncorrectMonth,
onEditMonth,
reviewPage = false,
- 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 HandlePrefilledSSN
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export default function HandlePrefilledSSN(fieldProps) {
const props = vaTextInputFieldMapping(fieldProps);
const [val, setVal] = useState(props.value);
const [displayVal, setDisplayVal] = useState(props.value);
const [cleared, setCleared] = useState(false);
- 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 addressLabel
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const addressLabel = address => {
// Destructure address object for easier access
const {
addressLine1,
addressLine2,
- 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 hasFormChanged
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const hasFormChanged = obj => {
const keys = Object.keys(obj ?? {});
for (const key of keys) {
const value = obj[key];
// Skip the specific key
- 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 getPrimaryContact
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function getPrimaryContact(data) {
// If a certification name is present, third party signer is the certifier
const useCert =
data?.certification?.firstName && data?.certification?.firstName !== '';
- 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 getDateRangesBetween
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const getDateRangesBetween = (date1, date2) => {
const [year1, month1] = date1.split('-').map(str => parseInt(str, 10));
const [year2, month2] = date2.split('-').map(str => parseInt(str, 10));
const ranges = [];
- 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 mapEnrollmentVerificationsForSubmission
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const mapEnrollmentVerificationsForSubmission = ev => {
// The enrollments are in order with the most recent first. Look
// for the first non-null verificationStatus (or, the most recent
// month) that was verified as either correct or incorrect.
const mostRecentVerifiedEnrollmentIndex = ev.enrollmentVerifications.findIndex(
- 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 translateDateIntoMonthDayYearFormat
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const translateDateIntoMonthDayYearFormat = dateString => {
// Parse the date string as UTC
if (!dateString) return null;
const [year, month, day] = dateString
.split('-')
- 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 MegaMenu
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const MegaMenu = ({ megaMenuData }) => {
const [levelOneIndexOpen, setLevelOneIndexOpen] = useState(null);
const [levelTwoIndexOpen, setLevelTwoIndexOpen] = useState(null);
const clearMenu = () => {
- 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 appendReportsFromLocalStorage
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const appendReportsFromLocalStorage = resultsArray => {
const localReportsArray = localStorage.getItem('vaReports');
if (localReportsArray) {
const parsedLocalReportsArray = JSON.parse(localReportsArray);
- 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 parseRedirectUrl
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const parseRedirectUrl = url => {
if (!url) {
return `${environment.BASE_URL}`;
}
- 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"