-
Notifications
You must be signed in to change notification settings - Fork 62
feat: registery based diagnostician #1077
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
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1077 +/- ##
==========================================
- Coverage 95.74% 95.64% -0.11%
==========================================
Files 147 148 +1
Lines 43286 43455 +169
==========================================
+ Hits 41446 41561 +115
- Misses 1840 1894 +54 ☔ View full report in Codecov by Sentry. |
c283fd9
to
2b456f2
Compare
0b98d82
to
5217d45
Compare
5217d45
to
4131ab9
Compare
An Diagnostic registry is now responsible for adding a severity instead of the diagnostic itself. The registry is the default diagnostics assessor. Diagnostics no longer have an own severity field as a result. Cargo fmt
Cargo fmt
Added the option to load a diagnostics configuration Added tests for the configuration Added the basic api to print the configuration
A new parameter (`--error-config`) can now be used to include a json file with the default behaviour for errors
65fbe95
to
16a5505
Compare
Error messages now show the error code in the report At the end of the compilation a hint is shown to use the new explain flag for more info
The error configuration can now be printe using `plc config diagnostics` Added documentation about the new commands to the book
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
overall I like it,
what I dont like is that creating a diagnostic and especially assigning the error code looks like it is very easy to pick a wrong string or a string that does not exist. It also looks like harder to see if we no longer use a certain error. It is also not really streight forward where to look for the details behind E017? btw. is E17 == E017? i guess not since this is a string?
Does the E stand for error?
Diagnostic::new("A class cannot have an implementation")
.with_error_code("E017"). // <-- this string
.with_location(implementation.location.to_owned())
book/src/using_rusty.md
Outdated
## Error Description | ||
|
||
Errors produced by `plc` can be explained using the `plc explain <ErrorCode>` command. | ||
Error codes are usually provided in the diagnostic report |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Error codes are usually provided in the diagnostic report | |
Error codes are usually provided in the diagnostic report. |
..._external_files__calling_external_file_function_without_including_file_results_in_error.snap
Show resolved
Hide resolved
Yes, strings are a problem, I wanted to still find a solution for it, but I felt it is still better than the enum as it allows multiple locations to define errors. |
Im not insisting, but I'd like to have a discussion. Next time anybody creates a new diagnostics, what is the best way to find out, if there is already an error-number for it? auto-importing all of them in the book would be an option :-/ |
3388f80
to
364fcbd
Compare
I would really like to know if we're doing something wrong. The merges appear as new changes in the review and its really confusing that suddenly I see a ton of unrelated changes - or I need to look carefully if they are new and unrelated (by a merge). |
Not sure, but I think if you chose to see changes since your last review the merges would appear as if they came from this commit. If you see the entire history they will blend in |
is this wrong? what else would I do? I just wonder if there is a smarter whay of doing this? big project should have this problem every day? maybe they wait for the merge until it is reviewed? idk |
A Diagnostic registry is now responsible for adding a severity instead
of the diagnostic itself. The registry is the default diagnostics
assessor. Diagnostics no longer have an own severity field as a result.
The registry can be configured using the
--error-config
flag where error severity can be adjustedThe current project registry can be printed out using
plc config diagnostics
Diagnostics now also show the error number in the message as well as a hint on how to get more information about the error.
The
explain
subcommand can be used to read information about each error code.