department-of-veterans-affairs/vets-website

View on GitHub

Showing 3,724 of 12,675 total issues

Function Column has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

const Column = props => {
  const {
    mobileMediaQuery,
    data,
    keyName,
Severity: Minor
Found in src/platform/site-wide/mega-menu/components/Column.jsx - About 35 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 7 (exceeds 5 allowed). Consider refactoring.
Open

  render() {
    const { currentLocation, formConfig, children, loadedStatus } = this.props;
    const appType = formConfig?.customText?.appType || APP_TYPE_DEFAULT;
    const trimmedPathname = currentLocation.pathname.replace(/\/$/, '');
    let content;
Severity: Minor
Found in src/platform/forms/save-in-progress/RoutedSavableApp.jsx - About 35 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 redirectOrLoad has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  redirectOrLoad(props) {
    // Stop a user that's been redirected from being redirected again after
    // logging in
    this.shouldRedirectOrLoad = false;

Severity: Minor
Found in src/platform/forms/save-in-progress/RoutedSavableApp.jsx - About 35 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 Title has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export const Title = ({
  title,
  description,
  headerLevel = 3,
  headerStyleLevel,
Severity: Minor
Found in src/platform/forms-system/src/js/web-component-patterns/titlePattern.js - About 35 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 formsPatternFieldMapping has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export default function formsPatternFieldMapping(props) {
  const { uiOptions = {} } = props;
  const {
    useFormsPattern,
    formHeading,

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

export const formatDowntime = dateTime => {
  const dtMoment = moment.parseZone(dateTime);
  const dtHour = dtMoment.hour();
  const dtMinute = dtMoment.minute();

Severity: Minor
Found in src/platform/utilities/date/index.js - About 35 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 FormSignature has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export const FormSignature = ({
  signatureLabel,
  checkboxLabel,
  checkboxDescription,
  formData,
Severity: Minor
Found in src/platform/forms-system/src/js/components/FormSignature.jsx - About 35 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 titleCase has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

module.exports = function titleCase(string) {
  return string
    .split(wordSeparators)
    .map((current, index, array) => {
      const shouldMakeLowerCase =
Severity: Minor
Found in src/platform/utilities/data/titleCase.js - About 35 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 SaveStatus has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

function SaveStatus({
  form: {
    lastSavedDate,
    autoSavedStatus,
    loadedData,
Severity: Minor
Found in src/platform/forms/save-in-progress/SaveStatus.jsx - About 35 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 currentOrPastDateUI has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

const currentOrPastDateUI = options => {
  const { title, errorMessages, required, ...uiOptions } =
    typeof options === 'object' ? options : { title: options };

  // if monthYearOnly is used, the schema pattern also needs
Severity: Minor
Found in src/platform/forms-system/src/js/web-component-patterns/datePatterns.jsx - About 35 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 onNavBackRemoveAddingItem has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export function onNavBackRemoveAddingItem({
  arrayPath,
  summaryRoute,
  introRoute,
}) {
Severity: Minor
Found in src/platform/forms-system/src/js/patterns/array-builder/helpers.js - About 35 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 hideFormTitle has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export function hideFormTitle(formConfig, pathName) {
  if (
    !formConfig?.chapters ||
    typeof formConfig.chapters !== 'object' ||
    formConfig.chapters.length === 0
Severity: Minor
Found in src/platform/forms-system/src/js/helpers.js - About 35 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 parseISODate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export function parseISODate(dateString) {
  if (typeof dateString === 'string') {
    const [year = 'XXXX', month = 'XX', day = 'XX'] = dateString.split('-', 3);

    return {
Severity: Minor
Found in src/platform/forms-system/src/js/helpers.js - About 35 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 getArrayFields has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export function getArrayFields(data) {
  const fields = [];
  const findArrays = (obj, ui, path = []) => {
    if (
      obj.type === 'array' &&
Severity: Minor
Found in src/platform/forms-system/src/js/helpers.js - About 35 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 expandArrayPages has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export function expandArrayPages(pageList, data) {
  const result = pageList.reduce(
    (acc, nextPage) => {
      const { lastArrayPath, arrayPages, currentList } = acc;
      // If we see an array page and we’re starting a section or in the middle of one, just add it
Severity: Minor
Found in src/platform/forms-system/src/js/helpers.js - About 35 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 ErrorLinks has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

const ErrorLinks = props => {
  const { appType, testId, errors } = props;
  const errorRef = useRef(null);
  const [hadErrors, setHadErrors] = useState(false);

Severity: Minor
Found in src/platform/forms-system/src/js/review/submit-states/ErrorLinks.jsx - About 35 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 removeHiddenData has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export function removeHiddenData(schema, data) {
  // null is necessary here because Rails 4 will convert empty arrays to null
  // In the forms, there's no difference between an empty array and null or undefined
  if (isHiddenField(schema) || typeof data === 'undefined' || data === null) {
    return undefined;
Severity: Minor
Found in src/platform/forms-system/src/js/state/helpers.js - About 35 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 updateFormValue has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export const updateFormValue = (SHORT_NAME, checkbox, state, action) => {
  // Multi-checkbox responses
  if (checkbox) {
    const currentFormContents = state.form?.[SHORT_NAME];
    const removeResponse = currentFormContents?.includes(action.payload);
Severity: Minor
Found in src/applications/pact-act/reducers/utilities.js - About 35 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 createAndStoreReturnUrl has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export const createAndStoreReturnUrl = () => {
  let returnUrl;
  if (loginAppUrlRE.test(window.location.pathname)) {
    if (isExternalRedirect()) {
      returnUrl = createExternalApplicationUrl();
Severity: Minor
Found in src/platform/user/authentication/utilities.js - About 35 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 ConfirmRemoveModal has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

const ConfirmRemoveModal = ({
  cancelAction,
  deleteAction,
  title,
  fieldName,

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