department-of-veterans-affairs/vets-website

View on GitHub

Showing 3,724 of 12,675 total issues

Function toggleSMSNotificationsSuccess has 65 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const toggleSMSNotificationsSuccess = (enrolled = true) => {
  return [
    rest.put(`${prefix}/v0/profile/telephones`, (req, res, ctx) => {
      return res(
        ctx.json({
Severity: Major
Found in src/applications/personalization/profile/msw-mocks.js - About 2 hrs to fix

    Function folders has 65 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export default function folders(state = initialState, action) {
      switch (action.type) {
        case FETCH_FOLDER_SUCCESS: {
          const { attributes } = action.folder.data;
          const messages = action.messages.data.map(message => message.attributes);
    Severity: Major
    Found in src/applications/personalization/dashboard/reducers/folders.js - About 2 hrs to fix

      Function labsAndTestsReducer has 65 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export const labsAndTestsReducer = (state = initialState, action) => {
        switch (action.type) {
          case Actions.LabsAndTests.GET: {
            return {
              ...state,
      Severity: Major
      Found in src/applications/mhv-medical-records/reducers/labsAndTests.js - About 2 hrs to fix

        Function MedicationsListSort has 65 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const MedicationsListSort = props => {
          const { value, sortRxList } = props;
          const history = useHistory();
          const showRefillContent = useSelector(selectRefillContentFlag);
          const [sortListOption, setSortListOption] = useState(value);

          Function UNSAFE_componentWillReceiveProps has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
          Open

            UNSAFE_componentWillReceiveProps(newProps) {
              // When a user is logged in, the profile finishes loading after the component
              //  has mounted, so we check here.
              // If we're done loading the profile, check to see if we should load or redirect
              if (
          Severity: Minor
          Found in src/platform/forms/save-in-progress/RoutedSavableApp.jsx - About 2 hrs 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 buildAddressArray has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
          Open

          export function buildAddressArray(location, titleCaseText = false) {
            if (location && location.type === LocationType.CC_PROVIDER) {
              const { address } = location.attributes;
          
              if (!isEmpty(address)) {
          Severity: Minor
          Found in src/applications/facility-locator/utils/facilityAddress.js - About 2 hrs 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 alertMessage has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
          Open

          const alertMessage = (alertType, appType) => {
            switch (alertType) {
              case ALERT_TYPES.ALL_ZERO:
                return {
                  alertStatus: 'info',

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

          const ShowAlertOrSip = ({ basename, sipOptions, bottom }) => {
            const loggedIn = useSelector(isLoggedIn);
            // Verified LOA3?
            const isVerified = useSelector(
              state => selectProfile(state)?.verified || false,
          Severity: Minor
          Found in src/applications/appeals/shared/components/ShowAlertOrSip.jsx - About 2 hrs 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 DependentsPage has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
          Open

          const DependentsPage = ({
            dependents,
            editMode,
            pastMode,
            router,
          Severity: Minor
          Found in src/applications/income-limits/containers/DependentsPage.jsx - About 2 hrs 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 LevelThreeLinks has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
          Open

          const LevelThreeLinks = ({
            activeMenu,
            menuSections,
            setLevelTwoMenuOpen,
            setLinkShouldFocus,

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

          export default function V1V3Page() {
            /** @param {import('react').FormEvent | import('@department-of-veterans-affairs/web-components/dist/types/components').VaSelectCustomEvent } evt */
            function updateValue(evt) {
              const { value, name } = /** @type {HTMLInputElement} */ (evt.target);
              const display = document.getElementById(`${name}Value`);
          Severity: Minor
          Found in src/applications/ds-playground/pages/V1V3Page.jsx - About 2 hrs 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 TermsOfUse has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
          Open

          export default function TermsOfUse() {
            const isAuthenticatedWithSiS = useSelector(isAuthenticatedWithOAuth);
            const isAuthenticatedWithIAM = useSelector(isAuthenticatedWithSSOe);
            const [isDisabled, setIsDisabled] = useState(false);
            const [isMiddleAuth, setIsMiddleAuth] = useState(true);
          Severity: Minor
          Found in src/applications/terms-of-use/containers/TermsOfUse.jsx - About 2 hrs 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 ShowAlertOrSip has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
          Open

          const ShowAlertOrSip = ({ basename, sipOptions, bottom }) => {
            const loggedIn = useSelector(isLoggedIn);
            // Verified LOA3?
            const isVerified = useSelector(
              state => selectProfile(state)?.verified || 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 NearbyLocations has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
          Open

          const NearbyLocations = props => {
            const [originalCoordinates, setOriginalCoordinates] = useState([]);
            const [nearbyVADistances, setNearbyVADistances] = useState(false);
            const dispatch = useDispatch();
          
          

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

          export default function V3BasePage() {
            /** @param {import('react').FormEvent | import('@department-of-veterans-affairs/web-components/dist/types/components').VaSelectCustomEvent } evt */
            function updateValue(evt) {
              const { value, name } = /** @type {HTMLInputElement} */ (evt.target);
              const display = document.getElementById(`${name}Value`);
          Severity: Minor
          Found in src/applications/ds-v3-playground/pages/V3BasePage.jsx - About 2 hrs 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 19 (exceeds 5 allowed). Consider refactoring.
          Open

          const submitTransformer = (formConfig, form) => {
            const { data: formData } = form;
            const primaryKey = formData['view:hasPrimaryCaregiver'] ? 'primary' : null;
            const SecondaryOneKey = formData['view:hasSecondaryCaregiverOne']
              ? 'secondaryOne'
          Severity: Minor
          Found in src/applications/caregivers/config/submit-transformer.js - About 2 hrs 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 GrossMonthlyIncomeInput has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
          Open

          const GrossMonthlyIncomeInput = props => {
            const { goToPath, goBack, setFormData } = props;
          
            const editIndex = getJobIndex();
          
          

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

          const SpouseGrossMonthlyIncomeInput = props => {
            const { goToPath, goBack, setFormData } = props;
          
            const editIndex = getJobIndex();
          
          

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

          const MessageThreadItem = props => {
            const dispatch = useDispatch();
            const accordionItemRef = useRef();
            const { message, isDraftThread, open, forPrint } = props;
            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 parseTestFile has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
          Open

          function parseTestFile(features, code) {
            const stack = [];
            const ast = parser.parse(code, { sourceType: 'module', plugins: ['jsx'] });
            traverse.default(ast, {
              enter(path) {
          Severity: Minor
          Found in src/applications/vaos/scripts/gherkin.js - About 2 hrs 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