department-of-veterans-affairs/vets-website

View on GitHub

Showing 3,732 of 12,811 total issues

Function notQualifiedWarning has 48 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function notQualifiedWarning() {
  return (
    <div className="usa-alert usa-alert-warning usa-content not-qualified">
      <div className="usa-alert-body">
        <h2>You don't qualify</h2>
Severity: Minor
Found in src/applications/post-911-gib-status/utils/helpers.jsx - About 1 hr to fix

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

    const createRichTextDetailItem = async (doc, config, x, item) => {
      let titleText = item.title ?? '';
      const content = [];
    
      if (titleText) {
    Severity: Minor
    Found in src/platform/pdf/templates/utils.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 15 (exceeds 5 allowed). Consider refactoring.
    Open

      render() {
        const {
          route,
          params,
          form,
    Severity: Minor
    Found in src/platform/forms-system/src/js/containers/FormPage.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 focusElement has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

    export function focusElement(selectorOrElement, options, root) {
      function applyFocus(el) {
        if (el) {
          // Use getAttribute to grab the "tabindex" attribute (returns string), not
          // the "tabIndex" property (returns number). Focusable elements will
    Severity: Minor
    Found in src/platform/utilities/ui/focus.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 validatePages has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

    export function validatePages(orderedPageTypes) {
      const pageTypes = {};
      for (const pageType of orderedPageTypes) {
        if (pageType === 'intro') {
          if (pageTypes.intro || pageTypes.summary || pageTypes.item) {

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

    export const checkResponses = (formResponses, displayConditionsForPath) => {
      const questionRequirements = Object.keys(displayConditionsForPath);
    
      for (const questionShortName of questionRequirements) {
        const formResponse = formResponses?.[questionShortName];
    Severity: Minor
    Found in src/applications/pact-act/utilities/display-logic-questions.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 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 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 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 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 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 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 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 FilterYourResults has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

    export function FilterYourResults({
      dispatchFilterChange,
      dispatchError,
      filters,
      modalClose,
    Severity: Minor
    Found in src/applications/gi/containers/FilterYourResults.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 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

    Severity
    Category
    Status
    Source
    Language