department-of-veterans-affairs/vets-website

View on GitHub

Showing 3,724 of 12,675 total issues

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

export const validateDate = (errors, rawDateString = '', fullData) => {
  const date = createDateObject(rawDateString);
  const error =
    (fullData?.dateType || 'decisions') === 'decisions'
      ? sharedErrorMessages.decisions
Severity: Minor
Found in src/applications/appeals/testing/sc/validations/date.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 getPhone has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export const getPhone = formData => {
  const data = formData || {};
  const { veteran = {} } = data;
  const primary = data[PRIMARY_PHONE] || '';
  // we shouldn't ever get to this point without a home or mobile phone
Severity: Minor
Found in src/applications/appeals/testing/sc/utils/submit.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 PrevApplicationYear has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const PrevApplicationYear = ({
  formResponses,
  setPrevApplicationYear,
  router,
  viewedIntroPage,

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

export const handleTokenRequest = async ({
  code: authCode,
  state: authState,
  csp,
  generateOAuthError,
Severity: Minor
Found in src/applications/auth/helpers.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 useSetToggleParam has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export const useSetToggleParam = toggleValue => {
  useEffect(
    () => {
      const urlParams = new URLSearchParams(window.location.search);
      if (toggleValue != null && toggleValue !== 'undefined') {
Severity: Minor
Found in src/applications/edu-benefits/hooks/useSetToggleParam.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 BenefitSelectionWarning has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export default function BenefitSelectionWarning(chapter, relationship) {
  let warningText = '';
  if (chapter === 'chapter33') {
    // Fry
    if (relationship === 'child') {

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

export function acceptableFileList(list) {
  if (list.length === 0) return <></>;
  const parseItem = (item, idx) => {
    // If we have nested items (we allow one layer deep nesting)
    // then make a <ul> to nest

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

const MegaMenu = ({
  isDesktop,
  levelOneIndexOpen,
  levelTwoMenuOpen,
  megaMenuData,

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

const ChangeOfDirectDepositWrapper = ({ applicantName }) => {
  const prefix = 'GI-Bill-Chapters-';
  const [toggleDirectDepositForm, setToggleDirectDepositForm] = useState(false);
  const [formData, setFormData] = useState();
  const [showModal, setShowModal] = 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 MonthReviewCard has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export default function MonthReviewCard({
  month,
  informationIncorrectMonth,
  onEditMonth,
  reviewPage = false,
Severity: Minor
Found in src/applications/enrollment-verification/components/MonthReviewCard.jsx - 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 HandlePrefilledSSN has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export default function HandlePrefilledSSN(fieldProps) {
  const props = vaTextInputFieldMapping(fieldProps);
  const [val, setVal] = useState(props.value);
  const [displayVal, setDisplayVal] = useState(props.value);
  const [cleared, setCleared] = useState(false);
Severity: Minor
Found in src/applications/ivc-champva/shared/components/maskSSN.jsx - 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 addressLabel has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export const addressLabel = address => {
  // Destructure address object for easier access
  const {
    addressLine1,
    addressLine2,
Severity: Minor
Found in src/applications/verify-your-enrollment/helpers.jsx - 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 hasFormChanged has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export const hasFormChanged = obj => {
  const keys = Object.keys(obj ?? {});
  for (const key of keys) {
    const value = obj[key];
    // Skip the specific key
Severity: Minor
Found in src/applications/verify-your-enrollment/helpers.jsx - 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 getPrimaryContact has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function getPrimaryContact(data) {
  // If a certification name is present, third party signer is the certifier
  const useCert =
    data?.certification?.firstName && data?.certification?.firstName !== '';

Severity: Minor
Found in src/applications/ivc-champva/10-10D/config/submitTransformer.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 getDateRangesBetween has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export const getDateRangesBetween = (date1, date2) => {
  const [year1, month1] = date1.split('-').map(str => parseInt(str, 10));
  const [year2, month2] = date2.split('-').map(str => parseInt(str, 10));

  const ranges = [];
Severity: Minor
Found in src/applications/verify-your-enrollment/helpers.jsx - 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 mapEnrollmentVerificationsForSubmission has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export const mapEnrollmentVerificationsForSubmission = ev => {
  // The enrollments are in order with the most recent first.  Look
  // for the first non-null verificationStatus (or, the most recent
  // month) that was verified as either correct or incorrect.
  const mostRecentVerifiedEnrollmentIndex = ev.enrollmentVerifications.findIndex(
Severity: Minor
Found in src/applications/enrollment-verification/helpers/index.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 translateDateIntoMonthDayYearFormat has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export const translateDateIntoMonthDayYearFormat = dateString => {
  // Parse the date string as UTC
  if (!dateString) return null;
  const [year, month, day] = dateString
    .split('-')
Severity: Minor
Found in src/applications/verify-your-enrollment/helpers.jsx - 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 MegaMenu has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const MegaMenu = ({ megaMenuData }) => {
  const [levelOneIndexOpen, setLevelOneIndexOpen] = useState(null);
  const [levelTwoIndexOpen, setLevelTwoIndexOpen] = useState(null);

  const clearMenu = () => {

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

export const appendReportsFromLocalStorage = resultsArray => {
  const localReportsArray = localStorage.getItem('vaReports');

  if (localReportsArray) {
    const parsedLocalReportsArray = JSON.parse(localReportsArray);
Severity: Minor
Found in src/applications/representative-search/utils/helpers.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 parseRedirectUrl has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export const parseRedirectUrl = url => {
  if (!url) {
    return `${environment.BASE_URL}`;
  }

Severity: Minor
Found in src/applications/terms-of-use/helpers.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