department-of-veterans-affairs/vets-website

View on GitHub

Showing 3,724 of 12,675 total issues

Function getKeyIndex has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

export function getKeyIndex(key, objectName, formData) {
  if (
    !formData ||
    !formData?.toxicExposure ||
    !formData?.toxicExposure[objectName]

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 ConfirmationPage has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

export const ConfirmationPage = props => {
  useLayoutEffect(() => {
    focusElement('h2', null, 'va-alert');
    scrollToTop('topScrollElement');
  }, []);
Severity: Minor
Found in src/applications/simple-forms/21-0966/containers/ConfirmationPage.jsx - About 45 mins to fix

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 FacilityConfirmation has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

const FacilityConfirmation = props => {
  const { data, goBack, goForward, goToPath } = props;
  const selectedFacility = data['view:plannedClinic'].veteranSelected;
  const selectedCaregiverSupportFacility =
    data['view:plannedClinic'].caregiverSupport;

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 App has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

export default function App({ params }) {
  let selectedLanguage = 'en';
  let alternateLangauge = 'es';
  let alternateRefBase = '/covid19screen/';

Severity: Minor
Found in src/applications/coronavirus-screener/containers/App.jsx - About 45 mins to fix

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 IntroductionPage has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

const IntroductionPage = props => {
  const { route, toggleLoginModal, loggedIn } = props;
  const { formConfig, pageList, pathname, formData } = route;
  const [inquiryData, setInquiryData] = useState(false);
  const [searchReferenceNumber, setSearchReferenceNumber] = useState('');
Severity: Minor
Found in src/applications/ask-va/containers/IntroductionPage.jsx - About 45 mins to fix

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 CategorySelectPage has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

const CategorySelectPage = props => {
  const { onChange, loggedIn, goBack, goToPath, formData } = props;
  const dispatch = useDispatch();

  const [apiData, setApiData] = useState([]);
Severity: Minor
Found in src/applications/ask-va/containers/CategorySelectPage.jsx - About 45 mins to fix

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 VaMedicalCenter has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

const VaMedicalCenter = props => {
  const { formContext, id, onChange, value, veteranFacilityState } = props;
  const { reviewMode, submitted } = formContext;

  const [facilities, setFacilities] = useState([]);
Severity: Minor
Found in src/applications/caregivers/components/FormFields/VaMedicalCenter.jsx - About 45 mins to fix

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 FileUpload has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

const FileUpload = props => {
  const {
    acceptFileTypes = '.pdf,.jpeg,.png',
    buttonText = 'Upload file',
    error,
Severity: Minor
Found in src/applications/ask-va/components/FileUpload.jsx - About 45 mins to fix

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 OtherExpensesSummary has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

const OtherExpensesSummary = ({
  data,
  goToPath,
  goForward,
  setFormData,

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 SpouseOtherIncomeSummary has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

const SpouseOtherIncomeSummary = ({
  data,
  goToPath,
  goForward,
  setFormData,

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 getError has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

const getError = (debt, resolutionAmount, submitted) => {
  // Copays and debts have current balances in different locations
  //  check type of debt and cooresponding current balance
  const overCurrent =
    (debt.debtType === 'DEBT' && debt?.currentAr <= debt.resolutionComment) ||

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 ResolutionComments has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

const ResolutionComments = ({
  goBack,
  goForward,
  goToPath,
  contentBeforeButtons,

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 DependentAgesReview has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

const DependentAgesReview = () => {
  const hasDependents = useSelector(
    state => state.form.data.questions?.hasDependents,
  );
  const dependents = useSelector(

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 DashboardUnreadMessages has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

const DashboardUnreadMessages = props => {
  const { inbox } = props;

  const { noAssociations, allTriageGroupsBlocked } = useSelector(
    state => state.sm.recipients,

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 getBenefitOptionText has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

export function getBenefitOptionText(
  option,
  value,
  isVeteran,
  awardEffectiveDate,
Severity: Minor
Found in src/applications/letters/utils/helpers.jsx - About 45 mins to fix

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 CancelPageLayoutRequest has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

export default function CancelPageLayoutRequest() {
  const { id } = useParams();
  const {
    bookingNotes,
    email,

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 VideoLocation has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

export default function VideoLocation({ appointment, facility }) {
  const isPast = appointment.vaos.isPastAppointment;
  const genericPastContent = <span>Video conference</span>;

  if (isClinicVideoAppointment(appointment)) {

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 ConfirmedAppointmentDetailsPage has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

export default function ConfirmedAppointmentDetailsPage() {
  const dispatch = useDispatch();
  const { id } = useParams();
  const {
    appointment,

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 CernerTransitioningFacilityAlert has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

const CernerTransitioningFacilityAlert = ({ t5, t30, facilityId }) => {
  const user = useSelector(selectUser);
  const transitioningFacilityId = facilityId;
  const userFacilities = user.profile.facilities;
  const ehrFacilities = useSelector(selectEhrDataByVhaId);

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 ReviewPage has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

export default function ReviewPage() {
  const pageTitle = useSelector(state => getPageTitle(state, pageKey));

  const dispatch = useDispatch();
  const {
Severity: Minor
Found in src/applications/vaos/new-appointment/components/ReviewPage/index.jsx - About 45 mins to fix

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

Severity
Category
Status
Source
Language