-
-
Notifications
You must be signed in to change notification settings - Fork 0
feat: add diagnostic hints and suggestions system #362
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
RAprogramm
wants to merge
17
commits into
main
Choose a base branch
from
feature/diagnostics
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
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
Adds rich diagnostic capabilities inspired by compiler diagnostics: - Hint: contextual advice explaining errors - Suggestion: actionable fixes with optional commands - DocLink: documentation URLs - DiagnosticVisibility: dev/staging/prod filtering - Colored output in Local mode - Zero-cost when unused (Option<Box<Diagnostics>>)
Add a CLI tool to help Rust learners understand compiler errors: - `masterror check` - runs cargo check with friendly explanations - `masterror explain E0382` - explains specific error codes - `masterror list` - lists known error codes by category Features: - Multi-language support (en, ru) - Colored terminal output with NO_COLOR support - Knowledge base for common errors (E0382, E0308, E0502, E0499, E0106, E0597) - Direct links to official Rust documentation
Example project with intentional Rust errors (E0382, E0502, E0499) to test masterror-cli functionality. Excluded from workspace to avoid CI failures on intentional errors.
- Refactor into modules: commands, knowledge, locale, output, parser, sections - Add multi-language support (en, ru, ko) as cargo features - Add display section toggles (why, fix, link, translation) as features - Add show-original feature to optionally display compiler output - Translate full compiler error messages for non-English locales - Add pre-commit checks: actionlint, no_std compatibility
- Add cargo-masterror binary for `cargo masterror` usage - Add PKGBUILD and .SRCINFO for AUR distribution
- Add errors module with 6 categories: Ownership, Borrowing, Lifetimes, Types, Traits, Resolution - Add raprogramm module with 15 best practices (RA001-RA015) from RustManifest - Add practice command to list and show best practices - Extend explain command to handle both E* and RA* codes - Remove legacy knowledge.rs, use LocalizedText for i18n - Unify output formatting for errors and practices - Expand cli-test-errors example with more error cases
- Remove masterror-cli from workspace - Remove examples/cli-test-errors - Add link to https://github.com/RAprogramm/masterror-cli in README
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
- masterror-knowledge: compiler error explanations database - 31 rustc errors (E0xxx) with translations (en/ru/ko) - 15 best practices (RA001-RA015) - i18n system with zero-allocation static strings - masterror-cli: cargo subcommand for error explanations - `cargo masterror check` - check with explanations - `masterror explain E0502` - explain specific error - `masterror init` - interactive setup with first-run detection - Layered config: CLI args > env > .masterror.toml > global - Feature `knowledge` in masterror re-exports the knowledge crate
- Add changes job with dorny/paths-filter for file change detection - Compute dependency graph: template→derive→masterror, knowledge→cli - Skip jobs when no relevant changes detected - Add masterror-knowledge and masterror-cli to CRATES publish list - Update release workflow to use $CRATES variable - Fix no-std tests to only check masterror crate - Add Step Summary with change detection table - Fix rustdoc warning for private InlineVec link
- constructors.rs: new, with, bare - modifiers.rs: with_code, with_retry_after_secs, with_www_authenticate, redactable - metadata.rs: with_field, with_fields, redact_field, with_metadata - context.rs: with_context, with_source, with_source_arc, with_backtrace - details.rs: with_details_json, with_details, with_details_text - diagnostics.rs: with_hint, with_suggestion, with_docs, with_related_code - tests.rs: comprehensive tests for all builder methods (42 tests) Also fix doctest in masterror-knowledge using correct crate name
- mod.rs: module exports and public interface - mode.rs: DisplayMode enum and detection - helpers.rs: write_json_escaped, write_metadata_value - prod.rs: production JSON formatting - local.rs: human-readable local/dev formatting - staging.rs: staging JSON with context - tests.rs: 49 comprehensive display tests
- mod.rs: module documentation and style re-export - std_style.rs: color styling with owo_colors (std feature) - nostd_style.rs: passthrough styling for no-std - tests.rs: 23 comprehensive tests for both variants
- Add tests for hints, suggestions, doc links, related codes in local format - Improve local.rs coverage from 46% to 92% - Note: env-based mode detection tests omitted due to #![deny(unsafe_code)]
- Add README.md for masterror-knowledge with learning curve image - Add masterror-knowledge to workspace crates table - Update masterror-cli description with install instructions - Add CLI links to Russian and Korean READMEs
Add comprehensive tests for: - inline_vec: all storage variants, iterators, mutations - metadata: field types, redaction, serialization - app_code: hash, equality, parsing edge cases - kind: all variants for http_status and label - result_ext: context preservation, error wrapping - response/problem_json: metadata sanitization, redaction
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.
No description provided.