department-of-veterans-affairs/vets-website

View on GitHub

Showing 4,231 of 14,884 total issues

Function vaccineReducer has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

export const vaccineReducer = (state = initialState, action) => {
  switch (action.type) {
    case Actions.Vaccines.GET: {
      const vaccine = action.response;
      return {
Severity: Minor
Found in src/applications/mhv-medical-records/reducers/vaccines.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 BenefitPaymentsAndDebt has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

const BenefitPaymentsAndDebt = ({
  debts,
  copays,
  hasDebtError,
  hasCopayError,

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

const AllergyDetails = props => {
  const { runningUnitTest } = props;
  const dispatch = useDispatch();
  const allergy = useSelector(state => state.mr.allergies.allergyDetails);
  const allergyList = useSelector(state => state.mr.allergies.allergiesList);
Severity: Minor
Found in src/applications/mhv-medical-records/containers/AllergyDetails.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 genAndDownloadCCD has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

export const genAndDownloadCCD = (firstName, lastName) => async dispatch => {
  dispatch({ type: Actions.Downloads.GENERATE_CCD });
  try {
    // GET LIST OF CCDs
    const generate = await generateCCD();
Severity: Minor
Found in src/applications/mhv-medical-records/actions/downloads.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 ResultsCounter has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

const ResultsCounter = ({
  currentPage,
  loading,
  perPage,
  query,
Severity: Minor
Found in src/applications/search/components/ResultsCounter.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 conditionReducer has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

export const conditionReducer = (state = initialState, action) => {
  switch (action.type) {
    case Actions.Conditions.GET: {
      return {
        ...state,
Severity: Minor
Found in src/applications/mhv-medical-records/reducers/conditions.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 prescriptionsReducer has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

export const prescriptionsReducer = (state = initialState, action) => {
  switch (action.type) {
    case Actions.Prescriptions.SET_DETAILS:
    case Actions.Prescriptions.GET_DETAILS: {
      return {
Severity: Minor
Found in src/applications/mhv-medications/reducers/prescriptions.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 fillAvailableFields has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      const fillAvailableFields = () => {
        getFieldSelectors().then(fieldSelector => {
          cy.get(APP_SELECTOR, NO_LOG_OPTION)
            .then($form => {
              // Get the starting number of array items and fields to compare
Severity: Minor
Found in src/platform/testing/e2e/cypress/support/form-tester/index.js - About 1 hr to fix

    Function buildAddressArray has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export const buildAddressArray = (location, titleCaseText = false) => {
      if (location && location.type === 'provider') {
        const { address } = location.attributes;
    
        if (!isEmpty(address)) {
    Severity: Minor
    Found in src/platform/utilities/facilities-and-mapbox/index.js - About 1 hr to fix

      Function sendDraft has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const sendDraft = (req, res) => {
        const { body, category, recipientId, subject } = req.body;
      
        return res.json({
          data: {
      Severity: Minor
      Found in src/platform/mhv/api/mocks/secure-messaging/drafts/index.js - About 1 hr to fix

        Function startReactApp has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export default function startReactApp(
          component,
          root = document.getElementById('react-root'),
        ) {
          // Detect if this is a child frame. If yes, initialize the react devtools hook to work around
        Severity: Minor
        Found in src/platform/startup/react.js - About 1 hr to fix

          Function yesNoUI has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export const yesNoUI = options => {
            const {
              title,
              tile,
              labels,

            Function fetchTypeaheadSuggestions has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export const fetchTypeaheadSuggestions = async inputValue => {
              // encode user input for query to suggestions url
              const encodedInput = encodeURIComponent(inputValue);
            
              // fetch suggestions
            Severity: Minor
            Found in src/platform/utilities/search-utilities.js - About 1 hr to fix

              Function commonFieldMapping has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export default function commonFieldMapping(props) {
                const { label, required, error, uiOptions, childrenProps } = props;
              
                const labelHeaderLevelStyle = uiOptions?.labelHeaderLevelStyle;
                const headerStyle = labelHeaderLevelStyle

                Function addressValidationSuccessSingleLowConfidenceSuggestion has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  addressValidationSuccessSingleLowConfidenceSuggestion() {
                    return asyncReturn(
                      {
                        addresses: [
                          {
                Severity: Minor
                Found in src/platform/user/profile/vap-svc/util/local-vapsvc.js - About 1 hr to fix

                  Function removeHiddenData has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export function removeHiddenData(schema, data) {
                    // null is necessary here because Rails 4 will convert empty arrays to null
                    // In the forms, there's no difference between an empty array and null or undefined
                    if (isHiddenField(schema) || typeof data === 'undefined' || data === null) {
                      return undefined;
                  Severity: Minor
                  Found in src/platform/forms-system/src/js/state/helpers.js - About 1 hr to fix

                    Function SSNWidget has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export default function SSNWidget(props) {
                      const [val, setVal] = useState(props.value);
                      const [displayVal, setDisplayVal] = useState(props.value);
                    
                      const handleChange = value => {
                    Severity: Minor
                    Found in src/platform/forms-system/src/js/widgets/SSNWidget.jsx - About 1 hr to fix

                      Function readAndCheckFile has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export default function readAndCheckFile(file, checks) {
                        return new Promise((resolve, reject) => {
                          // Don't load file if there's nothing to check
                          if (Object.keys(checks).length === 0) {
                            resolve({});
                      Severity: Minor
                      Found in src/platform/forms-system/src/js/utilities/file/readAndCheckFile.js - About 1 hr to fix

                        Function captureError has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        const captureError = (error, details) => {
                          if (environment.isLocalhost()) {
                            // eslint-disable-next-line no-console
                            console.error({ error, details });
                          }
                        Severity: Minor
                        Found in src/platform/user/profile/vap-svc/util/analytics.js - About 1 hr to fix

                          Function addressValidationSuccessSingleConfirmedSuggestion has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            addressValidationSuccessSingleConfirmedSuggestion() {
                              return asyncReturn(
                                {
                                  addresses: [
                                    {
                          Severity: Minor
                          Found in src/platform/user/profile/vap-svc/util/local-vapsvc.js - About 1 hr to fix
                            Severity
                            Category
                            Status
                            Source
                            Language