department-of-veterans-affairs/vets-website

View on GitHub

Showing 4,231 of 14,884 total issues

Function generateProgressNoteContent has 48 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const generateProgressNoteContent = record => {
  const content = {
    details: {
      header: 'Details',
      items: [
Severity: Minor
Found in src/applications/mhv-medical-records/util/pdfHelpers/notes.js - About 1 hr to fix

    Function focusElement has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

    export function focusElement(selectorOrElement, options = {}, root) {
      function applyFocus(el) {
        if (el) {
          // Use getAttribute to grab the "tabindex" attribute (returns string), not
          // the "tabIndex" property (returns number). Focusable elements will
    Severity: Minor
    Found in src/platform/utilities/ui/focus.js - About 1 hr 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 checkResponses has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

    export const checkResponses = (formResponses, displayConditionsForPath) => {
      const questionRequirements = Object.keys(displayConditionsForPath);
    
      for (const questionShortName of questionRequirements) {
        const formResponse = formResponses?.[questionShortName];
    Severity: Minor
    Found in src/applications/pact-act/utilities/display-logic-questions.js - About 1 hr 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 alertMessage has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

    const alertMessage = (alertType, appType) => {
      switch (alertType) {
        case ALERT_TYPES.ALL_ZERO:
          return {
            alertStatus: 'info',

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

    export function prefillTransformerV1(pages, formData, metadata, state) {
      const bankInformation = state.data?.bankInformation || {};
      const claimant = state.data?.formData?.data?.attributes?.claimant || {};
      const serviceData = state.data?.formData?.data?.attributes?.serviceData || [];
      const contactInfo = claimant?.contactInfo || {};
    Severity: Minor
    Found in src/applications/my-education-benefits/helpers.js - About 1 hr 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 prefillTransformerV2 has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

    export function prefillTransformerV2(pages, formData, metadata, state) {
      const bankInformation = state.data?.bankInformation || {};
      const claimant = state.data?.formData?.data?.attributes?.claimant || {};
      const serviceData = state.data?.formData?.data?.attributes?.serviceData || [];
      const contactInfo = claimant?.contactInfo || {};
    Severity: Minor
    Found in src/applications/my-education-benefits/helpers.js - About 1 hr 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 prefillTransformerV4 has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

    export function prefillTransformerV4(pages, formData, metadata, state) {
      const bankInformation = state.data?.bankInformation || {};
      const claimant = state.data?.formData?.data?.attributes?.claimant || {};
      const serviceData = state.data?.formData?.data?.attributes?.serviceData || [];
      const contactInfo = claimant?.contactInfo || {};
    Severity: Minor
    Found in src/applications/my-education-benefits/helpers.js - About 1 hr 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 SearchResults has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

    export const SearchResults = ({
      error,
      fetching,
      page,
      query,
    Severity: Minor
    Found in src/applications/find-forms/containers/SearchResults.jsx - About 1 hr 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 mapBenefitFromFormInputData has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

    export const mapBenefitFromFormInputData = (benefit, formData) => {
      if (checkExtraConditions(benefit, formData) === false) return false;
    
      const mappingKeys = Object.keys(mappingTypes);
      // Each mapping type (i.e. GOALS).
    Severity: Minor
    Found in src/applications/discover-your-benefits/reducers/actions.js - About 1 hr 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 NearByVetCenters has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

    const NearByVetCenters = props => {
      const [originalCoordinates, setOriginalCoordinates] = useState([]);
      const [fetchedVetCenters, setFetchedVetCenters] = useState([]);
      const [nearbyVetCenterDistances, setNearbyVetCenterDistances] = useState(
        false,

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

    export const deriveEventLocations = event => {
      const locations = [];
    
      if (!event) {
        return locations;
    Severity: Minor
    Found in src/applications/static-pages/events/helpers/index.js - About 1 hr 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 UpcomingAppointmentsListItem has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

    const UpcomingAppointmentsListItem = props => {
      const { app, appointment, goToDetails, router, border, count } = props;
      const { t } = useTranslation();
      const { getCurrentPageFromRouter } = useFormRouting(router);
      const page = getCurrentPageFromRouter();

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

    const createMockSuccessResponse = (
      token,
      demographicsNeedsUpdate = false,
      demographicsConfirmedAt = null,
      nextOfKinNeedsUpdate = false,

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

    export function prefillTransformer(pages, formData, metadata, state) {
      const bankInformation = state.data?.bankInformation || {};
      const claimant = state.data?.formData?.data?.attributes?.claimant || {};
      const contactInfo = claimant?.contactInfo || {};
      const stateUser = state.user;

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

    export const confirmationPageAlertParagraphV2 = ({
      formData,
      submissionApi,
      expirationDate,
      confirmationNumber = '',
    Severity: Minor
    Found in src/applications/simple-forms/21-0966/config/helpers.js - About 1 hr 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 getHealthFacilityTitle has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

    export const getHealthFacilityTitle = data => {
      const {
        YOUR_VA_HEALTH_FACILITY,
        VETERAN_VA_HEALTH_FACILITY,
        FAMILY_MEMBER_VA_HEALTH_FACILITY,
    Severity: Minor
    Found in src/applications/ask-va/config/helpers.jsx - About 1 hr 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 SpouseEmploymentQuestion has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

    const SpouseEmploymentQuestion = props => {
      const {
        data,
        goBack,
        goToPath,

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

    const PreSubmitSignature = ({
      formData,
      showError,
      onSectionComplete,
      formSubmission,

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

    export const YourClaimLetters = ({ isLoading, showClaimLetters }) => {
      const [currentItems, setCurrentItems] = useState([]);
      const [currentPage, setCurrentPage] = useState(1);
      const [lettersLoading, setLettersLoading] = useState(true);
      // Using `useRef` here to avoid triggering a rerender whenever these are

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

    const YellowRibbonSelector = ({ programs }) => {
      const mappedPrograms = programs.map(program => ({
        degreeLevel: program.degreeLevel,
        divisionProfessionalSchool: program.divisionProfessionalSchool,
        numberOfStudents: program.numberOfStudents,
    Severity: Minor
    Found in src/applications/gi/components/profile/YellowRibbonSelector.jsx - About 1 hr 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