department-of-veterans-affairs/vets-website

View on GitHub

Showing 12,918 of 12,918 total issues

Function DowntimeMessage has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

export default function DowntimeMessage({
  startTime,
  endTime,
  status,
  children,
Severity: Minor
Found in src/applications/vaos/components/VAOSApp/DowntimeMessage.jsx - About 55 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 render has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  render() {
    const {
      appealsLoading,
      claimsLoading,
      list,
Severity: Minor
Found in src/applications/claims-status/containers/YourClaimsPageV2.jsx - About 55 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 generateClaimTitle has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

export const generateClaimTitle = (claim, placement, tab) => {
  // This will default to 'disability compensation'
  const claimType = getClaimType(claim).toLowerCase();
  const isRequestToAddOrRemoveDependent = addOrRemoveDependentClaimTypeCodes.includes(
    claim?.attributes?.claimTypeCode,
Severity: Minor
Found in src/applications/claims-status/utils/helpers.js - About 55 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 AppealListItem has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

export default function AppealListItem({ appeal, name }) {
  let requestEventType;
  let isAppeal;

  switch (appeal.type) {
Severity: Minor
Found in src/applications/claims-status/components/appeals-v2/AppealListItem.jsx - About 55 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 locationInfo has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

export const locationInfo = (city, state, country) => {
  let address = '';
  if (isCountryUSA(country)) {
    if (city && state) {
      address = `${city}, ${state}`;
Severity: Minor
Found in src/applications/gi/utils/helpers.js - About 55 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 ConnectedDevicesSection has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

export const ConnectedDevicesSection = ({
  connectedDevices,
  successAlert,
  failureAlert,
  disconnectSuccessAlert,

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

function calculateHousing(constant, eligibility, institution, derived) {
  if (derived.chapter === 31 && derived.isFlightOrCorrespondence) {
    return {
      qualifier: 'per month',
      ratedQualifier: ' / month',
Severity: Minor
Found in src/applications/gi/selectors/estimator.js - About 55 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 CopyAddressModal has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

const CopyAddressModal = props => {
  const {
    mailingAddress = null,
    homeAddress,
    transaction,

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

export const getLatestCopay = statements => {
  if (!statements) return null;
  return statements.reduce((acc, currentCopay) => {
    if (currentCopay.pSStatementDateOutput) {
      if (!acc) {
Severity: Minor
Found in src/applications/personalization/dashboard/helpers.jsx - About 55 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 mockGetRefreshStatus has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

export const mockGetRefreshStatus = () => {
  switch (scenario) {
    case 1: {
      return mockStatusResponse(0, 80, 70, 70); // STALE
    }
Severity: Minor
Found in src/applications/mhv-medical-records/util/testHelper.js - About 55 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 RadiologySingleImage has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

const RadiologySingleImage = () => {
  const dispatch = useDispatch();
  const { labId, imageId } = useParams();
  // const labAndTestDetails = useSelector(
  //   state => state.mr.labsAndTests.labsAndTestsDetails,
Severity: Minor
Found in src/applications/mhv-medical-records/containers/RadiologySingleImage.jsx - About 55 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 dateFormatWithoutTimezone has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

export const dateFormatWithoutTimezone = datetime => {
  let withoutTimezone = datetime;
  if (typeof datetime === 'string' && datetime.includes('-')) {
    // Check if datetime has a timezone and strip it off if present
    if (datetime.includes('T')) {
Severity: Minor
Found in src/applications/mhv-medical-records/util/helpers.js - About 55 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 getOrgName has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

export const getOrgName = formData => {
  if (isOrg(formData)) {
    return formData['view:selectedRepresentative'].name;
  }

Severity: Minor
Found in src/applications/representative-appoint/utilities/helpers.js - About 55 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 PrescriptionDetailsDocumentation has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

const PrescriptionDetailsDocumentation = () => {
  const { prescriptionId } = useParams();
  const { search } = useLocation();
  const queryParams = new URLSearchParams(search);
  const ndcNumber = queryParams.get('ndc');

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

function VeteranDetails({ profile }) {
  const { veteranSocialSecurityNumber, vaFileNumber, dob, gender } = profile;
  const { first, middle, last, suffix } = profile.userFullName;
  const mask = srSubstitute('●●●–●●–', 'ending with');

Severity: Minor
Found in src/applications/representative-appoint/components/VeteranDetails.jsx - About 55 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 CurrentAccreditedRepresentative has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

const CurrentAccreditedRepresentative = ({
  representativeName,
  type,
  addressLine1,
  addressLine2,

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

const SearchResult = ({
  representativeName,
  addressLine1,
  addressLine2,
  addressLine3,
Severity: Minor
Found in src/applications/representative-appoint/components/SearchResult.jsx - About 55 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 render has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  render() {
    const {
      activeIndex,
      isOpen,
      inputValue,

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

export const buildMedicationInformationPDF = list => {
  const listOfHeaders = ['h2', 'h3'];
  const sections = [
    ...list
      .filter(listItem => listOfHeaders.includes(listItem.type))
Severity: Minor
Found in src/applications/mhv-medications/util/pdfConfigs.js - About 55 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

Similar blocks of code found in 14 locations. Consider refactoring.
Open

const SuggestedAddress = ({
  formData,
  address,
  handleAddNewClick,
  setAddressToUI,
src/applications/appeals/996/containers/Form0996App.jsx on lines 36..195
src/applications/find-forms/containers/SearchResults.jsx on lines 43..264
src/applications/gi/components/profile/InstitutionProfile.jsx on lines 29..287
src/applications/gi/containers/FilterYourResults.jsx on lines 71..531
src/applications/income-limits/containers/ReviewPage.jsx on lines 17..184
src/applications/ivc-champva/shared/components/fileUploads/MissingFileList.jsx on lines 118..182
src/applications/my-education-benefits/components/HowToApplyPost911GiBillV2.jsx on lines 11..70
src/applications/personalization/profile/components/direct-deposit/vye/components/SuggestedAddress.jsx on lines 19..186
src/applications/personalization/profile/components/notification-settings/NotificationCheckbox.jsx on lines 7..116
src/applications/representative-appoint/components/CurrentAccreditedRepresentative.jsx on lines 5..124
src/applications/representative-search/components/results/ReportModal.jsx on lines 10..184
src/platform/forms-system/src/js/components/FormSignature.jsx on lines 31..140
src/platform/forms-system/src/js/patterns/array-builder/ArrayBuilderCancelButton.jsx on lines 36..150

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 53.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Severity
Category
Status
Source
Language