department-of-veterans-affairs/vets-website

View on GitHub

Showing 12,811 of 12,811 total issues

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

              <a
                href={`https://maps.google.com?saddr=${
                  query?.context?.location
                }&daddr=${address}`}
                tabIndex="0"
src/applications/representative-search/components/results/SearchResult.jsx on lines 199..218

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

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

        "zones": [
            "Africa/Abidjan|GMT|0|0||48e5",
            "Africa/Nairobi|EAT|-30|0||47e5",
            "Africa/Algiers|CET|-10|0||26e5",
            "Africa/Lagos|WAT|-10|0||17e6",
Severity: Major
Found in src/applications/vaos/lib/moment-tz.js and 1 other location - About 5 hrs to fix
src/applications/personalization/dashboard/lib/moment-tz.js on lines 678..823

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

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

                <a
                  href={`https://maps.google.com?saddr=${
                    query?.context?.location
                  }&daddr=${address}`}
                  tabIndex="0"
src/applications/representative-appoint/components/SearchResult.jsx on lines 125..144

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

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

    zones: [
      'Africa/Abidjan|GMT|0|0||48e5',
      'Africa/Nairobi|EAT|-30|0||47e5',
      'Africa/Algiers|CET|-10|0||26e5',
      'Africa/Lagos|WAT|-10|0||17e6',
Severity: Major
Found in src/applications/personalization/dashboard/lib/moment-tz.js and 1 other location - About 5 hrs to fix
src/applications/vaos/lib/moment-tz.js on lines 625..770

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

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

export const resolveParamsWithUrl = ({
  address,
  locationType,
  serviceType,
  page,
Severity: Minor
Found in src/applications/facility-locator/config.js - About 5 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 EvidencePrivateRecords has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
Open

const EvidencePrivateRecords = ({
  data,
  goBack,
  goForward,
  goToPath,
Severity: Minor
Found in src/applications/appeals/995/components/EvidencePrivateRecords.jsx - About 5 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 EvidenceVaRecords has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
Open

const EvidenceVaRecords = ({
  data,
  goBack,
  goForward,
  goToPath,
Severity: Minor
Found in src/applications/appeals/995/components/EvidenceVaRecords.jsx - About 5 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 EvidencePrivateRecords has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
Open

const EvidencePrivateRecords = ({
  data,
  goBack,
  goForward,
  goToPath,

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

export function ApplicantAddressCopyPage({
  contentBeforeButtons,
  contentAfterButtons,
  data,
  setFormData,

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

const DependentAges = ({
  contentBeforeButtons,
  contentAfterButtons,
  goForward,
  goToPath,

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

const ChangeOfAddressWrapper = ({ mailingAddress, applicantName }) => {
  const { loading: isLoading, error, data: response } = useSelector(
    state => state.updateAddress,
  );
  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

File index.js has 399 lines of code (exceeds 250 allowed). Consider refactoring.
Open

// Node modules.
import React from 'react';
import PropTypes from 'prop-types';
import { CONTACTS } from '@department-of-veterans-affairs/component-library/contacts';
// Relative imports.

    File IntroductionPage.jsx has 399 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import {
      VaAlert,
      VaButton,
      VaSearchInput,
    } from '@department-of-veterans-affairs/component-library/dist/react-bindings';
    Severity: Minor
    Found in src/applications/ask-va/containers/IntroductionPage.jsx - About 5 hrs to fix

      File helpers.jsx has 399 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      /* eslint-disable camelcase */
      import React from 'react';
      
      import EbenefitsLink from 'platform/site-wide/ebenefits/containers/EbenefitsLink';
      import { apiRequest as commonApiClient } from '@department-of-veterans-affairs/platform-utilities/api';
      Severity: Minor
      Found in src/applications/letters/utils/helpers.jsx - About 5 hrs to fix

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

          render() {
            const { supplies, order, eligibility } = this.props;
            const currentDate = moment();
            const accessorySupplies = supplies.filter(
              supply => supply.productGroup === ACCESSORY,

          Function UpcomingAppointmentsPage has 139 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const UpcomingAppointmentsPage = props => {
            const { router } = props;
            const [refresh, setRefresh] = useState(false);
            const selectApp = useMemo(makeSelectApp, []);
            const { app } = useSelector(selectApp);

            Function ThreadListItem has 139 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const ThreadListItem = props => {
              const location = useLocation();
              const { keyword, activeFolder } = props;
              const {
                senderName,

              Function DeleteDraft has 139 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const DeleteDraft = props => {
                const history = useHistory();
                const location = useLocation();
                const dispatch = useDispatch();
                const deleteDraftButtonRef = useRef();

                Function submitFilesLighthouse has 139 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export function submitFilesLighthouse(claimId, trackedItem, files) {
                  let filesComplete = 0;
                  let bytesComplete = 0;
                  let hasError = false;
                  const totalSize = files.reduce((sum, file) => sum + file.file.size, 0);
                Severity: Major
                Found in src/applications/claims-status/actions/index.js - About 5 hrs to fix

                  Function editPhoneNumberSuccess has 139 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export const editPhoneNumberSuccess = () => {
                    // store the phone number that's passed in via the POST or PUT call so we can
                    // return it with the GET user/ response
                    let newAreaCode;
                    let newPhoneNumber;
                  Severity: Major
                  Found in src/applications/personalization/profile/msw-mocks.js - About 5 hrs to fix
                    Severity
                    Category
                    Status
                    Source
                    Language