department-of-veterans-affairs/vets-website

View on GitHub

Showing 12,821 of 12,821 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

export default {
  uiSchema: {
    ...titleUI('Phone and email address'),
    veteranPhone: phoneUI('Phone number'),
    veteranInternationalPhone: phoneUI('International phone number'),
src/applications/simple-forms/21-0966/pages/survivingDependentPhoneAndEmailAddress.js on lines 10..26

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 85.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Function paginatedThreads has 62 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const paginatedThreads = (req, res) => {
  const { index } = req.params;
  const { pageSize, pageNumber, sortField, sortOrder } = req.query;

  const sortFunc = (a, b) => {
Severity: Major
Found in src/platform/mhv/api/mocks/secure-messaging/threads/index.js - About 2 hrs to fix

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

      render() {
        const {
          columnThreeLinkClicked,
          href,
          linkClicked,
    Severity: Major
    Found in src/platform/site-wide/mega-menu/components/MenuSection.jsx - About 2 hrs to fix

      Function updateUiSchema has 62 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            updateUiSchema: formData => {
              const arrayData = formData?.[arrayPath];
              return arrayData?.length
                ? {
                    'ui:title':

        File profileAddress.js has 270 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        /**
         * This uiSchema is modeled after how addresses are handled in the Profile application, and makes the same pattern
         * available for use inside forms generated by the platform's form system.
         */
        
        
        Severity: Minor
        Found in src/platform/forms-system/src/js/definitions/profileAddress.js - About 2 hrs to fix

          Function searchWithBounds has 62 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            static searchWithBounds(
              address = null,
              bounds,
              locationType,
              serviceType,
          Severity: Major
          Found in src/applications/facility-locator/api/LocatorApi.js - About 2 hrs to fix

            Function onAddFile has 62 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              const onAddFile = async (event, index = null, password) => {
                if (event.target?.files?.length) {
                  // Only upload the first file; when va-file-input v3 supports multiple
                  // files, we'll need to update this entire component
                  const currentFile = event.target.files[0];
            Severity: Major
            Found in src/applications/appeals/shared/components/FileField.jsx - About 2 hrs to fix

              Function renderMedicalRecordInfo has 62 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const renderMedicalRecordInfo = formResponses => {
                if (
                  [
                    RESPONSES.REASON_PTSD,
                    RESPONSES.REASON_TBI,

                Function ClaimantInformation has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export default function ClaimantInformation(props) {
                  const { values, setFieldValue } = useFormikContext();
                  const getOptions = [
                    { label: 'Spouse', value: 'spouse', key: 1 },
                    { label: 'Child', value: 'child', key: 2 },
                Severity: Major
                Found in src/applications/burial-poc-v6/pages/ClaimantInformation.jsx - About 2 hrs to fix

                  Function transform has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export function transform(formConfig, form) {
                    const newSchoolTransform = formData => {
                      let clonedData = _.cloneDeep(formData);
                      delete clonedData.newSchoolName;
                      delete clonedData.newSchoolAddress;
                  Severity: Major
                  Found in src/applications/edu-benefits/1995/config/submit-transformer.js - About 2 hrs to fix

                    Function RadioWidget has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export default function RadioWidget(props) {
                      const { options, formContext = {}, value, disabled, onChange, id } = props;
                      const { enumOptions, labels = {} } = options;
                    
                      const onReviewPage = formContext?.onReviewPage || false;
                    Severity: Major
                    Found in src/applications/pre-need/components/PreparerRadioWidget.jsx - About 2 hrs to fix

                      Function AuthBenefitsPackagePage has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      const AuthBenefitsPackagePage = props => {
                        const { location, route, router } = props;
                        const { pathname } = location;
                        const { pageList } = route;
                        const { schema } = definition;
                      Severity: Major
                      Found in src/applications/hca/containers/AuthBenefitsPackagePage.jsx - About 2 hrs to fix

                        Function CustomReviewTopContent has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        const CustomReviewTopContent = () => {
                          const { form } = useSelector(state => state || {});
                          const { uploadedFile, idNumber, address, fullName } = form?.data;
                        
                          const renderFileInfo = file => (

                          Function ConfirmationPage has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          const ConfirmationPage = () => {
                            const { user, form } = useSelector(state => state);
                            const { submission, data } = form;
                            const {
                              login: { currentlyLoggedIn },
                          Severity: Major
                          Found in src/applications/ask-va/containers/ConfirmationPage.jsx - About 2 hrs to fix

                            Function aboutTheSchoolOptions has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            export function aboutTheSchoolOptions(
                              excludeCautionFlags,
                              accredited,
                              studentVeteran,
                              yellowRibbonScholarship,
                            Severity: Major
                            Found in src/applications/gi/containers/search/FilterBeforeResults.jsx - About 2 hrs to fix

                              Function typeOfInstitution has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                const typeOfInstitution = () => {
                                  const title = 'Filter your results';
                                  return (
                                    <>
                                      <hr />
                              Severity: Major
                              Found in src/applications/gi/containers/search/FilterBeforeResults.jsx - About 2 hrs to fix

                                Function validateAddress has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                export const validateAddress = (formData, fullName) => async (
                                  dispatch,
                                  getState,
                                ) => {
                                  dispatch({ type: ADDRESS_VALIDATION_START });

                                  Function RadioWidget has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  export default function RadioWidget(props) {
                                    const { options, formContext = {}, value, disabled, onChange, id } = props;
                                    const { enumOptions, labels = {} } = options;
                                  
                                    const onReviewPage = formContext?.onReviewPage || false;

                                    Function GenderIdentityAdditionalInfo has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                    export default function GenderIdentityAdditionalInfo() {
                                      return (
                                        <>
                                          <p className="vads-u-color--gray-medium vads-u-display--block vads-u-font-weight--normal vads-u-margin--0 vads-u-width--full">
                                            You can change your selection at any time. If you decide you no longer

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

                                        render() {
                                          let view;
                                      
                                          if (this.props.success) {
                                            view = (
                                      Severity: Major
                                      Found in src/applications/veteran-id-card/containers/EmailCapture.jsx - About 2 hrs to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language