department-of-veterans-affairs/vets-website

View on GitHub

Showing 3,724 of 12,675 total issues

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

const searchMessages = (req, res) => {
  const { index } = req.params;
  const { category, fromDate, toDate } = req.body;

  if (index in folders) {
Severity: Minor
Found in src/platform/mhv/api/mocks/secure-messaging/messages/index.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

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

function setupJSDom() {
  // Prevent warnings from displaying
  /* eslint-disable no-console */
  if (process.env.LOG_LEVEL === 'debug') {
    console.error = (error, reactError) => {
Severity: Minor
Found in src/platform/testing/unit/mocha-setup.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

Function saveForm has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

function saveForm(saveType, formId, formData, version, returnUrl, submission) {
Severity: Minor
Found in src/platform/forms/save-in-progress/actions.js - About 45 mins to fix

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

    export default function addFocusBehaviorToCrisisLineModal() {
      const overlay = document.getElementById('modal-crisisline');
      const modal = document.querySelector('.va-crisis-panel.va-modal-inner');
      const tabbableElements = getTabbableElements(modal);
      let openControl;
    Severity: Minor
    Found in src/platform/site-wide/accessible-VCL-modal.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

    Function saveFormApi has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

      formId,
      formData,
      version,
      returnUrl,
      savedAt,
    Severity: Minor
    Found in src/platform/forms/save-in-progress/api.js - About 45 mins to fix

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

      export function uiSchema(
        label = 'Address',
        useStreet3 = false,
        isRequired = null,
        ignoreRequired = false,
      Severity: Minor
      Found in src/platform/forms-system/src/js/definitions/address.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

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

      export const checkboxGroupUI = ({
        title,
        description,
        errorMessages,
        labels,

      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 validateDateRange has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

        errors,
        dateRange,
        formData,
        schema,
        errorMessages,
      Severity: Minor
      Found in src/platform/forms-system/src/js/validation.js - About 45 mins to fix

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

        const ArrayBuilderCards = ({
          arrayPath,
          isIncomplete = () => false,
          editItemPathUrl,
          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 SubmitButtons has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        export default function SubmitButtons(props) {
          const { onBack, onSubmit, submission, formConfig, formErrors = {} } = props;
        
          const appType = formConfig?.customText?.appType || APP_TYPE_DEFAULT;
          const buttonText =
        Severity: Minor
        Found in src/platform/forms-system/src/js/review/SubmitButtons.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

        Avoid deeply nested control flow statements.
        Open

                      if (associatedRadioInput) {
                        associatedRadioInput.focus();
                      }
        Severity: Major
        Found in src/platform/forms-system/src/js/fields/ArrayField.jsx - About 45 mins to fix

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

            render() {
              const {
                uiSchema,
                errorSchema,
                idSchema,
          Severity: Minor
          Found in src/platform/forms-system/src/js/fields/BasicArrayField.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 YesNoWidget has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

          export default function YesNoWidget({
            id,
            value,
            disabled,
            onChange,
          Severity: Minor
          Found in src/platform/forms-system/src/js/widgets/YesNoWidget.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 componentDidUpdate has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

            componentDidUpdate(prevProps, prevState) {
              // Once the va-alert is mounted, we want to set the focus to the heading
              // for screen reader use
              if (this.state.deleteInitiated && !prevState.deleteInitiated) {
                const heading = document.getElementById('deleteConfirmationHeading');

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

          export const getValidationMessageKey = ({
            suggestedAddresses,
            addressValidationError,
            confirmedSuggestions = [],
          }) => {
          Severity: Minor
          Found in src/platform/user/profile/vap-svc/util/index.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

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

            render() {
              const {
                analyticsSectionName,
                fieldName,
                isEditing,
          Severity: Minor
          Found in src/platform/user/profile/vap-svc/containers/VAPServiceProfileField.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 phoneUISchema has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

          function phoneUISchema(category) {
            const schema = {
              'ui:options': {
                hideLabelText: true,
                showFieldLabel: 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 BenefitRelinquishedLabel has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

          function BenefitRelinquishedLabel({ eligibility }) {
            if (!eligibility) {
              return <></>;
            }
          
          

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

          const BenefitRelinquishmentDate = props => {
            const { formData, setFormData } = props;
          
            const aYearAgo = moment(new Date()).subtract(1, 'y');
            const populateDate = () => {

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

          function additionalConsiderationsQuestionTitleText(
            benefitSelection,
            order,
            rudisillFlag,
            pageName,

          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