department-of-veterans-affairs/vets-website

View on GitHub

Showing 4,231 of 14,884 total issues

Function getInput has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

function getInput(input, uiSchema, schema) {
  if (input && input.widget === 'autosuggest') {
    return input.label;
  }

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

const BenefitsForm = ({
  children,
  cumulativeService,
  eligForPostGiBill,
  eligibilityChange,
Severity: Minor
Found in src/applications/gi/components/profile/BenefitsForm.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 RadioWidget has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

export default function RadioWidget(props) {
  const { options, formContext = {}, value, disabled, onChange, id } = props;
  const { enumOptions, labels = {} } = options;

  const onReviewPage = formContext?.onReviewPage || false;

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

export const getBlueButtonReportData = (
  options = {},
  dateFilter,
) => async dispatch => {
  const fetchMap = {
Severity: Minor
Found in src/applications/mhv-medical-records/actions/blueButtonReport.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 extractObservedReported has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

export const extractObservedReported = allergy => {
  if (allergy && isArrayAndHasItems(allergy.extension)) {
    const extItem = allergy.extension.find(
      item => item.url && item.url.includes('allergyObservedHistoric'),
    );
Severity: Minor
Found in src/applications/mhv-medical-records/reducers/allergies.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 CernerFacilityAlert has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

const CernerFacilityAlert = ({ className = '' }) => {
  const ehrDataByVhaId = useSelector(
    state => state.drupalStaticData?.vamcEhrData?.data?.ehrDataByVhaId,
  );
  const userFacilities = useSelector(state => state?.user?.profile?.facilities);

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

export const extractObservedReported = allergy => {
  if (allergy && isArrayAndHasItems(allergy.extension)) {
    const extItem = allergy.extension.find(
      item => item.url && item.url.includes('allergyObservedHistoric'),
    );
Severity: Minor
Found in src/applications/mhv-medications/reducers/allergies.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 formatMenuItems has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const formatMenuItems = menuItems => {
  const formattedMenuItems = [];

  if (menuItems && isArray(menuItems)) {
    return menuItems;
Severity: Minor
Found in src/platform/site-wide/header/helpers/index.js - About 1 hr to fix

    Function textUI has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export const textUI = stringOrOptions => {
      if (typeof stringOrOptions === 'string') {
        return {
          'ui:title': stringOrOptions,
          'ui:webComponentField': VaTextInputField,

      Function textareaUI has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export const textareaUI = stringOrOptions => {
        if (typeof stringOrOptions === 'string') {
          return {
            'ui:title': stringOrOptions,
            'ui:webComponentField': VaTextareaField,

        Function querySelectorWithShadowRoot has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export async function querySelectorWithShadowRoot(selector, root) {
          try {
            let selectorElement;
            const rootElement =
              typeof root === 'string'
        Severity: Minor
        Found in src/platform/utilities/ui/webComponents.js - About 1 hr to fix

          Function ArnField has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export default function ArnField(fieldProps) {
            const props = vaTextInputFieldMapping(fieldProps);
          
            const [val, setVal] = useState(props.value);
            const [displayVal, setDisplayVal] = useState(props.value);
          Severity: Minor
          Found in src/platform/forms-system/src/js/web-component-fields/ArnField.jsx - About 1 hr to fix

            Function formsPatternFieldMapping has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export default function formsPatternFieldMapping(props) {
              const { uiOptions = {} } = props;
              const {
                useFormsPattern,
                formHeading,

              Function mapStateToProps has 31 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const mapStateToProps = (state, ownProps) => {
                const { transaction } = ownProps;
                const {
                  addressFromUser,
                  addressValidationError,

                Function createMilitaryClaimant has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export function createMilitaryClaimant(submissionForm) {
                  // Access formField and viewComponent sources for userFullName and dateOfBirth
                  const formFieldUserFullName =
                    submissionForm['view:userFullName']?.userFullName;
                  const viewComponentUserFullName = submissionForm?.userFullName;

                  Function profileReducer has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function profileReducer(state = getNullProfileState(), action) {
                    switch (action.type) {
                      case FETCH_USER:
                        return {
                          ...state,
                  Severity: Minor
                  Found in src/applications/accreditation/21a/reducers/user.js - About 1 hr to fix

                    Function mainTransform has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      const mainTransform = formData => {
                        const informalConference = formData.informalConference !== 'no';
                        const attributes = {
                          // This value may empty if the user restarts the form; see
                          // va.gov-team/issues/13814
                    Severity: Minor
                    Found in src/applications/appeals/testing/hlr/config/submit-transformer.js - About 1 hr to fix

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

                      export function prefillTransformer(pages, formData, metadata, state) {
                        const { homePhone, mobilePhone, email, remainingEntitlement } = formData;
                        const { edipi, icn } = state.user.profile;
                      
                        const totalDays = remainingEntitlement
                      Severity: Minor
                      Found in src/applications/edu-benefits/10203/prefill-transformer.js - About 1 hr to fix

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

                          render() {
                            captureEvents.ineligibilityAlert(this.props);
                            return (
                              <div>
                                {this.renderHeader()}

                          Function FinancialStatusConfirmation has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          const FinancialStatusConfirmation = props => {
                            const {
                              goBack,
                              goForward,
                              contentBeforeButtons,
                            Severity
                            Category
                            Status
                            Source
                            Language