department-of-veterans-affairs/vets-website

View on GitHub

Showing 4,231 of 14,884 total issues

Function generateMicroTxt has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  const generateMicroTxt = async () => {
    setDownloadStarted(true);
    const content = `\n
${crisisLineHeader}\n\n
${record.name}\n

    Function dropdownContent has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            const dropdownContent = () => {
              return (
                <>
                  <p
                    className="vads-u-padding-bottom--1"

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

        captureFocus(e) {
          // eslint-disable-next-line sonarjs/no-collapsible-if
          if (e.target === this.closeControl) {
            if (isReverseTab(e)) {
              e.preventDefault();
      Severity: Minor
      Found in src/platform/site-wide/legacy-component-js/sidenav.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 render has a Cognitive Complexity of 10 (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 NavItemRow has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      const NavItemRow = ({ depth, item, trackEvents }) => {
        // Derive item properties.
        const { expanded, hasChildren, href, id, isSelected, label } = item;
      
        // Derive depth booleans.
      Severity: Minor
      Found in src/platform/site-wide/side-nav/components/NavItemRow.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 addActiveState has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      function addActiveState() {
        // Add active state for Drupal-based side nav
        const sideNav = document.querySelector(
          '#va-detailpage-sidebar[data-drupal-sidebar]',
        );
      Severity: Minor
      Found in src/platform/site-wide/legacy-component-js/sidenav.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 getFormDOM has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      export function getFormDOM(form) {
        const formDOM = form?.container || findDOMNode(form);
      
        if (!formDOM) {
          throw new Error(
      Severity: Minor
      Found in src/platform/testing/unit/schemaform-utils.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 enterData has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      function enterData(field) {
        switch (field.type) {
          // Select fields register as having type 'select-one'.
          case 'select-one':
            cy.wrap(field.element)
      Severity: Minor
      Found in src/platform/testing/e2e/cypress/support/form-tester/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 querySelectorWithShadowRoot has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      export async function querySelectorWithShadowRoot(selector, root) {
        try {
          let selectorElement;
          const rootElement =
            typeof root === 'string'
      Severity: Minor
      Found in src/platform/utilities/ui/webComponents.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 checkAutoSession has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      export async function checkAutoSession(
        loggedIn,
        ssoeTransactionId,
        profile = {},
      ) {
      Severity: Minor
      Found in src/platform/utilities/sso/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 asyncLoader has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      export default function asyncLoader(getComponent, message) {
        return class AsyncComponent extends React.Component {
          static Component = null;
      
          constructor(props) {
      Severity: Minor
      Found in src/platform/utilities/ui/asyncLoader.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 createOAuthRequest has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      export async function createOAuthRequest({
        application = '',
        clientId,
        config,
        passedQueryParams = {},
      Severity: Minor
      Found in src/platform/utilities/oauth/utilities.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 useVaDateCommon has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      export function useVaDateCommon(props) {
        const mappedProps = vaDateCommonFieldMapping(props);
        const [values, setValues] = useState(parseISODate(mappedProps.value));
        const monthYearOnly = props?.uiOptions?.monthYearOnly;
      
      

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

      const uiSchema = ({ affectedBenefits, unaffectedBenefits, optionalFields }) => {
        const ui = {
          'ui:title': ({ formData }) => {
            return formData.declineDirectDeposit ? (
              <div className="schemaform-block-header">
      Severity: Minor
      Found in src/platform/forms-system/src/js/definitions/directDeposit.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 render has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

        render() {
          const { schema, uiSchema, path, pageTitle, formContext } = this.props;
      
          const uiOptions = uiSchema['ui:options'] || {};
          const fieldName = path[path.length - 1];
      Severity: Minor
      Found in src/platform/forms-system/src/js/review/ArrayField.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 getValidationMessageKey has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      export const getValidationMessageKey = ({
        suggestedAddresses,
        addressValidationError,
        confirmedSuggestions = [],
        validationKey,
      Severity: Minor
      Found in src/platform/user/profile/vap-svc/util/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 replaceRefSchemas has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      export function replaceRefSchemas(schema, definitions, path = '') {
        // this can happen if you import a field that doesn’t exist from a schema
        if (!schema) {
          throw new Error(`Schema is undefined at ${path}`);
        }
      Severity: Minor
      Found in src/platform/forms-system/src/js/state/helpers.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 render has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

        render() {
          const {
            activeEditView,
            fieldName,
            isEmpty,

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

      export const recordSearchResultsEvents = (props, results) => {
        const dataPush = { event: 'fl-search-results' };
        const { currentQuery, pagination, resultTime } = props;
      
        if (currentQuery) {
      Severity: Minor
      Found in src/applications/facility-locator/utils/analytics.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

      Severity
      Category
      Status
      Source
      Language