[ 
https://issues.apache.org/jira/browse/GROOVY-12312?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18109556#comment-18109556
 ] 

ASF GitHub Bot commented on GROOVY-12312:
-----------------------------------------

codecov-commenter commented on PR #2841:
URL: https://github.com/apache/groovy/pull/2841#issuecomment-5465643957

   ## 
[Codecov](https://app.codecov.io/gh/apache/groovy/pull/2841?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 Report
   :x: Patch coverage is `84.28571%` with `11 lines` in your changes missing 
coverage. Please review.
   :white_check_mark: Project coverage is 70.6696%. Comparing base 
([`83ecaa0`](https://app.codecov.io/gh/apache/groovy/commit/83ecaa04ddaa2ff6f8ef2f90228c1ecdd82549d2?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache))
 to head 
([`ffd72ec`](https://app.codecov.io/gh/apache/groovy/commit/ffd72eca410223c823c325d7762d02a96c711939?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   
   | [Files with missing 
lines](https://app.codecov.io/gh/apache/groovy/pull/2841?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 | Patch % | Lines |
   |---|---|---|
   | 
[.../java/org/codehaus/groovy/control/ErrorFormat.java](https://app.codecov.io/gh/apache/groovy/pull/2841?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Fcontrol%2FErrorFormat.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L2NvbnRyb2wvRXJyb3JGb3JtYXQuamF2YQ==)
 | 86.0465% | [1 Missing and 5 partials :warning: 
](https://app.codecov.io/gh/apache/groovy/pull/2841?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 |
   | 
[...haus/groovy/control/messages/ExceptionMessage.java](https://app.codecov.io/gh/apache/groovy/pull/2841?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Fcontrol%2Fmessages%2FExceptionMessage.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L2NvbnRyb2wvbWVzc2FnZXMvRXhjZXB0aW9uTWVzc2FnZS5qYXZh)
 | 0.0000% | [3 Missing :warning: 
](https://app.codecov.io/gh/apache/groovy/pull/2841?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 |
   | 
[...codehaus/groovy/control/CompilerConfiguration.java](https://app.codecov.io/gh/apache/groovy/pull/2841?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Fcontrol%2FCompilerConfiguration.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L2NvbnRyb2wvQ29tcGlsZXJDb25maWd1cmF0aW9uLmphdmE=)
 | 83.3333% | [1 Missing :warning: 
](https://app.codecov.io/gh/apache/groovy/pull/2841?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 |
   | 
[...src/main/java/org/codehaus/groovy/ant/Groovyc.java](https://app.codecov.io/gh/apache/groovy/pull/2841?src=pr&el=tree&filepath=subprojects%2Fgroovy-ant%2Fsrc%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Fant%2FGroovyc.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VicHJvamVjdHMvZ3Jvb3Z5LWFudC9zcmMvbWFpbi9qYXZhL29yZy9jb2RlaGF1cy9ncm9vdnkvYW50L0dyb292eWMuamF2YQ==)
 | 83.3333% | [1 Missing :warning: 
](https://app.codecov.io/gh/apache/groovy/pull/2841?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 |
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   [![Impacted file tree 
graph](https://app.codecov.io/gh/apache/groovy/pull/2841/graphs/tree.svg?width=650&height=150&src=pr&token=1r45138NfQ&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)](https://app.codecov.io/gh/apache/groovy/pull/2841?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   
   ```diff
   @@                Coverage Diff                 @@
   ##               master      #2841        +/-   ##
   ==================================================
   + Coverage     70.6561%   70.6696%   +0.0135%     
   - Complexity      36541      36569        +28     
   ==================================================
     Files            1571       1573         +2     
     Lines          133997     134052        +55     
     Branches        24697      24701         +4     
   ==================================================
   + Hits            94677      94734        +57     
   + Misses          30803      30802         -1     
   + Partials         8517       8516         -1     
   ```
   
   | [Files with missing 
lines](https://app.codecov.io/gh/apache/groovy/pull/2841?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 | Coverage Δ | |
   |---|---|---|
   | 
[...va/org/codehaus/groovy/control/ErrorCollector.java](https://app.codecov.io/gh/apache/groovy/pull/2841?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Fcontrol%2FErrorCollector.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L2NvbnRyb2wvRXJyb3JDb2xsZWN0b3IuamF2YQ==)
 | `60.4938% <100.0000%> (-2.6641%)` | :arrow_down: |
   | 
[...g/codehaus/groovy/control/messages/Diagnostic.java](https://app.codecov.io/gh/apache/groovy/pull/2841?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Fcontrol%2Fmessages%2FDiagnostic.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L2NvbnRyb2wvbWVzc2FnZXMvRGlhZ25vc3RpYy5qYXZh)
 | `100.0000% <100.0000%> (ø)` | |
   | 
[...dehaus/groovy/control/messages/LocatedMessage.java](https://app.codecov.io/gh/apache/groovy/pull/2841?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Fcontrol%2Fmessages%2FLocatedMessage.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L2NvbnRyb2wvbWVzc2FnZXMvTG9jYXRlZE1lc3NhZ2UuamF2YQ==)
 | `61.9048% <100.0000%> (+1.9048%)` | :arrow_up: |
   | 
[.../org/codehaus/groovy/control/messages/Message.java](https://app.codecov.io/gh/apache/groovy/pull/2841?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Fcontrol%2Fmessages%2FMessage.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L2NvbnRyb2wvbWVzc2FnZXMvTWVzc2FnZS5qYXZh)
 | `83.3333% <100.0000%> (+16.6667%)` | :arrow_up: |
   | 
[...odehaus/groovy/control/messages/SimpleMessage.java](https://app.codecov.io/gh/apache/groovy/pull/2841?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Fcontrol%2Fmessages%2FSimpleMessage.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L2NvbnRyb2wvbWVzc2FnZXMvU2ltcGxlTWVzc2FnZS5qYXZh)
 | `100.0000% <100.0000%> (ø)` | |
   | 
[...us/groovy/control/messages/SyntaxErrorMessage.java](https://app.codecov.io/gh/apache/groovy/pull/2841?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Fcontrol%2Fmessages%2FSyntaxErrorMessage.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L2NvbnRyb2wvbWVzc2FnZXMvU3ludGF4RXJyb3JNZXNzYWdlLmphdmE=)
 | `100.0000% <100.0000%> (ø)` | |
   | 
[.../org/codehaus/groovy/tools/FileSystemCompiler.java](https://app.codecov.io/gh/apache/groovy/pull/2841?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Ftools%2FFileSystemCompiler.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L3Rvb2xzL0ZpbGVTeXN0ZW1Db21waWxlci5qYXZh)
 | `55.4502% <100.0000%> (+0.2121%)` | :arrow_up: |
   | 
[...codehaus/groovy/control/CompilerConfiguration.java](https://app.codecov.io/gh/apache/groovy/pull/2841?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Fcontrol%2FCompilerConfiguration.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L2NvbnRyb2wvQ29tcGlsZXJDb25maWd1cmF0aW9uLmphdmE=)
 | `75.3012% <83.3333%> (+0.1478%)` | :arrow_up: |
   | 
[...src/main/java/org/codehaus/groovy/ant/Groovyc.java](https://app.codecov.io/gh/apache/groovy/pull/2841?src=pr&el=tree&filepath=subprojects%2Fgroovy-ant%2Fsrc%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Fant%2FGroovyc.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VicHJvamVjdHMvZ3Jvb3Z5LWFudC9zcmMvbWFpbi9qYXZhL29yZy9jb2RlaGF1cy9ncm9vdnkvYW50L0dyb292eWMuamF2YQ==)
 | `52.7132% <83.3333%> (+0.7524%)` | :arrow_up: |
   | 
[...haus/groovy/control/messages/ExceptionMessage.java](https://app.codecov.io/gh/apache/groovy/pull/2841?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Fcontrol%2Fmessages%2FExceptionMessage.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L2NvbnRyb2wvbWVzc2FnZXMvRXhjZXB0aW9uTWVzc2FnZS5qYXZh)
 | `80.0000% <0.0000%> (-20.0000%)` | :arrow_down: |
   | ... and [1 
more](https://app.codecov.io/gh/apache/groovy/pull/2841?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 | |
   
   ... and [9 files with indirect coverage 
changes](https://app.codecov.io/gh/apache/groovy/pull/2841/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   </details>
   <details><summary> :rocket: New features to boost your workflow: </summary>
   
   - :snowflake: [Test 
Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, 
report on failures, and find test suite problems.
   - :package: [JS Bundle 
Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save 
yourself from yourself by tracking and limiting bundle sizes in JS merges.
   </details>




> Add a compact, machine-readable diagnostic output format to groovyc
> -------------------------------------------------------------------
>
>                 Key: GROOVY-12312
>                 URL: https://issues.apache.org/jira/browse/GROOVY-12312
>             Project: Groovy
>          Issue Type: Improvement
>            Reporter: Paul King
>            Priority: Major
>
> Groovy renders every diagnostic across four lines, in a shape that no common 
> tool can parse. There is no way to ask for anything terser or more structured.
> h2. The current format
> {noformat}
> X.groovy: 1: The method 'void m()' has invalid modifier final.
>  @ line 1, column 15.
>    interface X { final void m() }
>                  ^
> {noformat}
> Three problems, beyond sheer size:
> * *The location is split across two lines and partly repeated.* The line 
> number appears twice, and the column only in the second line, so neither line 
> alone identifies the position.
> * *There is no severity token.* Nothing in the text says {{error}} or 
> {{warning}}; severity is implied by which section of the output the message 
> falls under.
> * *The shape matches no established convention.* It is neither the gcc/javac 
> {{file:line: severity: message}} form nor anything else editors and CI 
> systems already understand, so consumers are left regex-guessing. Note that 
> Groovy's {{X.groovy: 1: ...}} (spaces around the number, no severity) is 
> close enough to javac's {{X.java:1: error: ...}} to invite a parser that then 
> quietly mismatches.
> Size, measured on a source with 14 static type checking errors: *73 lines / 
> 3581 bytes*, roughly 256 bytes per diagnostic. For a human reading a terminal 
> the snippet and caret earn their place. For a build log, a CI annotation, an 
> editor problem matcher, or an LLM-based tool that already has the file open, 
> they are pure overhead.
> h2. Proposal
> Add an error format setting, selecting how diagnostics are rendered:
> * {{--error-format=<format>}} on the {{groovyc}} command line
> * {{errorFormat}} on {{CompilerConfiguration}}, so compiler configuration 
> scripts (and therefore Gradle, via {{groovyOptions.configurationScript}}) can 
> reach it
> * a matching attribute on the Ant {{<groovyc>}} task
> Two formats to begin with, with {{full}} the default so existing output is 
> unchanged:
> || Format || Output ||
> | {{full}} | the current four-line form, unchanged |
> | {{short}} | {{X.groovy:1:15: error: The method 'void m()' has invalid 
> modifier final.}} |
> A named setting rather than a boolean leaves room for a {{json}} format later 
> without adding a second option.
> h2. On naming
> Deliberately *not* {{-Xdiags:compact}}, despite the surface similarity to 
> javac. javac's {{-Xdiags:\{compact,verbose\}}} selects how much explanation 
> is given for method-resolution failures, and *both* modes still print the 
> source line and caret:
> {noformat}
> # javac -Xdiags:compact (the default)
> Dg.java:3: error: incompatible types: int cannot be converted to String
>     void go() { m(1); }
>                   ^
> {noformat}
> Reusing that name would mislead anyone who knows javac. javac's actual 
> machine-readable switch is {{-XDrawDiagnostics}}, an internal option for its 
> own test harness and not a user-facing precedent.
> {{--error-format}} follows rustc, whose {{--error-format=short}} emits 
> exactly the one-line form proposed here (and whose {{json}} value is the 
> room-to-grow precedent). TypeScript's {{--pretty false}} is the same idea 
> under a different name. The kebab-case spelling matches groovyc's recent 
> options ({{--enable-preview}}, {{--type-checked}}, {{--compile-static}}).
> h2. Implementation notes
> Rendering runs through {{ErrorCollector.write(PrintWriter, Janitor)}}, which 
> delegates to {{Message.write(PrintWriter, Janitor)}} per message. For syntax 
> errors, {{SyntaxErrorMessage.write}} prints {{name + ": " + line + ": " + 
> getCause().getMessage()}} followed by the snippet from 
> {{SourceUnit.getSample(line, column, janitor)}}, which appends the caret.
> The pieces for the short form are already separately available, so it 
> composes without string surgery:
> * {{SyntaxException.getOriginalMessage()}} returns the bare text, while 
> {{getMessage()}} is what appends {{" @ line N, column M."}}
> * {{getStartLine()}} / {{getStartColumn()}} give the position
> * {{SourceUnit.getName()}} gives the file
> The other {{Message}} subclasses ({{SimpleMessage}}, {{LocatedMessage}}, 
> {{ExceptionMessage}}, {{WarningMessage}}) each need a short rendering too; 
> those without a position should degrade to {{file: error: message}} rather 
> than inventing one.
> h2. Open questions
> * Should warnings follow the same format? They share the {{Message.write}} 
> path, so the natural answer is yes.
> * Should {{json}} be included from the start, or only the format name 
> reserved?
> * Should the default ever change? Keeping {{full}} indefinitely is the 
> conservative choice; a tool that wants terse output can ask for it.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to