rails_accessibility_testing 1.5.3 → 1.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/ARCHITECTURE.md +376 -1
  3. data/CHANGELOG.md +50 -1
  4. data/GUIDES/getting_started.md +40 -5
  5. data/GUIDES/system_specs_for_accessibility.md +12 -4
  6. data/README.md +52 -8
  7. data/docs_site/Gemfile.lock +89 -0
  8. data/docs_site/_config.yml +9 -0
  9. data/docs_site/_includes/header.html +1 -0
  10. data/docs_site/_layouts/default.html +754 -15
  11. data/docs_site/architecture.md +533 -0
  12. data/docs_site/index.md +2 -1
  13. data/exe/a11y_live_scanner +10 -39
  14. data/exe/a11y_static_scanner +333 -0
  15. data/lib/generators/rails_a11y/install/install_generator.rb +19 -30
  16. data/lib/generators/rails_a11y/install/templates/accessibility.yml.erb +39 -0
  17. data/lib/generators/rails_a11y/install/templates/all_pages_accessibility_spec.rb.erb +132 -45
  18. data/lib/rails_accessibility_testing/accessibility_helper.rb +131 -126
  19. data/lib/rails_accessibility_testing/checks/base_check.rb +14 -5
  20. data/lib/rails_accessibility_testing/checks/form_errors_check.rb +1 -1
  21. data/lib/rails_accessibility_testing/checks/form_labels_check.rb +6 -4
  22. data/lib/rails_accessibility_testing/checks/heading_check.rb +7 -15
  23. data/lib/rails_accessibility_testing/checks/image_alt_text_check.rb +1 -1
  24. data/lib/rails_accessibility_testing/checks/interactive_elements_check.rb +12 -8
  25. data/lib/rails_accessibility_testing/config/yaml_loader.rb +20 -0
  26. data/lib/rails_accessibility_testing/erb_extractor.rb +141 -0
  27. data/lib/rails_accessibility_testing/error_message_builder.rb +11 -6
  28. data/lib/rails_accessibility_testing/file_change_tracker.rb +95 -0
  29. data/lib/rails_accessibility_testing/line_number_finder.rb +61 -0
  30. data/lib/rails_accessibility_testing/rspec_integration.rb +74 -33
  31. data/lib/rails_accessibility_testing/shared_examples.rb +2 -0
  32. data/lib/rails_accessibility_testing/static_file_scanner.rb +80 -0
  33. data/lib/rails_accessibility_testing/static_page_adapter.rb +116 -0
  34. data/lib/rails_accessibility_testing/static_scanning.rb +61 -0
  35. data/lib/rails_accessibility_testing/version.rb +3 -1
  36. data/lib/rails_accessibility_testing/violation_converter.rb +80 -0
  37. data/lib/rails_accessibility_testing.rb +9 -1
  38. metadata +26 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 58922a0f7334ba5695d55aeb1d02576e975504492d7ae47c1ae37552cba246c3
4
- data.tar.gz: a07f66b20c17b6da10ef18518d58a20d4de9429f2fac3af7dc9e2505bf3d218e
3
+ metadata.gz: c200c81650bf10d4b74b6f8270aad8ee888ea42aa6b979bb3c38d15c28f34884
4
+ data.tar.gz: f650081313bc70c51f10a86e54ea189356bf27258c5e83a2e0e3ba72367478db
5
5
  SHA512:
6
- metadata.gz: 5f12b4e6da01ca76d1deb3aba955f284915857bf003fa6cb7568b8be05ea78e2eb7dddaf94bbe89fbe665cf99afb951ffbb86517eb3ea4862084b767939e779a
7
- data.tar.gz: f638f6fbc1a0e4f7f3405f2c49929172d364910ad8140be4b662e823ab3c734fcde487666ae9874d973ec6d2643cb97ca2dc33e4419f805be45b0e2dec8daa2e
6
+ metadata.gz: dbf1bf3b4d4ae115a82d46d5e331ce3538b7a48fea54e391b3e2701a8f6676042b9cc6dc719a185f7ce80d783803bd46ec5950acd156ead844dca9eb042c8c40
7
+ data.tar.gz: 24c012d81ec25267d948c661f8631c9c760d32793e5c3261e023d7d76e3ee65d72ee0c4ed871ced3fac1e0d82ec8646ee77920d166381fcec2acd5d53a12d312
data/ARCHITECTURE.md CHANGED
@@ -49,6 +49,14 @@ rails_accessibility_testing/
49
49
  │ ├── First-Run Logic # Optimizes initial vs subsequent runs
50
50
  │ └── Asset Change Detection # Tracks CSS/JS changes
51
51
 
52
+ ├── Static Scanning System (NEW in 1.5.3)
53
+ │ ├── StaticFileScanner # Main orchestrator for file-based scanning
54
+ │ ├── FileChangeTracker # Tracks file modification times
55
+ │ ├── ErbExtractor # Converts ERB templates to HTML
56
+ │ ├── StaticPageAdapter # Makes Nokogiri look like Capybara
57
+ │ ├── LineNumberFinder # Maps HTML elements to ERB line numbers
58
+ │ └── ViolationConverter # Formats violations with line numbers
59
+
52
60
  ├── Rails Integration
53
61
  │ ├── Railtie # Rails initialization hooks
54
62
  │ ├── RSpec Integration # RSpec helpers and matchers
@@ -74,6 +82,111 @@ rails_accessibility_testing/
74
82
  └── Doc Site # Static documentation site
75
83
  ```
76
84
 
85
+ #### Visual Architecture Diagram
86
+
87
+ ```mermaid
88
+ graph TB
89
+ subgraph "Rails Application"
90
+ App[Your Rails App]
91
+ Tests[System Tests/Specs]
92
+ Views[Views & Partials]
93
+ Routes[Routes & Controllers]
94
+ end
95
+
96
+ subgraph "Rails Accessibility Testing Gem"
97
+ Entry[Gem Entry Point]
98
+ Railtie[Rails Integration Layer]
99
+
100
+ subgraph "Test Integration"
101
+ RSpec[RSpec Integration]
102
+ Minitest[Minitest Integration]
103
+ AutoHook[Automatic Test Hooks]
104
+ end
105
+
106
+ subgraph "Core Engine"
107
+ RuleEngine[Rule Engine]
108
+ Checks[11+ Accessibility Checks]
109
+ Collector[Violation Collector]
110
+ end
111
+
112
+ subgraph "Intelligence Layer"
113
+ ViewDetector[View File Detector]
114
+ PartialDetector[Partial Detection]
115
+ ChangeDetector[Change Detector]
116
+ Cache[Page Scanning Cache]
117
+ end
118
+
119
+ subgraph "Static Scanning"
120
+ StaticScanner[Static File Scanner]
121
+ FileTracker[File Change Tracker]
122
+ ErbExtractor[ERB Extractor]
123
+ StaticAdapter[Static Page Adapter]
124
+ LineFinder[Line Number Finder]
125
+ end
126
+
127
+ subgraph "Configuration"
128
+ YAMLConfig[YAML Config Loader]
129
+ Profiles[Profile Manager]
130
+ RubyConfig[Ruby Configuration]
131
+ end
132
+
133
+ subgraph "Output & Reporting"
134
+ ErrorBuilder[Error Message Builder]
135
+ CLI[CLI Tool]
136
+ Reports[Reports & Logs]
137
+ end
138
+ end
139
+
140
+ subgraph "Testing Tools"
141
+ Capybara[Capybara]
142
+ Selenium[Selenium WebDriver]
143
+ AxeCore[axe-core Engine]
144
+ end
145
+
146
+ Tests --> RSpec
147
+ Tests --> Minitest
148
+ RSpec --> AutoHook
149
+ Minitest --> AutoHook
150
+ App --> Railtie
151
+ Entry --> Railtie
152
+
153
+ AutoHook --> Cache
154
+ Cache --> ViewDetector
155
+ ViewDetector --> ChangeDetector
156
+ ChangeDetector --> RuleEngine
157
+ RuleEngine --> YAMLConfig
158
+ YAMLConfig --> Profiles
159
+ RuleEngine --> Checks
160
+ Checks --> Capybara
161
+ Capybara --> Selenium
162
+ Checks --> AxeCore
163
+ Checks --> ViewDetector
164
+ ViewDetector --> PartialDetector
165
+ PartialDetector --> Views
166
+ Checks --> Collector
167
+ Collector --> ErrorBuilder
168
+ ErrorBuilder --> Reports
169
+
170
+ CLI --> RuleEngine
171
+ Routes --> ViewDetector
172
+
173
+ StaticScanner --> FileTracker
174
+ StaticScanner --> ErbExtractor
175
+ ErbExtractor --> StaticAdapter
176
+ StaticAdapter --> RuleEngine
177
+ StaticScanner --> LineFinder
178
+ LineFinder --> ErrorBuilder
179
+
180
+ style Entry fill:#ff6b6b
181
+ style RuleEngine fill:#4ecdc4
182
+ style Checks fill:#45b7d1
183
+ style ViewDetector fill:#96ceb4
184
+ style ErrorBuilder fill:#ffeaa7
185
+ style Cache fill:#a29bfe
186
+ style StaticScanner fill:#feca57
187
+ style FileTracker fill:#ff9ff3
188
+ ```
189
+
77
190
  ### Data Flow
78
191
 
79
192
  ```
@@ -99,6 +212,80 @@ Error Message Builder (with file paths)
99
212
  Test Failure / CLI Report
100
213
  ```
101
214
 
215
+ #### Request Flow Sequence Diagram
216
+
217
+ ```mermaid
218
+ sequenceDiagram
219
+ participant Dev as Developer
220
+ participant Test as Test Suite
221
+ participant Hook as Auto Hooks
222
+ participant Cache as Scan Cache
223
+ participant Detector as View Detector
224
+ participant Change as Change Detector
225
+ participant Engine as Rule Engine
226
+ participant Checks as 11 Check Modules
227
+ participant Capybara as Capybara/Browser
228
+ participant Collector as Violation Collector
229
+ participant Builder as Error Builder
230
+ participant Report as Test Report
231
+
232
+ Dev->>Test: Run test suite
233
+ Test->>Hook: Execute system test
234
+ Hook->>Test: visit('/some/path')
235
+ Test->>Capybara: Load page
236
+ Capybara->>Test: Page loaded
237
+
238
+ rect rgb(200, 220, 250)
239
+ Note over Hook,Cache: Performance Optimization
240
+ Hook->>Cache: Check if page scanned
241
+ alt Page already scanned
242
+ Cache->>Hook: Skip (cached)
243
+ else Not in cache
244
+ Cache->>Detector: Continue with scan
245
+ end
246
+ end
247
+
248
+ rect rgb(220, 250, 220)
249
+ Note over Detector,Change: Smart Detection
250
+ Detector->>Change: Check for file changes
251
+ Change->>Change: Analyze views/partials/assets
252
+ alt No changes detected
253
+ Change->>Hook: Skip scan (no changes)
254
+ else Changes detected
255
+ Change->>Engine: Proceed with checks
256
+ end
257
+ end
258
+
259
+ rect rgb(250, 220, 220)
260
+ Note over Engine,Checks: Accessibility Checks
261
+ Engine->>Checks: Run enabled checks
262
+ loop For each check (11 total)
263
+ Checks->>Capybara: Query DOM elements
264
+ Capybara->>Checks: Return elements
265
+ Checks->>Checks: Validate WCAG rules
266
+ Checks->>Collector: Report violations
267
+ end
268
+ end
269
+
270
+ rect rgb(250, 240, 200)
271
+ Note over Collector,Report: Error Reporting
272
+ Collector->>Detector: Map violations to files
273
+ Detector->>Detector: Find view files
274
+ Detector->>Detector: Detect partials
275
+ Detector->>Builder: Pass file locations
276
+ Builder->>Builder: Format error messages
277
+ Builder->>Report: Generate detailed report
278
+ end
279
+
280
+ alt Violations found
281
+ Report->>Test: Fail with detailed errors
282
+ Test->>Dev: Show actionable errors
283
+ else No violations
284
+ Report->>Test: Pass
285
+ Test->>Dev: ✓ Accessibility checks passed
286
+ end
287
+ ```
288
+
102
289
  ### Rule Engine Design
103
290
 
104
291
  The rule engine is the heart of the gem. It:
@@ -109,6 +296,43 @@ The rule engine is the heart of the gem. It:
109
296
  4. **Collects Violations**: Aggregates all violations before reporting
110
297
  5. **Formats Output**: Creates actionable error messages with precise file locations
111
298
 
299
+ #### Rule Engine Flow Diagram
300
+
301
+ ```mermaid
302
+ graph TB
303
+ A[Rule Engine] --> B[Load Configuration]
304
+ B --> C[Apply Profiles]
305
+ C --> D[Filter Enabled Checks]
306
+ D --> E[Execute Checks in Order]
307
+
308
+ E --> F1[Form Labels]
309
+ E --> F2[Image Alt Text]
310
+ E --> F3[Interactive Elements]
311
+ E --> F4[Heading Hierarchy]
312
+ E --> F5[Keyboard Access]
313
+ E --> F6[ARIA Landmarks]
314
+ E --> F7[Form Errors]
315
+ E --> F8[Table Structure]
316
+ E --> F9[Duplicate IDs]
317
+ E --> F10[Skip Links]
318
+ E --> F11[Color Contrast]
319
+
320
+ F1 --> G[Collect Violations]
321
+ F2 --> G
322
+ F3 --> G
323
+ F4 --> G
324
+ F5 --> G
325
+ F6 --> G
326
+ F7 --> G
327
+ F8 --> G
328
+ F9 --> G
329
+ F10 --> G
330
+ F11 --> G
331
+
332
+ style A fill:#4ecdc4
333
+ style G fill:#ffeaa7
334
+ ```
335
+
112
336
  ### Check Definition Structure
113
337
 
114
338
  Each check is a self-contained class that:
@@ -157,6 +381,24 @@ module AccessibilityHelper
157
381
  end
158
382
  ```
159
383
 
384
+ #### View Detection Flow Diagram
385
+
386
+ ```mermaid
387
+ graph TB
388
+ subgraph "View Detection System"
389
+ A[Page URL] --> B[Route Recognition]
390
+ B --> C{Exact Match?}
391
+ C -->|Yes| D[Found View File]
392
+ C -->|No| E[Fuzzy Matching]
393
+ E --> F[Scan Controller Dir]
394
+ F --> D
395
+ D --> G[Scan for Partials]
396
+ G --> H[Map Elements to Partials]
397
+ end
398
+
399
+ style B fill:#96ceb4
400
+ ```
401
+
160
402
  ### Performance System (NEW in 1.5.0)
161
403
 
162
404
  #### Page Scanning Cache
@@ -185,6 +427,121 @@ end
185
427
  - **Subsequent Runs**: Only tests changed files
186
428
  - **Force Option**: `TEST_ALL_PAGES=true` environment variable
187
429
 
430
+ ### Static Scanning System (NEW in 1.5.3)
431
+
432
+ The static scanning system allows scanning view files directly without browser rendering, providing fast feedback during development.
433
+
434
+ #### Components
435
+
436
+ 1. **StaticFileScanner** - Main orchestrator
437
+ - Reads ERB template files
438
+ - Coordinates HTML extraction and scanning
439
+ - Returns errors with file locations and line numbers
440
+
441
+ 2. **FileChangeTracker** - Change detection for static files
442
+ - Tracks file modification times in `tmp/.rails_a11y_scanned_files.json`
443
+ - Detects which files have changed since last scan
444
+ - Supports atomic writes to prevent partial state
445
+
446
+ 3. **ErbExtractor** - ERB to HTML conversion
447
+ - Converts Rails helpers (`link_to`, `image_tag`, `select_tag`, etc.) to HTML placeholders
448
+ - Preserves attributes (id, name, src, alt, href) for analysis
449
+ - Removes ERB tags while preserving structure
450
+
451
+ 4. **StaticPageAdapter** - Capybara compatibility layer
452
+ - Makes Nokogiri documents look like Capybara pages
453
+ - Allows reuse of existing checks without modification
454
+ - Provides Capybara-like interface (`all`, `has_css?`, etc.)
455
+
456
+ 5. **LineNumberFinder** - Precise error location
457
+ - Maps HTML elements back to original ERB line numbers
458
+ - Uses element attributes (id, src, href) for matching
459
+ - Enables precise error reporting
460
+
461
+ 6. **ViolationConverter** - Result formatting
462
+ - Converts raw violations to structured errors/warnings
463
+ - Adds line numbers and file paths
464
+ - Respects `ignore_warnings` configuration
465
+
466
+ #### Static Scanning Flow
467
+
468
+ ```mermaid
469
+ graph TB
470
+ A[View File Changed] --> B[FileChangeTracker]
471
+ B --> C{File Modified?}
472
+ C -->|No| D[Skip Scan]
473
+ C -->|Yes| E[StaticFileScanner]
474
+ E --> F[ErbExtractor]
475
+ F --> G[Convert ERB to HTML]
476
+ G --> H[StaticPageAdapter]
477
+ H --> I[RuleEngine]
478
+ I --> J[11 Checks]
479
+ J --> K[ViolationConverter]
480
+ K --> L[LineNumberFinder]
481
+ L --> M[Errors with Line Numbers]
482
+ M --> N[Update FileChangeTracker State]
483
+
484
+ style E fill:#feca57
485
+ style F fill:#ff9ff3
486
+ style H fill:#48dbfb
487
+ style L fill:#ff6b6b
488
+ ```
489
+
490
+ #### Configuration
491
+
492
+ Static scanner behavior is controlled via `config/accessibility.yml`:
493
+
494
+ ```yaml
495
+ static_scanner:
496
+ # Only scan files that have changed since last scan
497
+ scan_changed_only: true
498
+
499
+ # Check interval in seconds when running continuously
500
+ check_interval: 3
501
+
502
+ # Force full scan on startup (true/false)
503
+ # When true: scans all files on first run, then only changed files
504
+ # When false: only scans changed files from the start
505
+ full_scan_on_startup: true
506
+ ```
507
+
508
+ #### Benefits
509
+
510
+ - **Fast**: No browser needed - scans ERB templates directly
511
+ - **Precise**: Reports exact file locations and line numbers
512
+ - **Efficient**: Only scans changed files using modification time tracking
513
+ - **Continuous**: Runs continuously, watching for file changes
514
+ - **Reusable**: Leverages existing RuleEngine and all 11 checks
515
+
516
+ #### Performance Optimization Flow
517
+
518
+ ```mermaid
519
+ graph TB
520
+ A[Page Visit] --> B{In Page Cache?}
521
+ B -->|Yes| C[Skip Scan]
522
+ B -->|No| D{First Run?}
523
+ D -->|Yes| E[Scan All Pages]
524
+ D -->|No| F{Files Changed?}
525
+ F -->|No| G[Skip Scan]
526
+ F -->|Yes| H[Smart Scan]
527
+
528
+ H --> I{Which Files?}
529
+ I -->|View| J[Scan This Page]
530
+ I -->|Partial| K[Scan Pages Using Partial]
531
+ I -->|Helper| L[Scan All Pages]
532
+ I -->|Asset| M[Scan All Pages]
533
+
534
+ E --> N[Add to Cache]
535
+ J --> N
536
+ K --> N
537
+ L --> N
538
+ M --> N
539
+
540
+ style B fill:#a29bfe
541
+ style F fill:#fdcb6e
542
+ style N fill:#55efc4
543
+ ```
544
+
188
545
  ---
189
546
 
190
547
  ## Key Design Decisions
@@ -286,6 +643,13 @@ lib/
286
643
  │ ├── change_detector.rb # Smart change detection
287
644
  │ │ # (enhanced in 1.5.0 for assets/partials)
288
645
  │ │
646
+ │ ├── static_file_scanner.rb # Static file scanner orchestrator
647
+ │ ├── file_change_tracker.rb # Tracks file modification times
648
+ │ ├── erb_extractor.rb # Converts ERB to HTML
649
+ │ ├── static_page_adapter.rb # Nokogiri → Capybara adapter
650
+ │ ├── line_number_finder.rb # Maps elements to line numbers
651
+ │ ├── violation_converter.rb # Formats violations with line numbers
652
+ │ │
289
653
  │ ├── integration/
290
654
  │ │ ├── rspec_integration.rb
291
655
  │ │ ├── minitest_integration.rb
@@ -319,7 +683,8 @@ lib/
319
683
  exe/
320
684
  ├── rails_a11y # CLI executable
321
685
  ├── rails_server_safe # Safe server wrapper (NEW in 1.5.0)
322
- └── a11y_live_scanner # Live scanner tool
686
+ ├── a11y_live_scanner # Live scanner tool (browser-based)
687
+ └── a11y_static_scanner # Static file scanner (NEW in 1.5.0+)
323
688
 
324
689
  GUIDES/
325
690
  ├── getting_started.md
@@ -420,6 +785,13 @@ ci:
420
785
  3. **Enhanced ChangeDetector**: Asset change detection and smart partial impact analysis
421
786
  4. **Improved View File Detection**: Fuzzy matching and controller directory scanning
422
787
  5. **Rails Server Safe Wrapper**: Prevents Foreman from terminating processes
788
+ 6. **Static Scanning System**: File-based scanning without browser (NEW in 1.5.0+)
789
+ - **StaticFileScanner**: Main orchestrator for static file scanning
790
+ - **FileChangeTracker**: Tracks file modification times for change detection
791
+ - **ErbExtractor**: Converts ERB templates to HTML for analysis
792
+ - **StaticPageAdapter**: Makes Nokogiri documents compatible with existing checks
793
+ - **LineNumberFinder**: Maps HTML elements to ERB line numbers
794
+ - **ViolationConverter**: Formats violations with precise file locations
423
795
 
424
796
  ### Enhanced Components
425
797
 
@@ -435,6 +807,9 @@ ci:
435
807
  2. **Smart Change Detection**: Only tests affected pages
436
808
  3. **First-Run Optimization**: Faster initial setup
437
809
  4. **Reduced Wait Times**: Faster Capybara operations
810
+ 5. **Static File Scanning**: Fast file-based scanning without browser overhead (NEW in 1.5.0+)
811
+ 6. **File Change Tracking**: Only scans modified files using modification time tracking
812
+ 7. **Continuous Monitoring**: Watches for file changes and re-scans automatically
438
813
 
439
814
  ---
440
815
 
data/CHANGELOG.md CHANGED
@@ -5,18 +5,65 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [1.5.4] - 2024-11-20
9
+
10
+ ### Changed
11
+ - **Static scanner startup behavior**: Always runs full scan on startup when `full_scan_on_startup: true` (default)
12
+ - **Improved first-run detection**: Better handling of initial scan vs subsequent scans
13
+
14
+ ### Fixed
15
+ - **Static scanner startup**: Fixed issue where scanner wasn't running full scan on every `bin/dev` startup
16
+ - **Documentation**: Updated all documentation to reflect static scanner as primary development tool
17
+
8
18
  ## [1.5.3] - 2024-11-20
9
19
 
20
+ ### Added
21
+
22
+ #### Static File Scanner (NEW)
23
+ - **Fast file-based scanning**: Scans ERB templates directly without browser rendering
24
+ - **Smart change detection**: Only scans files that have changed since last scan using file modification time tracking
25
+ - **Precise error reporting**: Shows exact file locations and line numbers for accessibility issues
26
+ - **Continuous monitoring**: Watches for file changes and re-scans automatically
27
+ - **YAML configuration**: Fully configurable via `config/accessibility.yml` with `static_scanner` section
28
+ - **Reuses existing checks**: Leverages all 11 accessibility checks via RuleEngine
29
+ - **Modular architecture**: New components (`FileChangeTracker`, `ErbExtractor`, `StaticPageAdapter`, `LineNumberFinder`, `ViolationConverter`)
30
+ - **Full scan on startup**: Always runs complete scan when `bin/dev` starts (configurable)
31
+ - **Warning filtering**: New `ignore_warnings` flag in YAML config to hide warnings, only show errors
32
+
33
+ #### New Components
34
+ - **FileChangeTracker**: Tracks file modification times in `tmp/.rails_a11y_scanned_files.json` for efficient change detection
35
+ - **ErbExtractor**: Converts ERB templates to HTML by replacing Rails helpers with HTML placeholders
36
+ - **StaticPageAdapter**: Makes Nokogiri documents compatible with existing Capybara-based checks
37
+ - **LineNumberFinder**: Maps HTML elements back to original ERB line numbers for precise error reporting
38
+ - **ViolationConverter**: Formats violations with file paths and line numbers, respects `ignore_warnings` config
39
+
40
+ #### Configuration Enhancements
41
+ - **Static scanner config**: New `static_scanner` section in `accessibility.yml`:
42
+ - `scan_changed_only`: Only scan changed files (default: true)
43
+ - `check_interval`: Seconds between file checks (default: 3)
44
+ - `full_scan_on_startup`: Full scan on startup (default: true)
45
+ - **Summary config**: New `ignore_warnings` flag to filter out warnings completely
46
+
47
+ ### Changed
48
+ - **Generator**: Now adds `a11y_static_scanner` to `Procfile.dev` instead of live scanner
49
+ - **Default behavior**: Static scanner runs full scan on every `bin/dev` startup by default
50
+ - **Error reporting**: Static scanner shows errors with file paths and line numbers instead of URLs
51
+
10
52
  ### Fixed
11
53
  - **Gem packaging**: Verified all required files are included in gem package
12
- - All executables (rails_a11y, rails_server_safe, a11y_live_scanner)
54
+ - All executables (rails_a11y, rails_server_safe, a11y_live_scanner, a11y_static_scanner)
13
55
  - All generator templates (.erb files)
14
56
  - Complete library files and documentation
57
+ - **Rails helper compatibility**: Fixed `blank?` and `present?` calls to work without Rails (pure Ruby)
58
+ - **Check compatibility**: Fixed `FormLabelsCheck`, `InteractiveElementsCheck`, `HeadingCheck` to work with static scanning
59
+ - **Element queries**: Added `all` method to `StaticElementAdapter` for nested element queries
15
60
 
16
61
  ### Verified
17
62
  - All executables properly included in gemspec
18
63
  - Generator templates correctly packaged
19
64
  - rails_server_safe Ruby script working correctly
65
+ - Static scanner working correctly with all 11 checks
66
+ - File change detection working correctly
20
67
  - Local development setup confirmed working
21
68
 
22
69
  ## [1.5.2] - 2024-11-20
@@ -327,6 +374,8 @@ This release introduces significant improvements to view file detection, partial
327
374
  - Compatible with RSpec Rails 6.0+
328
375
  - Modular architecture with rule engine and check definitions
329
376
 
377
+ [1.5.4]: https://github.com/rayraycodes/rails-accessibility-testing/releases/tag/v1.5.4
378
+ [1.5.3]: https://github.com/rayraycodes/rails-accessibility-testing/releases/tag/v1.5.3
330
379
  [1.5.2]: https://github.com/rayraycodes/rails-accessibility-testing/releases/tag/v1.5.2
331
380
  [1.5.0]: https://github.com/rayraycodes/rails-accessibility-testing/releases/tag/v1.5.0
332
381
  [1.4.3]: https://github.com/rayraycodes/rails-accessibility-testing/releases/tag/v1.4.3
@@ -62,14 +62,14 @@ bundle exec rspec spec/system/
62
62
 
63
63
  Accessibility checks run automatically on every system test that visits a page.
64
64
 
65
- #### Option B: Run Continuously with Procfile (Recommended for Development)
65
+ #### Option B: Static File Scanner (Recommended for Development)
66
66
 
67
- The generator automatically adds an accessibility watch command to your `Procfile.dev`:
67
+ The generator automatically adds a static accessibility scanner to your `Procfile.dev`:
68
68
 
69
69
  ```procfile
70
70
  web: bin/rails server
71
71
  css: bin/rails dartsass:watch
72
- a11y: while true; do bundle exec rspec spec/system/*_accessibility_spec.rb; sleep 30; done
72
+ a11y: bundle exec a11y_static_scanner
73
73
  ```
74
74
 
75
75
  Then run:
@@ -81,9 +81,31 @@ bin/dev
81
81
  This will:
82
82
  - Start your Rails server
83
83
  - Watch for CSS changes
84
- - **Automatically run accessibility checks every 30 seconds** on all `*_accessibility_spec.rb` files
84
+ - **Continuously scan view files for accessibility issues** - Only scans files that have changed since last scan
85
+ - Shows errors with exact file locations and line numbers
85
86
 
86
- The accessibility checker will continuously monitor your pages and alert you to any issues as you develop!
87
+ **How it works:**
88
+ - **First run**: Scans all view files to establish baseline
89
+ - **Subsequent runs**: Only scans files that have been modified
90
+ - **Continuous monitoring**: Watches for file changes and re-scans automatically
91
+ - **Smart change detection**: Uses file modification times to track changes
92
+ - **Fast feedback**: No browser needed - scans ERB templates directly
93
+
94
+ **Configuration** (in `config/accessibility.yml`):
95
+
96
+ ```yaml
97
+ static_scanner:
98
+ # Only scan files that have changed since last scan (true/false)
99
+ scan_changed_only: true
100
+
101
+ # Check interval in seconds when running continuously
102
+ check_interval: 3
103
+
104
+ # Force full scan on startup (true/false)
105
+ full_scan_on_startup: true
106
+ ```
107
+
108
+ The static scanner provides fast, continuous feedback as you develop, catching accessibility issues before you even run your tests!
87
109
 
88
110
  #### Option C: All Pages Spec with Smart Change Detection
89
111
 
@@ -226,6 +248,19 @@ Edit `config/accessibility.yml`:
226
248
  ```yaml
227
249
  wcag_level: AA
228
250
 
251
+ # Summary configuration
252
+ summary:
253
+ show_summary: true
254
+ errors_only: false
255
+ show_fixes: true
256
+ ignore_warnings: false # Set to true to hide warnings, only show errors
257
+
258
+ # Static scanner configuration
259
+ static_scanner:
260
+ scan_changed_only: true # Only scan changed files
261
+ check_interval: 3 # Seconds between file checks
262
+ full_scan_on_startup: true # Full scan on first run
263
+
229
264
  checks:
230
265
  form_labels: true
231
266
  image_alt_text: true
@@ -38,16 +38,24 @@ end
38
38
 
39
39
  The gem automatically runs comprehensive accessibility checks after each `visit` in system specs. You don't need to call `check_comprehensive_accessibility` manually unless you want to run checks at a specific point in your test.
40
40
 
41
- ### 3. Continuous Testing with Procfile (Optional)
41
+ ### 3. Continuous Testing with Static Scanner (Recommended)
42
42
 
43
- The generator automatically adds an accessibility watch command to your `Procfile.dev`:
43
+ The generator automatically adds a static accessibility scanner to your `Procfile.dev`:
44
44
 
45
- ```ruby
45
+ ```procfile
46
46
  web: bin/rails server
47
47
  css: bin/rails dartsass:watch
48
- a11y: while true; do bundle exec rspec spec/system/*_accessibility_spec.rb; sleep 30; done
48
+ a11y: bundle exec a11y_static_scanner
49
49
  ```
50
50
 
51
+ This provides fast, continuous feedback by scanning view files directly without browser rendering. The scanner:
52
+ - Scans all files on startup
53
+ - Only re-scans files that have changed
54
+ - Shows errors with exact file locations and line numbers
55
+ - Watches for file changes continuously
56
+
57
+ See the [Getting Started Guide](getting_started.md) for more details on static scanner configuration.
58
+
51
59
  This will run your accessibility specs every 30 seconds while you develop. The `all_pages_accessibility_spec.rb` uses smart change detection to only test pages when their related files change, making it fast and focused.
52
60
 
53
61
  ## Example Specs