department-of-veterans-affairs/vets-website

View on GitHub

Showing 4,231 of 14,884 total issues

Consider simplifying this complex logical expression.
Open

  if (
    errorCodes.some(
      code =>
        code === 10001 ||
        code === 10006 ||

    Consider simplifying this complex logical expression.
    Open

      if (
        monthIndex < 0 ||
        monthIndex > 11 ||
        day < 1 ||
        day > 31 ||
    Severity: Major
    Found in src/applications/mhv-medical-records/reducers/selfEnteredData.js - About 1 hr to fix

      Consider simplifying this complex logical expression.
      Open

        if (records?.length) {
          const vitalDisplayName = vitalTypeDisplayNames[records[0].type];
          const ddDisplayName = vitalDisplayName.includes('Blood oxygen level')
            ? 'Blood Oxygen'
            : vitalDisplayName;
      Severity: Major
      Found in src/applications/mhv-medical-records/containers/VitalDetails.jsx - About 1 hr to fix

        Consider simplifying this complex logical expression.
        Open

              if (
                ((prescriptionsFullList?.length &&
                  pdfTxtGenerateStatus.format !== PRINT_FORMAT.PRINT) ||
                  (pdfTxtGenerateStatus.format === PRINT_FORMAT.PRINT &&
                    (showFilterContent
        Severity: Major
        Found in src/applications/mhv-medications/containers/Prescriptions.jsx - About 1 hr to fix

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

          const generateResultsContent = async (doc, parent, data, config) => {
            const results = doc.struct('Sect', {
              title: 'Results',
            });
            parent.add(results);
          Severity: Minor
          Found in src/platform/pdf/templates/medical_records.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 testForm has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

          const testForm = testConfig => {
            const {
              appName,
              arrayPages = [],
              dataPrefix,
          Severity: Minor
          Found in src/platform/testing/e2e/cypress/support/form-tester/index.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 generateResultsContent has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

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

          module.exports = async (on, config) => {
            if (process.env.CODE_COVERAGE === 'true') {
              require('@cypress/code-coverage/task')(on, config);
              on('file:preprocessor', require('@cypress/code-coverage/use-babelrc'));
            }
          Severity: Minor
          Found in src/platform/testing/e2e/cypress/plugins/index.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 { formConfig, buttonOnly, devOnly } = this.props;
              const devOnlyForceShowFormControls =
                environment.isLocalhost() &&
                !window.Cypress &&
          Severity: Minor
          Found in src/platform/forms/save-in-progress/SaveInProgressIntro.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 titleUI has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

          export const titleUI = (titleOption, descriptionOption) => {
            const {
              title,
              description,
              headerLevel,
          Severity: Minor
          Found in src/platform/forms-system/src/js/web-component-patterns/titlePattern.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 removeDeeplyEmptyObjects has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

          export default function removeDeeplyEmptyObjects(root, checkEmpty = isEmpty) {
            // Check for null because typeof null === 'object', of course. Thanks JavaScript.
            if (typeof root !== 'object' || root === null) {
              return root;
            }
          Severity: Minor
          Found in src/platform/utilities/data/removeDeeplyEmptyObjects.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 uiSchema has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

          export function uiSchema(
            label = 'Address',
            useStreet3 = false,
            isRequired = null,
            ignoreRequired = false,
          Severity: Minor
          Found in src/platform/forms/definitions/address.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 formatDowntime has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

          export const formatDowntime = dateTime => {
            let date;
            const timeZone = 'America/New_York';
          
            if (dateTime instanceof Object) {
          Severity: Minor
          Found in src/platform/utilities/date/index.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 FormSaveErrorMessage has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

          function FormSaveErrorMessage(props) {
            const { route, formConfig, user, form, location, showLoginModal } = props;
          
            const savedStatus = form?.savedStatus;
            const appType = formConfig?.customText?.appType || APP_TYPE_DEFAULT;
          Severity: Minor
          Found in src/platform/forms/components/review/FormSaveErrorMessage.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 FormStartControls has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

          const FormStartControls = props => {
            const {
              formId,
              migrations,
              startPage,
          Severity: Minor
          Found in src/platform/forms/save-in-progress/FormStartControls.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 VaFileInputField has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

          const VaFileInputField = props => {
            const mappedProps = vaFileInputFieldMapping(props);
            const dispatch = useDispatch();
            const { formNumber } = props?.uiOptions;
            const { fileUploadUrl } = mappedProps;

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

          export default function vaTextInputFieldMapping(props) {
            const {
              description,
              textDescription,
              DescriptionField,

          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() {
              let beforeText = '';
          
              if (this.props.beforeText && this.props.beforeText === '«') {
                beforeText = (
          Severity: Minor
          Found in src/platform/forms-system/src/js/components/ProgressButton.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 useEditOrAddForm has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

          export function useEditOrAddForm({
            isEdit,
            schema,
            uiSchema,
            data,

          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 {
                uiSchema,
                errorSchema,
                idSchema,
          Severity: Minor
          Found in src/platform/forms-system/src/js/fields/ArrayField.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

          Severity
          Category
          Status
          Source
          Language