department-of-veterans-affairs/vets-website

View on GitHub

Showing 12,811 of 12,811 total issues

Function CustomResolutionOptionReview has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

const CustomResolutionOptionReview = props => {
  const formData = useSelector(state => state.form.data);
  const { selectedDebtsAndCopays = [] } = formData;

  const currentDebt = selectedDebtsAndCopays[props.pagePerItemIndex];

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

export function CautionaryInformation({ institution, showModal }) {
  const {
    complaints,
    schoolClosing,
    schoolClosingOn,
Severity: Minor
Found in src/applications/gi/components/profile/CautionaryInformation.jsx - About 3 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 getCalculatedBenefits has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

  (eligibility, institution, form, derived) => {
    const calculatedBenefits = {};

    if ([eligibility, institution, form, derived].some(e => !e || isEmpty(e))) {
      return calculatedBenefits;
Severity: Minor
Found in src/applications/gi/selectors/calculator.js - About 3 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 useNotificationSettingsUtils has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

export const useNotificationSettingsUtils = () => {
  const communicationPreferences = useSelector(
    state => state?.communicationPreferences,
  );

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

const NewRecordsIndicator = ({
  refreshState,
  extractType,
  newRecordsFound,
  reloadFunction,

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

  render() {
    const { route } = this.props;
    const { formConfig, pageList } = route;
    return (
      <article className="schemaform-intro">
Severity: Major
Found in src/applications/_mock-form/containers/IntroductionPage.jsx - About 3 hrs to fix

    Function Landing has 89 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const Landing = props => {
      const { router } = props;
      const { t } = useTranslation();
    
      const { jumpToPage } = useFormRouting(router);
    Severity: Major
    Found in src/applications/check-in/travel-claim/pages/landing/index.jsx - About 3 hrs to fix

      Function VaMedicalCenter has 89 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const VaMedicalCenter = props => {
        const { formContext, id, onChange, value, veteranFacilityState } = props;
        const { reviewMode, submitted } = formContext;
      
        const [facilities, setFacilities] = useState([]);
      Severity: Major
      Found in src/applications/caregivers/components/FormFields/VaMedicalCenter.jsx - About 3 hrs to fix

        Function ConfirmApprovedPage has 89 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export default function ConfirmApprovedPage() {
          const [confirmedData, setConfirmedData] = useState(0);
        
          // on react component mount, fetch data
          useEffect(() => {
        Severity: Major
        Found in src/applications/vaos/referral-appointments/ConfirmApprovedPage.jsx - About 3 hrs to fix

          Function getDerivedAttributes has 89 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export function getDerivedAttributes(constant, eligibility, institution) {
            const your = eligibility;
            const its = institution;
            const chapter = Number(your.giBillChapter);
            let monthlyRate;
          Severity: Major
          Found in src/applications/gi/selectors/estimator.js - About 3 hrs to fix

            Function content has 89 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              const content = () => {
                if (prescription || prescriptionsApiError) {
                  return (
                    <>
                      <div className="no-print">
            Severity: Major
            Found in src/applications/mhv-medications/containers/PrescriptionDetails.jsx - About 3 hrs to fix

              Function mockPrescription has 89 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function mockPrescription(n = 0, attrs = {}) {
                // Generate some refillable, some not
                const isRefillable = n % 3 === 0;
                const refillRemaining = isRefillable ? Math.ceil(Math.log(n + 1)) : 0;
                const {

                Identical blocks of code found in 3 locations. Consider refactoring.
                Open

                const DirectDepositDescription = () => {
                  const displayBankInfo = useCheckPath();
                
                  return (
                    <div className="vads-u-margin-top--2 vads-u-margin-bottom--2">
                src/applications/edu-benefits/10203/components/ShowDirectDepositDropdown.jsx on lines 52..81
                src/applications/edu-benefits/1990/components/ShowDirectDepositDropdown.jsx on lines 52..81

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

                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

                Identical blocks of code found in 3 locations. Consider refactoring.
                Open

                const DirectDepositDescription = () => {
                  const displayBankInfo = useCheckPath();
                
                  return (
                    <div className="vads-u-margin-top--2 vads-u-margin-bottom--2">
                src/applications/edu-benefits/10203/components/ShowDirectDepositDropdown.jsx on lines 52..81
                src/applications/edu-benefits/5490/components/ShowDirectDepositDropdown.jsx on lines 52..81

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

                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

                Identical blocks of code found in 3 locations. Consider refactoring.
                Open

                const DirectDepositDescription = () => {
                  const displayBankInfo = useCheckPath();
                
                  return (
                    <div className="vads-u-margin-top--2 vads-u-margin-bottom--2">
                src/applications/edu-benefits/1990/components/ShowDirectDepositDropdown.jsx on lines 52..81
                src/applications/edu-benefits/5490/components/ShowDirectDepositDropdown.jsx on lines 52..81

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

                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

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

                    withSuccessAndUpdate: ({
                      extraValidation = null,
                      appointments = null,
                      token = sharedData.get.defaultUUID,
                      demographicsNeedsUpdate = true,
                src/applications/check-in/api/local-mock-api/e2e/ApiInitializer.js on lines 268..314

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

                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

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

                    withSuccess: ({
                      extraValidation = null,
                      appointments = null,
                      token = sharedData.get.defaultUUID,
                      demographicsNeedsUpdate = true,
                src/applications/check-in/api/local-mock-api/e2e/ApiInitializer.js on lines 360..428

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

                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 3 locations. Consider refactoring.
                Open

                  const renderCountryFilter = () => {
                    const options = facets.country.map(facetCountry => ({
                      optionValue: facetCountry.name,
                      optionLabel: facetCountry.name,
                    }));
                Severity: Major
                Found in src/applications/gi/containers/FilterYourResults.jsx and 2 other locations - About 3 hrs to fix
                src/applications/gi/containers/search/FilterBeforeResults.jsx on lines 733..750
                src/applications/gi/containers/search/FilterByLocation.jsx on lines 57..74

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

                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 3 locations. Consider refactoring.
                Open

                  const renderCountryFilter = () => {
                    const options = facets.country.map(facetCountry => ({
                      optionValue: facetCountry.name,
                      optionLabel: facetCountry.name,
                    }));
                Severity: Major
                Found in src/applications/gi/containers/search/FilterByLocation.jsx and 2 other locations - About 3 hrs to fix
                src/applications/gi/containers/FilterYourResults.jsx on lines 381..398
                src/applications/gi/containers/search/FilterBeforeResults.jsx on lines 733..750

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

                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 3 locations. Consider refactoring.
                Open

                  const renderCountryFilter = () => {
                    const options = facets.country.map(facetCountry => ({
                      optionValue: facetCountry.name,
                      optionLabel: facetCountry.name,
                    }));
                src/applications/gi/containers/FilterYourResults.jsx on lines 381..398
                src/applications/gi/containers/search/FilterByLocation.jsx on lines 57..74

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

                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

                Severity
                Category
                Status
                Source
                Language