department-of-veterans-affairs/vets-website

View on GitHub

Showing 4,231 of 14,884 total issues

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

export const hasDuplicateLocation = (list, currentLocation, newForm = false) =>
  !!list.find(location => {
    const {
      locationAndName,
      evidenceDates,
Severity: Minor
Found in src/applications/appeals/995/utils/submit.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 StepTwo has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

const StepTwo = ({ formResponses }) => {
  if (
    formResponses[SHORT_NAME_MAP.REASON] ===
    RESPONSES.REASON_DD215_UPDATE_TO_DD214
  ) {

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 (formResponses[nextShortName]) {
            localRoadMap.push(ROUTES?.[nextShortName]);
          }
Severity: Major
Found in src/applications/discharge-wizard/utilities/page-navigation.js - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

              if (routeMap[routeMap.length - 1] !== ROUTES?.[nextShortName]) {
                if (valueHasChanged) {
                  const index = routeMap.indexOf(ROUTES[SHORT_NAME]);
                  const newRouteMap = routeMap.slice(0, index + 1);
                  setRouteMap([...newRouteMap, ROUTES?.[nextShortName]]);
    Severity: Major
    Found in src/applications/discharge-wizard/utilities/page-navigation.js - About 45 mins to fix

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

      const StepOne = ({ formValues }) => {
        if (formValues['4_reason'] === '8') {
          return null;
        }
      
      
      Severity: Minor
      Found in src/applications/discharge-wizard/components/gpSteps/StepTwo.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

              } else if (
                displayConditionsMet(nextShortName, formResponses) &&
                !editMode
              ) {
                if (routeMap[routeMap.length - 1] !== ROUTES?.[nextShortName]) {
      Severity: Major
      Found in src/applications/discharge-wizard/utilities/page-navigation.js - About 45 mins to fix

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

        const chapterPages = arrayBuilderPages(arrayBuilderOptions, pages => {
          return {
            addChildIntro: pages.introPage({
              depends: formData => isChapterFieldRequired(formData, TASK_KEYS.addChild),
              title: 'Add child',
        Severity: Minor
        Found in src/applications/686c-674/config/chapters/report-add-child/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 submitTransformer has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        export function submitTransformer(formConfig, form) {
          const { data: formData, loadedData } = form;
          const expandedPages = expandArrayPages(
            createFormPageList(formConfig),
            formData,
        Severity: Minor
        Found in src/applications/ezr/utils/helpers/submit-transformer.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 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/686c-674/config/utilities.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 DependentInformation has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        const DependentInformation = props => {
          const { data, goToPath, setFormData } = props;
        
          const { dependents = [] } = data;
          const search = new URLSearchParams(window.location.search);
        Severity: Minor
        Found in src/applications/ezr/components/FormPages/DependentInformation.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 {
              newBenefit,
              serviceBenefitBasedOn,
              transferredEduBenefits,
        Severity: Minor
        Found in src/applications/edu-benefits/components/EducationWizard.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 transformForSubmit has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        export default function transformForSubmit(formConfig, form) {
          const transformedData = JSON.parse(
            formsSystemTransformForSubmit(formConfig, form),
          );
        
        
        Severity: Minor
        Found in src/applications/ivc-champva/10-10D/config/submitTransformer.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 ApplicantRelationshipReviewPage has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        export function ApplicantRelationshipReviewPage(props) {
          const { data, keyname = KEYNAME, primary = PRIMARY, secondary = SECONDARY } =
            props || {};
          const genOps = props.genOp || generateOptions;
          const {

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

        export const translateDateIntoMonthDayYearFormat = (
          dateString,
          isDelimiting = false,
        ) => {
          // Parse the date string as UTC
        Severity: Minor
        Found in src/applications/verify-your-enrollment/helpers.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 Search has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        const Search = ({ isDesktop, searchIsOpen }) => {
          const [inputValue, setInputValue] = useState('');
          const searchInput = document.getElementById(
            'search-header-dropdown-input-field',
          );
        Severity: Minor
        Found in src/applications/proxy-rewrite/partials/search.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 SearchResult has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        const SearchResult = ({
          officer,
          key,
          addressLine1,
          addressLine2,

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

        const PageAnalysis = ({ page, pageName, urlPrefix }) => {
          const formData = useSelector(state => state?.form?.data || {});
          const hasCustomPage = isReactComponent(page?.CustomPage);
          const hasCustomPageReview = isReactComponent(page?.CustomPageReview);
          const hasUiSchema = page?.uiSchema && Object.keys(page?.uiSchema).length > 0;

        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/_mock-form-ae-design-patterns/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

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

        const DependentInformation = props => {
          const { data, goToPath, setFormData } = props;
        
          const { dependents = [] } = data;
          const search = new URLSearchParams(window.location.search);

        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