department-of-veterans-affairs/vets-website

View on GitHub

Showing 4,231 of 14,884 total issues

Function DisabilityRating has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const DisabilityRating = () => {
  const hasError = useSelector(totalDisabilityError);
  const rating = useSelector(state => state.totalRating?.totalDisabilityRating);
  const canAccessRatingInfo = useSelector(canAccess)?.[API_NAMES.RATING_INFO];

    Function useDowntimeApproachingRenderMethod has 36 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export default function useDowntimeApproachingRenderMethod() {
      const [modalDismissed, setModalDismissed] = useState(false);
    
      return (downtime, children) => {
        if (downtime.status === externalServiceStatus.downtimeApproaching) {

      Function sections has 36 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            .map(listItem => {
              const object = { header: '', headerSize: 'H2', items: [] };
              object.header = listItem.text;
              const index = list.indexOf(listItem);
              const nextHeader = list
      Severity: Minor
      Found in src/applications/mhv-medications/util/pdfConfigs.js - About 1 hr to fix

        Function ClaimantType has 36 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const ClaimantType = props => {
          const { formData, router, setFormData, loggedIn } = props;
        
          const [localData, setLocalData] = useState({});
        
        
        Severity: Minor
        Found in src/applications/representative-appoint/components/ClaimantType.jsx - About 1 hr to fix

          Function generateDetailsContentSets has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

          const generateDetailsContentSets = async (doc, parent, data) => {
            const details = doc.struct('Sect', {
              title: 'Details',
            });
            parent.add(details);
          Severity: Minor
          Found in src/platform/pdf/templates/self_entered_info.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 generateDetailsContentSets has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

          const generateDetailsContentSets = async (doc, parent, data) => {
            const details = doc.struct('Sect', {
              title: 'Details',
            });
            parent.add(details);
          Severity: Minor
          Found in src/platform/pdf/templates/blue_button_report.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 MenuItemLevel1 has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

          export const MenuItemLevel1 = ({
            expandedMenuID,
            item,
            updateExpandedMenuID,
          }) => {
          Severity: Minor
          Found in src/platform/site-wide/header/components/MenuItemLevel1/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 uiSchemaValidate has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

          export function uiSchemaValidate(
            errors,
            uiSchema,
            schema,
            formData,
          Severity: Minor
          Found in src/platform/forms-system/src/js/validation.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 render has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

            render() {
              const { idSchema, formContext, formData, uiSchema, schema } = this.props;
              const id = idSchema.$id;
          
              // wrap matching text in a <span> element
          Severity: Minor
          Found in src/platform/forms-system/src/js/fields/AutosuggestField.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 checkTypeAndExtensionMatches has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

          export default function checkTypeAndExtensionMatches({ file, result }) {
            // file.name and file.type may be undefined in some browsers, see
            // https://developer.mozilla.org/en-US/docs/Web/API/File#browser_compatibility
            const extension = (file.name || '')
              .toLowerCase()

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

          export const determineResultsPage = (formResponses, router) => {
            const responseToServicePeriod = getServicePeriodResponse(formResponses);
            const { RESULTS_4 } = SHORT_NAME_MAP;
          
            const resultsPages = DISPLAY_CONDITIONS?.RESULTS;
          Severity: Minor
          Found in src/applications/pact-act/utilities/display-logic-results.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 getLatestDebt has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

          export const getLatestDebt = debts => {
            return debts
              ? debts.reduce((acc, curr) => {
                  const mostRecentHistory = head(curr.debtHistory);
                  if (mostRecentHistory) {

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

          export function sessionTypeUrl({
            type = '',
            queryParams = {},
            version = API_VERSION,
            allowVerification = false,
          Severity: Minor
          Found in src/platform/user/authentication/utilities.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 getLatestBill has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

          export const getLatestBill = bills => {
            return bills
              ? bills.reduce((acc, currBill) => {
                  if (currBill.pSStatementDateOutput) {
                    if (!acc) {

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

          const AreaOfDisagreement = ({
            data = {},
            pagePerItemIndex,
            goBack,
            goForward,

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

          const StepOne = ({ formResponses }) => {
            const reason = formResponses[SHORT_NAME_MAP.REASON];
            const specialReason = [
              RESPONSES.REASON_PTSD,
              RESPONSES.REASON_TBI,

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

          export const answerReview = (key, formValues) => {
            const ans = formValues[key];
            const dischargeYearLabel = prevApplicationYearCutoff[formValues['4_reason']];
            const monthObj = options.months.find(
              m => String(m.value) === formValues['3_dischargeMonth'],
          Severity: Minor
          Found in src/applications/discharge-wizard/helpers/index.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 InboxPage has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

          const InboxPage = ({
            claimStatus,
            getClaimStatus,
            user,
            MEBClaimStatusFetchInProgress,
          Severity: Minor
          Found in src/applications/education-letters/containers/InboxPage.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 PreSubmitNotice has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

          function PreSubmitNotice({
            formData,
            showError,
            onSectionComplete,
            setPreSubmit,
          Severity: Minor
          Found in src/applications/edu-benefits/5490/containers/PreSubmitInfo.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 customFormReplacer has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

          export const customFormReplacer = (key, value) => {
            // clean up empty objects, which we have no reason to send
            if (typeof value === 'object') {
              const fields = Object.keys(value);
              if (
          Severity: Minor
          Found in src/applications/686c-674/config/utilities.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

          Severity
          Category
          Status
          Source
          Language