department-of-veterans-affairs/vets-website

View on GitHub

Showing 4,231 of 14,884 total issues

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

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

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

      const profileContactInfo = ({
        content = getContent('application'),
      
        contactPath = CONTACT_INFO_PATH,
        addressSchema,
      Severity: Minor
      Found in src/platform/forms-system/src/js/definitions/profileContactInfo.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 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 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

      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 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

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

        const EvidencePrivateRequest = ({
          data = {},
          goBack,
          goForward,
          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 YearPage has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        const YearPage = ({
          editMode,
          pastMode,
          router,
          toggleEditMode,
        Severity: Minor
        Found in src/applications/income-limits/containers/YearPage.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 PrivateContent has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        export const PrivateContent = ({
          list = [],
          limitedConsent = '',
          reviewMode = false,
          onReviewPage,
        Severity: Minor
        Found in src/applications/appeals/testing/sc/components/EvidenceSummaryLists.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 ContestableIssuesLegend has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        export const ContestableIssuesLegend = ({ onReviewPage, inReviewMode }) => {
          let Wrap = 'h3';
          const wrapClassNames = ['vads-u-font-size--h3'];
          if (onReviewPage) {
            // Using a div in review mode, see
        Severity: Minor
        Found in src/applications/appeals/shared/content/contestableIssues.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 parseDateToDateObj has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        export const parseDateToDateObj = (date, template) => {
          let newDate = date;
          if (typeof date === 'string') {
            if (date.includes('T')) {
              newDate = parseISO((date || '').split('T')[0]);
        Severity: Minor
        Found in src/applications/appeals/shared/utils/dates.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

        Severity
        Category
        Status
        Source
        Language