department-of-veterans-affairs/vets-website

View on GitHub

Showing 3,736 of 12,814 total issues

Function AddAsset has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

const AddAsset = ({ data, goToPath, setFormData }) => {
  const { assets } = data;
  const { otherAssets = [] } = assets;

  // Borrowed from 995 AddIssue

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

const DependentCount = ({
  data,
  goBack,
  goToPath,
  setFormData,

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

function VAFacilityPage({
  address,
  canScheduleAtChosenFacility,
  facilitiesStatus,
  initialData,

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

export function selectModalityText(appointment, isPendingAppointment = false) {
  const isCommunityCare = selectIsCommunityCare(appointment);
  const isInPerson = selectIsInPerson(appointment);
  const isPhone = selectIsPhone(appointment);
  const isVideoAtlas = selectIsAtlasVideo(appointment);
Severity: Minor
Found in src/applications/vaos/appointment-list/redux/selectors.js - About 2 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 selectAppointmentLocality has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

export function selectAppointmentLocality(
  appointment,
  isPendingAppointment = false,
) {
  const practitioner = selectPractitionerName(appointment);
Severity: Minor
Found in src/applications/vaos/appointment-list/redux/selectors.js - About 2 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 getEligibilityMessage has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

export default function getEligibilityMessage({
  typeOfCare,
  eligibility,
  facilityDetails,
  includeFacilityContactInfo = 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 SearchPage has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

export function SearchPage({
  dispatchChangeSearchTab,
  search,
  preview,
  filters,
Severity: Minor
Found in src/applications/gi/containers/SearchPage.jsx - About 2 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 CompareDrawer has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

export function CompareDrawer({
  compare,
  dispatchRemoveCompareInstitution,
  displayed,
  alwaysDisplay = false,
Severity: Minor
Found in src/applications/gi/containers/CompareDrawer.jsx - About 2 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 App has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

const App = ({ children }) => {
  const user = useSelector(selectUser);
  const userServices = user.profile.services;
  const hasMhvAccount = user.profile.mhvAccountState !== 'NONE';

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

export const careSummariesAndNotesReducer = (state = initialState, action) => {
  switch (action.type) {
    case Actions.CareSummariesAndNotes.GET: {
      return {
        ...state,

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

const AllergiesPrintOnly = props => {
  const { allergies } = props;

  const content = () => {
    return (

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

  render() {
    const { renderChildItems } = this;
    const { navItemsLookup } = this.props;

    // Derive the parent-most nav item. This is O(n), which isn't great but I'm assuming there won't be 1000s of side nav items.
Severity: Major
Found in src/platform/site-wide/side-nav/components/SideNav.js - About 2 hrs to fix

    Function renderVerifiedContent has 52 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      const renderVerifiedContent = () => {
        if (shouldVerify()) {
          return (
            <va-loading-indicator set-focus message="Redirecting to verify..." />
          );
    Severity: Major
    Found in src/platform/user/authorization/components/RequiredLoginView.jsx - About 2 hrs to fix

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

      const mapStateToProps = state => {
        const { featureToggles } = state;
        const selectedAddress = state.form?.data['view:currentAddress'];
        const shippingAddress = state.form?.data[selectedAddress];
        const { fullName, vetEmail, order, supplies } = state.form?.data;

        Function submitForm has 52 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const submitForm = (form, formConfig) => {
          const body = formConfig.transformForSubmit(formConfig, form);
        
          const formData = form.data;
          const uiSchema = formConfig.chapters.chapter1.pages.page1.uiSchema;
        Severity: Major
        Found in src/applications/coronavirus-research/sign-up/config/submitForm.js - About 2 hrs to fix

          Function EnrollmentVerificationBreadcrumbs has 52 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export default function EnrollmentVerificationBreadcrumbs() {
            const breadcrumbsArray = [
              {
                href: '/',
                label: 'Home',

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

              render() {
                const {
                  setReferredBenefit,
                  setWizardStatus,
                  expander,
            Severity: Major
            Found in src/applications/static-pages/wizard/index.js - About 2 hrs to fix

              Function createRoutesWithStore has 52 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const createRoutesWithStore = () => {
                return (
                  <Switch>
                    {routes.map((route, i) => {
                      const options = { appName: APP_NAMES.PRE_CHECK_IN };
              Severity: Major
              Found in src/applications/check-in/pre-check-in/routes.jsx - About 2 hrs to fix

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

                const mapStateToProps = state => {
                  const { featureToggles } = state;
                  const selectedAddress = state.form?.data['view:currentAddress'];
                  const shippingAddress = state.form?.data[selectedAddress];
                  const { fullName, vetEmail, order, supplies } = state.form?.data;

                  Function updateSchema has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                        updateSchema: (formData, formSchema) => {
                          const updatedCategoryTopicContactPreferences = getContactMethods(
                            formData.category,
                            formData.topic,
                          );
                    Severity
                    Category
                    Status
                    Source
                    Language