department-of-veterans-affairs/vets-website

View on GitHub

Showing 12,844 of 12,844 total issues

Function mapBenefitFromFormInputData has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

const mapBenefitFromFormInputData = (benefit, formData) => {
  if (checkExtraConditions(benefit, formData) === false) return false;

  const mappingKeys = Object.keys(mappingTypes);
  // Each mapping type (i.e. GOALS).

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

export const SearchResults = ({
  error,
  fetching,
  page,
  query,
Severity: Minor
Found in src/applications/find-forms/containers/SearchResults.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 deriveEventLocations has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

export const deriveEventLocations = event => {
  const locations = [];

  if (!event) {
    return locations;
Severity: Minor
Found in src/applications/static-pages/events/helpers/index.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 NearByVetCenters has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

const NearByVetCenters = props => {
  const [originalCoordinates, setOriginalCoordinates] = useState([]);
  const [fetchedVetCenters, setFetchedVetCenters] = useState([]);
  const [nearbyVetCenterDistances, setNearbyVetCenterDistances] = useState(
    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 UpcomingAppointmentsListItem has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

const UpcomingAppointmentsListItem = props => {
  const { app, appointment, goToDetails, router, border, count } = props;
  const { t } = useTranslation();
  const { getCurrentPageFromRouter } = useFormRouting(router);
  const page = getCurrentPageFromRouter();

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

export function prefillTransformer(pages, formData, metadata, state) {
  const bankInformation = state.data?.bankInformation || {};
  const claimant = state.data?.formData?.data?.attributes?.claimant || {};
  const contactInfo = claimant?.contactInfo || {};
  const stateUser = state.user;

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

const createMockSuccessResponse = (
  token,
  demographicsNeedsUpdate = false,
  demographicsConfirmedAt = null,
  nextOfKinNeedsUpdate = 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 SpouseEmploymentQuestion has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

const SpouseEmploymentQuestion = props => {
  const {
    data,
    goBack,
    goToPath,

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

const PreSubmitSignature = ({
  formData,
  showError,
  onSectionComplete,
  formSubmission,

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

const ThreadListItem = props => {
  const location = useLocation();
  const { keyword, activeFolder } = props;
  const {
    senderName,

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

export const YourClaimLetters = ({ isLoading, showClaimLetters }) => {
  const [currentItems, setCurrentItems] = useState([]);
  const [currentPage, setCurrentPage] = useState(1);
  const [lettersLoading, setLettersLoading] = useState(true);
  // Using `useRef` here to avoid triggering a rerender whenever these are

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

  UNSAFE_componentWillReceiveProps(nextProps) {
    // Once the login logic is all done...
    // This will occur even for unauthenticated users and should only occur once.
    if (this.props.user.profile.loading && !nextProps.user.profile.loading) {
      const userProfile = nextProps.user.profile;
Severity: Minor
Found in src/applications/veteran-id-card/containers/VeteranIDCard.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 ProofOfVeteranStatus has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

const ProofOfVeteranStatus = ({
  serviceHistory = [],
  totalDisabilityRating,
  userFullName = {
    first: '',

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 6 locations. Consider refactoring.
Open

  const remandIssues = issues
    .filter(issue => issue.disposition === 'remand')
    .map((issue, i) => <li key={`remanded-${i}`}>{issue.description}</li>);
src/applications/claims-status/components/appeals-v2/Decision.jsx on lines 7..9
src/applications/claims-status/components/appeals-v2/Decision.jsx on lines 10..12
src/applications/personalization/dashboard/components/claims-and-appeals/Decision.jsx on lines 7..9
src/applications/personalization/dashboard/components/claims-and-appeals/Decision.jsx on lines 10..12
src/applications/personalization/dashboard/components/claims-and-appeals/Decision.jsx on lines 13..15

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 73.

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

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

  const allowedIssues = issues
    .filter(issue => issue.disposition === 'allowed')
    .map((issue, i) => <li key={`allowed-${i}`}>{issue.description}</li>);
src/applications/claims-status/components/appeals-v2/Decision.jsx on lines 7..9
src/applications/claims-status/components/appeals-v2/Decision.jsx on lines 10..12
src/applications/claims-status/components/appeals-v2/Decision.jsx on lines 13..15
src/applications/personalization/dashboard/components/claims-and-appeals/Decision.jsx on lines 10..12
src/applications/personalization/dashboard/components/claims-and-appeals/Decision.jsx on lines 13..15

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 73.

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

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

  const deniedIssues = issues
    .filter(issue => issue.disposition === 'denied')
    .map((issue, i) => <li key={`denied-${i}`}>{issue.description}</li>);
src/applications/claims-status/components/appeals-v2/Decision.jsx on lines 7..9
src/applications/claims-status/components/appeals-v2/Decision.jsx on lines 10..12
src/applications/claims-status/components/appeals-v2/Decision.jsx on lines 13..15
src/applications/personalization/dashboard/components/claims-and-appeals/Decision.jsx on lines 7..9
src/applications/personalization/dashboard/components/claims-and-appeals/Decision.jsx on lines 13..15

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 73.

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

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

  const deniedIssues = issues
    .filter(issue => issue.disposition === 'denied')
    .map((issue, i) => <li key={`denied-${i}`}>{issue.description}</li>);
src/applications/claims-status/components/appeals-v2/Decision.jsx on lines 7..9
src/applications/claims-status/components/appeals-v2/Decision.jsx on lines 13..15
src/applications/personalization/dashboard/components/claims-and-appeals/Decision.jsx on lines 7..9
src/applications/personalization/dashboard/components/claims-and-appeals/Decision.jsx on lines 10..12
src/applications/personalization/dashboard/components/claims-and-appeals/Decision.jsx on lines 13..15

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 73.

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

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

  const remandIssues = issues
    .filter(issue => issue.disposition === 'remand')
    .map((issue, i) => <li key={`remanded-${i}`}>{issue.description}</li>);
src/applications/claims-status/components/appeals-v2/Decision.jsx on lines 7..9
src/applications/claims-status/components/appeals-v2/Decision.jsx on lines 10..12
src/applications/claims-status/components/appeals-v2/Decision.jsx on lines 13..15
src/applications/personalization/dashboard/components/claims-and-appeals/Decision.jsx on lines 7..9
src/applications/personalization/dashboard/components/claims-and-appeals/Decision.jsx on lines 10..12

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 73.

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

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

  const allowedIssues = issues
    .filter(issue => issue.disposition === 'allowed')
    .map((issue, i) => <li key={`allowed-${i}`}>{issue.description}</li>);
src/applications/claims-status/components/appeals-v2/Decision.jsx on lines 10..12
src/applications/claims-status/components/appeals-v2/Decision.jsx on lines 13..15
src/applications/personalization/dashboard/components/claims-and-appeals/Decision.jsx on lines 7..9
src/applications/personalization/dashboard/components/claims-and-appeals/Decision.jsx on lines 10..12
src/applications/personalization/dashboard/components/claims-and-appeals/Decision.jsx on lines 13..15

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 73.

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

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

export default function uiSchema(title = 'Phone') {
  return {
    'ui:widget': PhoneNumberWidget,
    'ui:reviewWidget': PhoneNumberReviewWidget,
    'ui:title': title,
Severity: Major
Found in src/platform/forms-system/src/js/definitions/phone.js and 4 other locations - About 1 hr to fix
src/applications/pre-need-integration/components/Phone.jsx on lines 9..24
src/applications/pre-need-integration/components/PreparerPhone.jsx on lines 8..23
src/applications/pre-need/components/Phone.jsx on lines 9..24
src/applications/pre-need/components/PreparerPhone.jsx on lines 8..23

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 73.

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