department-of-veterans-affairs/vets-website

View on GitHub

Showing 4,177 of 14,709 total issues

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

  const onAddFile = async (event, index = null, password) => {
    if (event.target?.files?.length) {
      const currentFile = event.target.files[0];
      const allFiles = props.formData || [];
      const addUiOptions = props.uiSchema['ui:options'];
Severity: Major
Found in src/applications/simple-forms/40-0247/components/FileField.jsx - About 3 hrs to fix

    Function CreateFolderModal has 90 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const CreateFolderModal = props => {
      const {
        isCreateNewModalVisible,
        setIsCreateNewModalVisible,
        onConfirm,

      Function ContactInformation has 90 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const ContactInformation = () => {
        const lastLocation = useLastLocation();
      
        const hasUnsavedEdits = useSelector(
          state => state.vapService.hasUnsavedEdits,

        Function pdfTransform has 90 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export function pdfTransform(formData) {
          const {
            veteranFullName,
            veteranSocialSecurityNumber: ssn,
            vaFileNumber,
        Severity: Major
        Found in src/applications/representative-appoint/utilities/pdfTransform.js - About 3 hrs to fix

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

          export const Search = ({ onSearch }) => {
            const queryParams = new URLSearchParams(window.location.search);
          
            const defaultSelectedOption = deriveDefaultSelectedOption();
          
          
          Severity: Minor
          Found in src/applications/static-pages/events/components/Search/index.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 AppointmentDetails has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
          Open

          const AppointmentDetails = props => {
            const { router } = props;
            const { t } = useTranslation();
            const dispatch = useDispatch();
            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

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

          export const isLocationOfResidenceRequired = data => {
            const {
              contactPreference,
              relationshipToVeteran,
              selectCategory,
          Severity: Minor
          Found in src/applications/ask-va/config/helpers.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 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 EnhancedVehicleRecord has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
          Open

          const EnhancedVehicleRecord = ({ data, goToPath, setFormData }) => {
            const { assets } = data;
            const { automobiles = [] } = assets;
          
            const searchIndex = new URLSearchParams(window.location.search);

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

            render() {
              const {
                onSubmit,
                props: {
                  analyticsSectionName,

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

            export const ConfirmationPage = props => {
              const form = useSelector(state => state.form || {});
              const { submission } = form;
              const submitDate = submission?.timestamp;
              const confirmationNumber = submission?.response?.confirmationNumber;
            Severity: Major
            Found in src/applications/edu-benefits/10216/containers/ConfirmationPage.jsx - About 3 hrs to fix

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

                  const SubTopicSelectPage = props => {
                    const { onChange, loggedIn, goBack, formData, topicID, goForward } = props;
                    const dispatch = useDispatch();
                  
                    const [apiData, setApiData] = useState([]);
                  Severity: Major
                  Found in src/applications/ask-va/containers/SubTopicSelectPage.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 ThreadListSort has 89 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      const ThreadListSort = props => {
                        const { sortOrder, sortCallback } = props;
                        const location = useLocation();
                        const [sortOrderValue, setSortOrderValue] = useState(sortOrder);
                      
                      

                        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
                          Severity
                          Category
                          Status
                          Source
                          Language