department-of-veterans-affairs/vets-website

View on GitHub

Showing 4,231 of 14,884 total issues

Function Vitals has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

const Vitals = () => {
  const dispatch = useDispatch();
  const history = useHistory();
  const location = useLocation();

Severity: Minor
Found in src/applications/mhv-medical-records/containers/Vitals.jsx - About 1 hr 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 generateSelfEnteredData has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

export const generateSelfEnteredData = ({
  activityJournal,
  allergies,
  demographics,
  familyHistory,
Severity: Minor
Found in src/applications/mhv-medical-records/util/pdfHelpers/sei/index.js - About 1 hr 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 Decision has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

const Decision = ({ issues, aoj, ama = true, boardDecision = false }) => {
  const allowedIssues = issues
    .filter(issue => issue.disposition === 'allowed')
    .map((issue, i) => <li key={`allowed-${i}`}>{issue.description}</li>);
  const deniedIssues = issues

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

const generateResultsContent = async (doc, parent, data, config) => {
  const results = doc.struct('Sect', {
    title: 'Results',
  });
  parent.add(results);
Severity: Minor
Found in src/platform/pdf/templates/medical_records.js - About 1 hr to fix

    Function createDetailItem has 43 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const createDetailItem = async (doc, config, x, item) => {
      const paragraphOptions = { lineGap: item.lineGap ?? 6 };
      let titleText = item.title ?? '';
      const content = [];
      const monospaceFont = config.text.monospaceFont || config.text.font;
    Severity: Minor
    Found in src/platform/pdf/templates/utils.js - About 1 hr to fix

      Function summaryPage has 43 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        pageBuilder.summaryPage = pageConfig => {
          let requiredOpts = ['title', 'path'];
          if (usesYesNo) {
            requiredOpts = requiredOpts.concat(['uiSchema', 'schema']);
          }

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

          render() {
            const alertContent = (
              <div>
                <p>
                  This will remove your {toLower(this.props.title)} across many VA

          Function createComments has 43 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export function createComments(submissionForm) {
            const serviceHistoryIncorrect =
              submissionForm['view:serviceHistory']?.serviceHistoryIncorrect;
          
            if (serviceHistoryIncorrect) {

            Function NeedHelp has 43 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export default function NeedHelp() {
              const isIntro = window.location.pathname.endsWith('/introduction');
              return isIntro ? (
                <>
                  <p>
            Severity: Minor
            Found in src/applications/appeals/testing/hlr/content/NeedHelp.jsx - About 1 hr to fix

              Function board has 43 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export const board = (formValues, noDRB) => {
                if (!formValues) return null;
              
                const prevAppType =
                  ['1', '4'].indexOf(formValues['10_prevApplicationType']) > -1;
              Severity: Minor
              Found in src/applications/discharge-wizard/helpers/index.jsx - About 1 hr to fix

                Function BenefitsSelection has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export default function BenefitsSelection(props) {
                  const state = useFormikContext();
                
                  return (
                    <>
                Severity: Minor
                Found in src/applications/burial-poc-v6/pages/BenefitsSelection.jsx - About 1 hr to fix

                  Function schema has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export function schema(currentSchema, userOptions) {
                    const options = {
                      fields: ['serviceBranch', 'dateRange'],
                      required: [],
                      ...userOptions,
                  Severity: Minor
                  Found in src/applications/edu-benefits/definitions/toursOfDuty.jsx - About 1 hr to fix

                    Function createOldSchoolPage has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export default function createOldSchoolPage(schema) {
                      const { trainingEndDate, reasonForChange } = schema.properties;
                      const { school, date } = schema.definitions;
                      return {
                        path: 'school-selection/old-school',
                    Severity: Minor
                    Found in src/applications/edu-benefits/pages/oldSchool.js - About 1 hr to fix

                      Function onDownloadLinkClick has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export async function onDownloadLinkClick(event, reduxStore) {
                        // This function purpose is to determine if the PDF is valid on click.
                        // Once it's done, it passes information to DownloadHandler() which determines what to render.
                        event.preventDefault();
                      
                      

                        Function CollapsibleList has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        const CollapsibleList = () => {
                          return (
                            <div id="SupportingFiles-collapsiblePanel">
                              <div className="input-section">
                                <div

                          Function onUpdateClicked has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            const onUpdateClicked = async () => {
                              const addressState = {
                                ...stateAndZip,
                                state: stateAndZip.stateCode,
                              };

                            Function WarningStatus has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            const WarningStatus = () => {
                              const {
                                statusCode,
                                applicationDate,
                                enrollmentDate,

                              Function IdentityVerificationForm has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              const IdentityVerificationForm = props => {
                                const { data, onLogin, onChange, onSubmit } = props;
                                const {
                                  vesRecordFound,
                                  hasServerError,
                              Severity: Minor
                              Found in src/applications/hca/components/IdentityPage/VerificationForm.jsx - About 1 hr to fix

                                Function confirmationPageNextStepsParagraph has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                export const confirmationPageNextStepsParagraph = formData => {
                                  if (
                                    hasActiveCompensationITF({ formData }) &&
                                    hasActivePensionITF({ formData })
                                  ) {
                                Severity: Minor
                                Found in src/applications/simple-forms/21-0966/config/helpers.js - About 1 hr to fix

                                  Function prefillTransformer has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  const prefillTransformer = (pages, formData, metadata, state) => {
                                    const { veteran = {} } = formData;
                                    const {
                                      fullName,
                                      ssn,
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language