department-of-veterans-affairs/vets-website

View on GitHub
src/applications/_mock-form-ae-design-patterns/vadx/utils/HeadingHierarchyAnalyzer.js

Summary

Maintainability
A
3 hrs
Test Coverage

Function findHeadingIssues has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  static findHeadingIssues(headings) {
    const issues = [];

    // Check for missing h1
    if (!headings.some(h => h.level === 1)) {

    Function collectHeadings has 33 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      collectHeadings(element, pathPrefix = '') {
        const headings = [];
    
        // Process DOM element and add headings to the array when found
        const processElement = (el, path) => {

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

          const processElement = (el, path) => {
            // Check if element is a heading
            if (el?.matches?.('h1, h2, h3, h4, h5, h6')) {
              headings.push({
                text: el.textContent.trim(),

        There are no issues that match your filters.

        Category
        Status