department-of-veterans-affairs/vets-website

View on GitHub

Showing 12,833 of 12,833 total issues

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

OrdersBlock.propTypes = {
  heading: PropTypes.string,
  intro: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
  orders: PropTypes.array,
  type: PropTypes.object,
Severity: Major
Found in src/applications/avs/components/OrdersBlock.jsx and 1 other location - About 1 hr to fix
src/platform/site-wide/alerts/MobileAppCallout.jsx on lines 67..72

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 63.

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

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

  function getUrl(lang) {
    const url = new URL(window.location.href);
    url.searchParams.set('lang', lang);
    return `${url.pathname}${url.search}`;
  }
Severity: Major
Found in src/applications/check-in/components/LanguagePicker.jsx and 1 other location - About 1 hr to fix
src/applications/check-in/components/AppointmentListInfoBlock.jsx on lines 11..15

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 63.

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

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

          {distance && (
            <div
              id={`representative-${representativeId}`}
              className="vads-u-font-weight--bold vads-u-font-family--serif"
            >
src/applications/representative-search/components/results/SearchResult.jsx on lines 151..158

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 63.

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

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

              <p>
                Or,{' '}
                <button
                  type="button"
                  className="va-button-link"
src/applications/vaos/covid-19-vaccine/components/VAFacilityPage/index.jsx on lines 267..281

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 63.

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

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

      if (typeof nextAction === 'string') {
        nextPage = pageFlow[nextAction];
        nextStateKey = nextAction;
      } else {
        nextStateKey = await nextAction(getState(), dispatch);
Severity: Major
Found in src/applications/vaos/covid-19-vaccine/flow.js and 1 other location - About 1 hr to fix
src/applications/vaos/new-appointment/redux/actions.js on lines 995..1001

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 63.

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

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

          <div className="vads-u-flex--1">
            <input
              className="usa-input"
              id="yr-search-name"
              name="yr-search-name"
src/applications/yellow-ribbon/containers/SearchForm/index.jsx on lines 191..200

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 63.

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

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

      <div data-testid="modal-content">
        <p>
          Your updated home address:
          <span className="vads-u-font-weight--bold vads-u-display--block vads-u-margin-y--1p5">
            <AddressView data={homeAddress} />
src/platform/forms/components/FormFooter.jsx on lines 11..17

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 63.

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

  render() {
    return (
      <div
        className={`hidden-header vads-u-display--flex vads-u-align-items--center${
          this.props.isHeaderV2 ? '' : ' vads-u-padding-top--1'
Severity: Minor
Found in src/platform/site-wide/user-nav/components/SearchHelpSignIn.jsx - About 1 hr to fix

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

      render() {
        const buttonClasses = classNames(
          this.props.cssClass,
          { 'va-btn-withicon': this.props.icon },
          'va-dropdown-trigger',

      Function replaceSchema has 34 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              replaceSchema: (formData, _schema, _uiSchema, index, path) => {
                const addressPath = getAddressPath(path); // path is ['address', 'currentField']
                cachedPath = addressPath;
                const data = get(addressPath, formData) ?? {};
                const { country } = data;

        Function constructor has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          constructor(props) {
            super(props);
        
            // Throw an error if there’s no viewComponent (should be React component)
            if (
        Severity: Minor
        Found in src/platform/forms-system/src/js/components/ReviewCardField.jsx - About 1 hr to fix

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

          export function fetchTotalDisabilityRating() {
            const {
              FETCH_TOTAL_RATING_STARTED,
              FETCH_TOTAL_RATING_FAILED,
              FETCH_TOTAL_RATING_SUCCEEDED,
          Severity: Minor
          Found in src/platform/user/profile/actions/hca.js - About 1 hr to fix

            Function mapStateToProps has 34 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const mapStateToProps = (state, ownProps) => {
              const supplies = state.form?.data?.supplies;
              const batterySupplies = supplies
                ?.filter(battery => battery.productGroup?.includes('Battery'))
                .filter(battery => moment().diff(battery.nextAvailabilityDate) >= 0);

              Function onSuccess has 34 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                const onSuccess = resp => {
                  const successfulSubmissions = resp.filter(response =>
                    response.status.toLowerCase().includes('processed'),
                  );
                  const failedSubmissions = resp.filter(
              Severity: Minor
              Found in src/applications/health-care-supply-reordering/config/form.js - About 1 hr to fix

                Function data has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  data: (state = initialState, action) => {
                    switch (action.type) {
                      case MEB_FETCH_CLAIM_STATUS:
                        return {
                          ...state,
                Severity: Minor
                Found in src/applications/education-letters/reducers/index.js - About 1 hr to fix

                  Function submit has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export function submit(form, formConfig) {
                    const headers = { 'Content-Type': 'application/json' };
                    const body = transform(formConfig, form);
                    const apiRequestOptions = {
                      method: 'POST',
                  Severity: Minor
                  Found in src/applications/edu-benefits/feedback-tool/helpers.js - About 1 hr to fix

                    Function applicantInformationField has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export const applicantInformationField = (automatedTest = false) => {
                      if (isProductionOfTestProdEnv(automatedTest)) {
                        return {
                          ...createApplicantInformationPage(fullSchema1995, {
                            isVeteran: true,
                    Severity: Minor
                    Found in src/applications/edu-benefits/1995/config/chapters.js - About 1 hr to fix

                      Function fileUploadUi has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export const fileUploadUi = content => {
                        // a11y focus management. Move focus to select after upload
                        // see va.gov-team/issues/19688
                        const addAnotherLabel = 'Upload another file';
                      
                      

                        Function checkFlags has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export function checkFlags(pages, person, newListOfMissingFiles) {
                          const personUpdated = person; // shallow, updates reflect on actual form state
                          const wrapped = Array.isArray(pages)
                            ? pages
                            : Object.keys(pages).map(pg => pages[pg]); // On confirmation, "pages" is obj

                          Function BehalfOfSomeoneElseContent has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          const BehalfOfSomeoneElseContent = () => {
                            return (
                              <>
                                <p>
                                  You’ll need a copy of their sponsor’s DD214 or other separation papers.
                            Severity
                            Category
                            Status
                            Source
                            Language