department-of-veterans-affairs/vets-website

View on GitHub

Showing 12,675 of 12,675 total issues

File display-conditions.js has 415 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { range } from 'lodash';
import { months } from 'platform/static-data/options-for-select';
import { RESPONSES } from './question-data-map';

const get15YearsPast = () => `${new Date().getFullYear() - 15}`;
Severity: Minor
Found in src/applications/discharge-wizard/constants/display-conditions.js - About 5 hrs to fix

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

      const updateCheckboxValue = (e, id) => {
        const { value, checked } = e.srcElement;
        const valueStore = checkboxValueStore[id];
        if (checked) {
          valueStore.push(value);
    Severity: Major
    Found in src/applications/ds-v3-playground/pages/V3BasePage.jsx and 1 other location - About 5 hrs to fix
    src/applications/ds-playground/pages/V1V3Page.jsx on lines 63..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 154.

    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

      getEmptyState(props) {
        const {
          onEdit,
          hideTitle,
          title,
    Severity: Major
    Found in src/platform/forms-system/src/js/components/SchemaForm.jsx and 1 other location - About 5 hrs to fix
    src/applications/_mock-form-ae-design-patterns/patterns/pattern1/TaskPurple/SchemaForm.jsx on lines 123..154

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

    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

      const updateCheckboxValue = (e, id) => {
        const { value, checked } = e.srcElement;
        const valueStore = checkboxValueStore[id];
        if (checked) {
          valueStore.push(value);
    Severity: Major
    Found in src/applications/ds-playground/pages/V1V3Page.jsx and 1 other location - About 5 hrs to fix
    src/applications/ds-v3-playground/pages/V3BasePage.jsx on lines 61..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 154.

    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

      const updatePrivacyAgreementValue = (e, id, agreementComponentId) => {
        const { checked } = e.srcElement;
        let valueString = `Agreement checked`;
        const el = document.querySelector(`#${agreementComponentId}`);
        if (el) {
    Severity: Major
    Found in src/applications/ds-v3-playground/pages/V3BasePage.jsx and 1 other location - About 5 hrs to fix
    src/applications/ds-playground/pages/V1V3Page.jsx on lines 80..94

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

    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

      const updatePrivacyAgreementValue = (e, id, agreementComponentId) => {
        const { checked } = e.srcElement;
        let valueString = `Agreement checked`;
        const el = document.querySelector(`#${agreementComponentId}`);
        if (el) {
    Severity: Major
    Found in src/applications/ds-playground/pages/V1V3Page.jsx and 1 other location - About 5 hrs to fix
    src/applications/ds-v3-playground/pages/V3BasePage.jsx on lines 78..92

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

    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

      getEmptyState(props) {
        const {
          onEdit,
          hideTitle,
          title,
    src/platform/forms-system/src/js/components/SchemaForm.jsx on lines 120..151

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

    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

          en: (
            <div>
              Have you had any of these symptoms in the past 48 hours?
              <ul>
                <li>Fever or chills</li>
    Severity: Major
    Found in src/applications/coronavirus-screener/config/questions.jsx and 1 other location - About 5 hrs to fix
    src/applications/coronavirus-screener/config/questions.jsx on lines 111..130

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

    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

    export function isValidRoutingNumber(value) {
      if (/^\d{9}$/.test(value)) {
        const digits = value.split('').map(val => parseInt(val, 10));
        const weighted =
          3 * (digits[0] + digits[3] + digits[6]) +
    Severity: Major
    Found in src/applications/edu-benefits/utils/helpers.jsx and 1 other location - About 5 hrs to fix
    src/platform/forms-system/src/js/utilities/validations/index.js on lines 131..142

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

    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

    export function isValidRoutingNumber(value) {
      if (/^\d{9}$/.test(value)) {
        const digits = value.split('').map(val => parseInt(val, 10));
        const weighted =
          3 * (digits[0] + digits[3] + digits[6]) +
    src/applications/edu-benefits/utils/helpers.jsx on lines 141..152

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

    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

          es: (
            <div>
              ¿Ha tenido alguno de estos síntomas en las últimas 48 horas?
              <ul>
                <li>Fiebre o escalofríos</li>
    Severity: Major
    Found in src/applications/coronavirus-screener/config/questions.jsx and 1 other location - About 5 hrs to fix
    src/applications/coronavirus-screener/config/questions.jsx on lines 91..110

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

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

      render() {
        const showUploadModal =
          this.props.uploading && this.state.canShowUploadModal;
    
        return (

      Function ChooseDateAndTime has 148 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export const ChooseDateAndTime = () => {
        const history = useHistory();
        const selectedDates = useSelector(state => getSelectedDate(state));
        const dispatch = useDispatch();
        const startMonth = format(startOfMonth(referral.preferredDate), 'yyyy-MM');
      Severity: Major
      Found in src/applications/vaos/referral-appointments/ChooseDateAndTime.jsx - About 5 hrs to fix

        Function EvidenceVaRecords has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
        Open

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

        export const addressUISchema = (
          isMilitaryBaseAddress = false,
          path,
          callback,
        ) => {
        Severity: Minor
        Found in src/applications/disability-benefits/2346/schemas/address-schema.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 DeleteDraft has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
        Open

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

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

        export function getCalendarData({ appointment, facility }) {
          let data = {};
          const isAtlas = appointment?.videoData.isAtlas;
          const isHome = isVideoHome(appointment);
          const videoKind = appointment?.videoData.kind;
        Severity: Minor
        Found in src/applications/vaos/services/appointment/index.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 LocationSearchResults has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
        Open

        function LocationSearchResults({
          search,
          filters,
          preview,
          dispatchUpdateEligibilityAndFilters,
        Severity: Minor
        Found in src/applications/gi/containers/search/LocationSearchResults.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 SchoolLocations has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
        Open

        export default function SchoolLocations({
          calculator,
          constants,
          eligibility,
          facilityMap,
        Severity: Minor
        Found in src/applications/gi/components/profile/SchoolLocations.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

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

        export const OtherNotification = ({ notification }) => {
          const createdAtFormatted = moment(notification.attributes.createdAt).format(
            'dddd, MMM DD, YYYY',
          );
        
        
        src/applications/personalization/common/components/DebtNotification.jsx on lines 6..33

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

        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