department-of-veterans-affairs/vets-website

View on GitHub

Showing 3,736 of 12,814 total issues

Function Vitals has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

const Vitals = () => {
  const dispatch = useDispatch();
  const updatedRecordList = useSelector(state => state.mr.vitals.updatedList);
  const listState = useSelector(state => state.mr.vitals.listState);
  const vitals = useSelector(state => state.mr.vitals.vitalsList);
Severity: Minor
Found in src/applications/mhv-medical-records/containers/Vitals.jsx - About 1 hr 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 extractObservedReported has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

export const extractObservedReported = allergy => {
  if (allergy && isArrayAndHasItems(allergy.extension)) {
    const extItem = allergy.extension.find(
      item => item.url && item.url.includes('allergyObservedHistoric'),
    );
Severity: Minor
Found in src/applications/mhv-medications/reducers/allergies.js - About 1 hr 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 CernerFacilityAlert has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

const CernerFacilityAlert = ({ className = '' }) => {
  const ehrDataByVhaId = useSelector(
    state => state.drupalStaticData?.vamcEhrData?.data?.ehrDataByVhaId,
  );
  const userFacilities = useSelector(state => state?.user?.profile?.facilities);

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 formatMenuItems has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const formatMenuItems = menuItems => {
  const formattedMenuItems = [];

  if (menuItems && isArray(menuItems)) {
    return menuItems;
Severity: Minor
Found in src/platform/site-wide/header/helpers/index.js - About 1 hr to fix

    Function userNavReducer has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export default function userNavReducer(state = initialState, action) {
      switch (action.type) {
        case TOGGLE_FORM_SIGN_IN_MODAL:
          return set('showFormSignInModal', action.isOpen, state);
    
    
    Severity: Minor
    Found in src/platform/site-wide/user-nav/reducers/index.js - About 1 hr to fix

      Function textUI has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export const textUI = stringOrOptions => {
        if (typeof stringOrOptions === 'string') {
          return {
            'ui:title': stringOrOptions,
            'ui:webComponentField': VaTextInputField,

        Function querySelectorWithShadowRoot has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export async function querySelectorWithShadowRoot(selector, root) {
          try {
            let selectorElement;
            const rootElement =
              typeof root === 'string'
        Severity: Minor
        Found in src/platform/utilities/ui/webComponents.js - About 1 hr to fix

          Function ArnField has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export default function ArnField(fieldProps) {
            const props = vaTextInputFieldMapping(fieldProps);
          
            const [val, setVal] = useState(props.value);
            const [displayVal, setDisplayVal] = useState(props.value);
          Severity: Minor
          Found in src/platform/forms-system/src/js/web-component-fields/ArnField.jsx - About 1 hr to fix

            Function formsPatternFieldMapping has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export default function formsPatternFieldMapping(props) {
              const { uiOptions = {} } = props;
              const {
                useFormsPattern,
                formHeading,

              Function textareaUI has 31 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export const textareaUI = stringOrOptions => {
                if (typeof stringOrOptions === 'string') {
                  return {
                    'ui:title': stringOrOptions,
                    'ui:webComponentField': VaTextareaField,

                Function profileInformation has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function profileInformation(state = initialState, action) {
                  switch (action.type) {
                    case UPDATE_PROFILE_FIELDS: {
                      const newState = mapRawUserDataToState(action.payload);
                      return { ...state, ...newState };
                Severity: Minor
                Found in src/platform/user/profile/reducers/index.js - About 1 hr to fix

                  Function mainTransform has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    const mainTransform = formData => {
                      const informalConference = formData.informalConference !== 'no';
                      const attributes = {
                        // This value may empty if the user restarts the form; see
                        // va.gov-team/issues/13814
                  Severity: Minor
                  Found in src/applications/appeals/testing/hlr/config/submit-transformer.js - About 1 hr to fix

                    Function fetchTotalDisabilityRating has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export function fetchTotalDisabilityRating() {
                      return dispatch => {
                        const {
                          FETCH_DISABILITY_RATING_STARTED,
                          FETCH_DISABILITY_RATING_FAILED,
                    Severity: Minor
                    Found in src/applications/ezr/utils/actions/disability-rating.js - About 1 hr to fix

                      Function render has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        render() {
                          captureEvents.ineligibilityAlert(this.props);
                          return (
                            <div>
                              {this.renderHeader()}

                        Function FinancialStatusConfirmation has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        const FinancialStatusConfirmation = props => {
                          const {
                            goBack,
                            goForward,
                            contentBeforeButtons,

                          Function errorAddressAlert has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          export const errorAddressAlert = deliveryPointValidation => {
                            if (deliveryPointValidation === BAD_UNIT_NUMBER) {
                              return (
                                <Alert
                                  status="warning"
                          Severity: Minor
                          Found in src/applications/verify-your-enrollment/constants/index.js - About 1 hr to fix

                            Function compareAddressObjects has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            export function compareAddressObjects(obj1, obj2) {
                              const { hasOwnProperty } = Object.prototype;
                            
                              const keys1 = Object.keys(obj1);
                              const keys2 = Object.keys(obj2);
                            Severity: Minor
                            Found in src/applications/verify-your-enrollment/helpers.jsx - About 1 hr to fix

                              Function MailOrFaxFilesContent has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              const MailOrFaxFilesContent = () => {
                                return (
                                  <>
                                    <p>
                                      We can process your request more quickly if you upload your files here.

                                Function MissingEDIPI has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                const MissingEDIPI = () => {
                                  recordEvent({
                                    event: 'visible-alert-box',
                                    'alert-box-type': 'error',
                                    'alert-box-heading': 'We need more information for your application',
                                Severity: Minor
                                Found in src/applications/lgy/coe/form/components/MissingEDIPI.jsx - About 1 hr to fix

                                  Function updateAddress has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  const updateAddress = (state = initialState, action) => {
                                    switch (action.type) {
                                      case UPDATE_ADDRESS:
                                        return {
                                          ...state,
                                  Severity: Minor
                                  Found in src/applications/verify-your-enrollment/reducers/updateAddress.js - About 1 hr to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language