department-of-veterans-affairs/vets-website

View on GitHub

Showing 3,724 of 12,675 total issues

Function locationInfo has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

export const locationInfo = (city, state, country) => {
  let address = '';
  if (isCountryUSA(country)) {
    if (city && state) {
      address = `${city}, ${state}`;
Severity: Minor
Found in src/applications/gi/utils/helpers.js - About 55 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 ConnectedDevicesSection has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

export const ConnectedDevicesSection = ({
  connectedDevices,
  successAlert,
  failureAlert,
  disconnectSuccessAlert,

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

const CopyAddressModal = props => {
  const {
    mailingAddress = null,
    homeAddress,
    transaction,

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

export const mockGetRefreshStatus = () => {
  switch (scenario) {
    case 1: {
      return mockStatusResponse(0, 80, 70, 70); // STALE
    }
Severity: Minor
Found in src/applications/mhv-medical-records/util/testHelper.js - About 55 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 getLatestCopay has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

export const getLatestCopay = statements => {
  if (!statements) return null;
  return statements.reduce((acc, currentCopay) => {
    if (currentCopay.pSStatementDateOutput) {
      if (!acc) {
Severity: Minor
Found in src/applications/personalization/dashboard/helpers.jsx - About 55 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 dateFormatWithoutTimezone has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

export const dateFormatWithoutTimezone = datetime => {
  let withoutTimezone = datetime;
  if (typeof datetime === 'string' && datetime.includes('-')) {
    // Check if datetime has a timezone and strip it off if present
    if (datetime.includes('T')) {
Severity: Minor
Found in src/applications/mhv-medical-records/util/helpers.js - About 55 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 render has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  render() {
    const {
      activeIndex,
      isOpen,
      inputValue,

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

const RadiologySingleImage = () => {
  const dispatch = useDispatch();
  const { labId, imageId } = useParams();
  // const labAndTestDetails = useSelector(
  //   state => state.mr.labsAndTests.labsAndTestsDetails,
Severity: Minor
Found in src/applications/mhv-medical-records/containers/RadiologySingleImage.jsx - About 55 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 VeteranDetails has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

function VeteranDetails({ profile }) {
  const { veteranSocialSecurityNumber, vaFileNumber, dob, gender } = profile;
  const { first, middle, last, suffix } = profile.userFullName;
  const mask = srSubstitute('●●●–●●–', 'ending with');

Severity: Minor
Found in src/applications/representative-appoint/components/VeteranDetails.jsx - About 55 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 PrescriptionDetailsDocumentation has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

const PrescriptionDetailsDocumentation = () => {
  const { prescriptionId } = useParams();
  const { search } = useLocation();
  const queryParams = new URLSearchParams(search);
  const ndcNumber = queryParams.get('ndc');

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

export const buildMedicationInformationPDF = list => {
  const listOfHeaders = ['h2', 'h3'];
  const sections = [
    ...list
      .filter(listItem => listOfHeaders.includes(listItem.type))
Severity: Minor
Found in src/applications/mhv-medications/util/pdfConfigs.js - About 55 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 uiSchemaValidate has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

  errors,
  uiSchema,
  schema,
  formData,
  path = '',
Severity: Major
Found in src/platform/forms-system/src/js/validation.js - About 50 mins to fix

    Function uploadFile has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

      file,
      uiOptions,
      onProgress,
      onChange,
      onError,
    Severity: Major
    Found in src/platform/forms-system/src/js/actions.js - About 50 mins to fix

      Function validateMilitaryCity has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

        errors,
        city,
        formData,
        schema,
        messages,
      Severity: Major
      Found in src/applications/disability-benefits/all-claims/validations.js - About 50 mins to fix

        Function validateMilitaryState has 7 arguments (exceeds 4 allowed). Consider refactoring.
        Open

          errors,
          state,
          formData,
          schema,
          messages,
        Severity: Major
        Found in src/applications/disability-benefits/all-claims/validations.js - About 50 mins to fix

          Function uiSchema has 7 arguments (exceeds 4 allowed). Consider refactoring.
          Open

            subHeader = veteranApplicantDetailsSubHeader,
            description = '',
            nameUI = nonPreparerFullMaidenNameUI,
            ssnUI = ssnDashesUI,
            dateOfBirthUI = nonPreparerDateOfBirthUI,

            Function uiSchema has 7 arguments (exceeds 4 allowed). Consider refactoring.
            Open

              subHeader = veteranApplicantDetailsSubHeader,
              description = '',
              nameUI = nonPreparerFullMaidenNameUI,
              ssnUI = ssnDashesUI,
              dateOfBirthUI = nonPreparerDateOfBirthUI,

              Avoid deeply nested control flow statements.
              Open

                    if (sortOrder === 'ASC') {
                      return a.attributes.recipientName.localeCompare(
                        b.attributes.recipientName,
                      );
                    }
              Severity: Major
              Found in src/platform/mhv/api/mocks/secure-messaging/threads/index.js - About 45 mins to fix

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

                const generateHeaderBanner = async (doc, header, data, config) => {
                  doc.moveDown(1);
                  const currentHeight = doc.y;
                
                  // Calculate text width
                Severity: Minor
                Found in src/platform/pdf/templates/utils.js - 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

                Avoid deeply nested control flow statements.
                Open

                      if (sortOrder === 'DESC') {
                        return b.attributes.recipientName.localeCompare(
                          a.attributes.recipientName,
                        );
                      }
                Severity: Major
                Found in src/platform/mhv/api/mocks/secure-messaging/threads/index.js - About 45 mins to fix
                  Severity
                  Category
                  Status
                  Source
                  Language