department-of-veterans-affairs/vets-website

View on GitHub

Showing 3,732 of 12,811 total issues

Function transformForSubmit has 44 lines of code (exceeds 25 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-7959f-2/config/submitTransformer.js - About 1 hr to fix

    Function mockSearchResults has 44 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function mockSearchResults() {
      return {
        data: [
          {
            distance: 1.25,
    Severity: Minor
    Found in src/applications/representative-search/actions/index.js - About 1 hr to fix

      Function MailingAddressInfoPageTaskYellow has 44 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export const MailingAddressInfoPageTaskYellow = () => {
        const mailingAddress = useSelector(selectVAPMailingAddress);
      
        const showSuccessAlert = window.sessionStorage.getItem(
          'onReviewPageContactInfoEdit',

        Function enrollmentStatus has 44 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function enrollmentStatus(state = ENROLLMENT_STATUS_INIT_STATE, action) {
          const { response = {}, type } = action;
          const {
            FETCH_ENROLLMENT_STATUS_STARTED,
            FETCH_ENROLLMENT_STATUS_SUCCEEDED,
        Severity: Minor
        Found in src/applications/hca/reducers/enrollment-status.js - About 1 hr to fix

          Function facilitiesList has 44 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                facility => {
                  const processed = processPhoneNumber(facility.attributes.phone.main);
                  const phone = processed.processed ? (
                    <va-telephone
                      contact={processed.phone}

            Function fetchPreCheckIn has 44 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                () => {
                  api.v2
                    .getPreCheckInData(token, reload)
                    .then(json => {
                      if (json.error) {
            Severity: Minor
            Found in src/applications/check-in/hooks/useGetCheckInData.jsx - About 1 hr to fix

              Function Complete has 44 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const Complete = props => {
                const { router } = props;
                const { t } = useTranslation();
                const { updateError } = useUpdateError();
                const { isLoading, travelPayClaimError } = usePostTravelOnlyClaim({ router });
              Severity: Minor
              Found in src/applications/check-in/travel-claim/pages/complete/index.jsx - About 1 hr to fix

                Function updateSchema has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        updateSchema: (formData, schema, uiSchema) => {
                          const { thirdPartyType, personFullName, organizationName } = formData;
                          let thirdPartyName = 'the third-party';
                          let labelString = '';
                
                
                Severity: Minor
                Found in src/applications/simple-forms/21-0845/pages/securityQuestion.js - About 1 hr to fix

                  Function PageFieldSummary has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  const PageFieldSummary = props => {
                    const { renderedProperties, defaultEditButton, title, updatedPage } = props;
                    const { allPages } = setupPages(formConfig);
                    const currentPage = allPages.filter(page => page.key === updatedPage);
                    const alertPage = allPages.filter(page => page.title === title);
                  Severity: Minor
                  Found in src/applications/ask-va/components/PageFieldSummary.jsx - About 1 hr to fix

                    Function MakePayment has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    const MakePayment = () => {
                      useEffect(() => {
                        recordEvent({
                          event: 'howToWizard-alert-displayed',
                          'reason-for-alert': 'make a payment on a debt',

                      Function alertsReducer has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export const alertsReducer = (state = initialState, action) => {
                        switch (action.type) {
                          case Actions.Alerts.CLOSE_ALERT:
                            // Set visibility to false and set ALL alerts to inactive.
                            return {
                      Severity: Minor
                      Found in src/applications/mhv-secure-messaging/reducers/alerts.js - About 1 hr to fix

                        Function ScheduleCernerPage has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export default function ScheduleCernerPage() {
                          const dispatch = useDispatch();
                          const facility = useSelector(getChosenFacilityInfo);
                        
                          const history = useHistory();

                          Function parseTestFile has 44 lines of code (exceeds 25 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 1 hr to fix

                            Function transformFormToVARequest has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            export function transformFormToVARequest(state) {
                              const facility = getChosenFacilityInfo(state);
                              const data = getFormData(state);
                              const typeOfCare = getTypeOfCare(data);
                              const siteId = getSiteIdForChosenFacility(state);

                              Function submitRequest has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              export function submitRequest(id, cstClaimPhasesEnabled = false) {
                                return dispatch => {
                                  dispatch({
                                    type: SUBMIT_DECISION_REQUEST,
                                  });
                              Severity: Minor
                              Found in src/applications/claims-status/actions/index.js - About 1 hr to fix

                                Function onUpdateClicked has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                  const onUpdateClicked = async () => {
                                    const addressState = {
                                      ...stateAndZip,
                                      state: stateAndZip.stateCode,
                                    };

                                  Function getAppeals has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  export function getAppeals() {
                                    const startTimestampMs = Date.now();
                                  
                                    return dispatch => {
                                      dispatch({ type: FETCH_APPEALS_PENDING });
                                  Severity: Minor
                                  Found in src/applications/personalization/dashboard/actions/appeals.js - About 1 hr to fix

                                    Function Alert has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                    const Alert = props => {
                                      const { isAlertVisible, paginatedPrescriptionsList } = props;
                                    
                                      return (
                                        <div className={`${isAlertVisible ? 'vads-u-margin-top--5' : ''}`}>
                                    Severity: Minor
                                    Found in src/applications/mhv-medications/components/shared/Alert.jsx - About 1 hr to fix

                                      Function Search has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                      export const Search = ({ searchDropdownComponentEnabled }) => {
                                        const [term, setTerm] = useState('');
                                      
                                        const onFormSubmit = event => {
                                          event.preventDefault();
                                      Severity: Minor
                                      Found in src/platform/site-wide/header/components/Search/index.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 updateFormDataAddress has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                      export const updateFormDataAddress = (
                                        oldFormData,
                                        formData,
                                        path,
                                        index = null, // this is included in the path, but added as

                                      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