department-of-veterans-affairs/vets-website

View on GitHub

Showing 4,231 of 14,884 total issues

Function CareSummariesAndNotesListItem has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const CareSummariesAndNotesListItem = props => {
  const { record } = props;
  const isDischargeSummary = record.type === loincCodes.DISCHARGE_SUMMARY;

  const admDate = dischargeSummarySortFields.ADMISSION_DATE;

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

const getClaimUpdateDate = claim => {
  let updateDate;
  const filedDate = claim?.attributes.claimDate;
  const changeDate = claim?.attributes.claimPhaseDates?.phaseChangeDate;
  if (changeDate && filedDate) {

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

const Claim = ({ claim }) => {
  if (!claim.attributes) {
    throw new TypeError(
      '`claim` prop is malformed; it should have an `attributes` property.',
    );

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

export const findMatchingPhrAndCvixStudies = async (
  id,
  phrResponse,
  cvixResponse,
) => {
Severity: Minor
Found in src/applications/mhv-medical-records/util/radiologyUtil.js - About 25 mins 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 extractLocation has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export const extractLocation = vital => {
  if (isArrayAndHasItems(vital.performer)) {
    if (isArrayAndHasItems(vital.performer[0].extension)) {
      const refId = vital.performer[0].extension[0].valueReference?.reference;
      const location = extractContainedResource(vital, refId);
Severity: Minor
Found in src/applications/mhv-medical-records/reducers/vitals.js - About 25 mins 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 DebtsCard has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export const DebtsCard = ({ debts }) => {
  const debtHistory = debts.reduce(
    (acc, debt) => (debt.debtHistory ? acc.concat(debt.debtHistory) : acc),
    [],
  );

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 6 (exceeds 5 allowed). Consider refactoring.
Open

const CernerFacilityAlert = ({ linkPath, pageName }) => {
  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 convertAppointment has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export const convertAppointment = appt => {
  if (!appt) return null;

  const now = new Date();
  const { attributes } = appt;
Severity: Minor
Found in src/applications/mhv-medical-records/reducers/blueButton.js - About 25 mins 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 SearchResultsHeader has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export const SearchResultsHeader = props => {
  const { query, resultCount, inProgress } = props;

  const searchWasPerformed = !!query;

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

export const buildNonVAPrescriptionTXT = prescription => {
  return `
---------------------------------------------------------------------------------


Severity: Minor
Found in src/applications/mhv-medications/util/txtConfigs.js - About 25 mins 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 testableApiRequestWithRetry has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export const testableApiRequestWithRetry = (
  retryInterval,
  apiRequestFunc,
) => async (path, options, endTime) => {
  if (Date.now() >= endTime) {
Severity: Minor
Found in src/applications/mhv-medications/api/rxApi.js - About 25 mins 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

Severity
Category
Status
Source
Language