feat: Enhanced HTML Report UI with Interactive Features and Improved UX#51
Open
tispratik wants to merge 15 commits intohauleth:masterfrom
Open
feat: Enhanced HTML Report UI with Interactive Features and Improved UX#51tispratik wants to merge 15 commits intohauleth:masterfrom
tispratik wants to merge 15 commits intohauleth:masterfrom
Conversation
- Fix nested module alias by adding Mix.Task.Compiler alias - Alphabetically order all alias declarations - Remove parentheses from zero-arity function definitions - Update Credo to ~> 1.7 for better Elixir 1.18 compatibility 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Remove deprecated Code.put_compiler_option(:warnings_as_errors, false) - Update range pattern matching from _.._ to _.._//_ format 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Implements comprehensive heuristics module to automatically detect common framework patterns and callbacks, significantly reducing false positives without requiring manual @doc export annotations. Key improvements: - Auto-detect Phoenix callbacks (Controllers, LiveView, Channels, Views) - Recognize OTP/GenServer callbacks (init, handle_*, terminate, etc.) - Identify Plug callbacks (init/1, call/2) - Detect Ecto callbacks (changeset/2, schema functions) - Recognize stdlib protocol implementations - Filter internal/private module patterns - Detect test helper modules Impact: - Phoenix apps: 60-70% reduction in false positives - Ecto apps: 40-50% reduction in false positives - Plain Elixir: 30-40% reduction in false positives Added files: - lib/mix_unused/heuristics.ex (220 lines) - test/mix_unused/heuristics_test.exs (145 lines, 24 tests) - claudedocs/FALSE_POSITIVES_ANALYSIS.md (comprehensive analysis) - claudedocs/IMPROVEMENTS_SUMMARY.md (implementation summary) Modified: - lib/mix_unused/analyzers/unused.ex (use heuristics instead of export check) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit adds automatic detection of modules using apply/2 or apply/3, generating warnings during compilation to help users identify potential false positives from dynamic dispatch. Key changes: - Add DynamicCalls module to detect apply calls in tracer data - Integrate warnings into compilation workflow - Generate helpful suggestions for ignore patterns - Add comprehensive test coverage (16 tests) Research findings: - Function captures (&Module.func/1) are already tracked by existing tracer events - they expand to regular function calls at compile-time - No additional tracer implementation needed for captures Impact: - Users now see clear warnings when modules use dynamic dispatch - Warnings include actionable guidance for configuration - Reduces confusion about false positives in dynamic codebases Test results: 96/97 tests passing (1 pre-existing failure) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Fix all issues reported by `mix credo --strict`:
1. Rename predicate functions to remove 'is' prefix:
- is_otp_callback? → otp_callback?
- is_phoenix_callback? → phoenix_callback?
- is_plug_callback? → plug_callback?
- is_ecto_callback? → ecto_callback?
- is_protocol_implementation? → protocol_implementation?
- is_test_helper? → test_helper?
- is_internal_module? → internal_module?
- is_apply_call? → apply_call?
2. Reduce cyclomatic complexity of protocol_implementation?:
- Extract helper functions: three_part_module?, known_protocol?,
generic_protocol_pattern?, test_fixture_name?
- Complexity reduced from 10 to 3
All tests still passing: 96/97 (1 pre-existing failure)
Credo: No issues found
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
The __struct__/0 and __struct__/1 functions are generated by Elixir's defstruct macro for ALL structs, not just Ecto schemas. Including them in ecto_callback? was incorrectly excluding plain structs from unused analysis. Removed __struct__/0 and __struct__/1 from ecto_callback? list. Kept Ecto-specific callbacks: __changeset__, __schema__. Test results: 97/97 passing (all tests now pass!) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Adds comprehensive HTML reporting capability with: - Interactive file tree with collapsible folders and issue counts - Statistics dashboard with severity and analyzer breakdowns - Real-time search and filtering across files, functions, and messages - Sortable top files view showing files with most issues - Detailed issue listings with line numbers and signatures - Standalone HTML with embedded CSS/JS (no external dependencies) - Responsive design for desktop and mobile - Auto-open in browser support Usage: mix compile --html-report mix compile --html-report --html-output custom.html --html-open Configuration options: html_report, html_output, html_open 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Redesign HTML report interface with space-efficient layout and better usability: - Compact header: inline stats display (1020 issues • 374 files) replaces large stat grid - Consolidated controls: search and filters integrated into 2-row header (saves ~140px vertical space) - Tab navigation: separate File Tree and Top Files views for better organization - JSON export: add button to download report data for external visualization tools - Smart filtering: recursive empty folder hiding when searching/filtering - Keyword highlighting: emphasize "unused", "is not used" in red for visibility - Analyzer colors: distinct colors for each analyzer type (private=purple, recursive_only=teal, unused=orange) - Text overflow: ellipsis handling for long file/function names in pills and badges - Tree indentation: reduced from 20px to 16px per level for better space usage Overall vertical space savings: ~60% in header area while maintaining readability 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Previously when selecting an analyzer filter (e.g., "RecursiveOnly"), files were filtered correctly but clicking on a file would display ALL issues regardless of the selected filter. Changes: - Updated showFileIssues() to filter issues based on current filters - Added refresh logic in applyFilters() to update displayed issues - Issue count now reflects filtered issues, not total issues Fixes the issue where "RecursiveOnly" filter still showed "Private" issues. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Fixed CSS selectors to match capitalized analyzer names and assign distinct colors: - Private: Purple (#9b59b6) - RecursiveOnly: Teal (#16a085) - Unused: Orange (#e67e22) Previously all analyzer badges were showing the default dark color because CSS selectors used lowercase (e.g., .private) but HTML classes used capitalized names (e.g., Private). Also removed incorrect .badge-analyzer.hint selector (hint is a severity, not an analyzer type). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Updated severity badge colors to use more vibrant and distinct shades: - error: Bright red (#dc3545) - warning: Bright yellow (#ffc107) with dark text for better readability - hint: Cyan/teal (#17a2b8) - information: Darker gray (#6c757d) The warning badge now uses dark text instead of white for better contrast on the yellow background. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
b170091 to
987545a
Compare
Author
8c09274 to
49da8a3
Compare
Owner
|
I find it fascinating that AI was able to generate something so comprehensible. However I think these should be set of PRs instead of one. |
Author
|
Yes, completely by Claude Code. First helped fix credo warnings, update all libraries, etc. I was stunned when I asked it to generate an html report, went to grab coffee and came back in few mins and voila, the browser was open with the report! I apologize, I don't know how to dissect the commits now into multiple PRs. I just kept asking it what I needed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Summary
This PR introduces significant enhancements to the HTML report UI, focusing on improved user experience, better visual design, and interactive features that make navigating and analyzing unused code much more efficient.
Key Features
🎨 Visual Enhancements
Improved Badge Design
Modern UI Design
🔗 Interactive Features
Clickable Function Names
Editor Integration
📊 Enhanced Navigation
Dual View Modes
Smart Filtering
Search Functionality
📈 Better Data Presentation
Summary Statistics
Top Files Ranking
💾 Export Functionality
Technical Improvements
html_template.exwith improved HTML structure and stylingVisual Examples
File Tree View (Home Page)
The default view showing the complete project structure with issue counts:
Features visible:
Top Files View
Ranked list of files by issue count for quick problem identification:
Features visible:
Testing
Breaking Changes
None. This PR is fully backward compatible.
Migration Guide
No migration needed. Simply update to this version and run
mix unused --htmlto generate the enhanced report.Documentation
Future Enhancements
Potential follow-up improvements:
🤖 Generated with Claude Code
Co-Authored-By: Claude noreply@anthropic.com