[ 
https://issues.apache.org/jira/browse/SPARK-59752?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

ASF GitHub Bot updated SPARK-59752:
-----------------------------------
    Labels: pull-request-available  (was: )

> dev/scalastyle drops GitHub annotations for scalastyle checkers that report a 
> column (e.g. nonascii)
> ----------------------------------------------------------------------------------------------------
>
>                 Key: SPARK-59752
>                 URL: https://issues.apache.org/jira/browse/SPARK-59752
>             Project: Spark
>          Issue Type: Bug
>          Components: Project Infra
>    Affects Versions: 4.4.0
>            Reporter: Rajesh Vakkalagadda
>            Priority: Minor
>              Labels: pull-request-available
>
> dev/scalastyle emits inline GitHub Actions `::error` annotations for 
> scalastyle violations by
>   matching two output shapes from `build/sbt scalastyle test:scalastyle`:
>     (a) error file=<path> message=<text> line=<n> [column=<n>]
>     (b) [error] <path>:<line>: <message>
>   Format (b)'s regex requires whitespace immediately after `:<line>:`:
>   
>     ^\[error\][[:space:]]+(/[^:[:space:]]+):([0-9]+):[[:space:]]+(.+)$
>   The surrounding comment explains this is deliberate: the absence of a 
> `:<col>:` is what
>   distinguishes an sbt-logger-reported scalastyle violation from a regular 
> Scala compiler error of
>   shape `[error] <path>:<line>:<col>: <msg>`. That assumption doesn't hold 
> for every checker,
>   though -- the `nonascii` checker's sbt-logger output includes a column:
>     [error] .../StringExpressionsSuite.scala:1065:17: nonascii.message
>   This line matches neither regex: format (a) doesn't match the `[error] 
> <path>:...` shape at all,
>   and format (b) fails because `17:` follows the line number instead of 
> whitespace. So no
>   annotation is emitted for it. The violation still fails the build correctly 
> (it's counted in
>   $ERRORS and printed to the raw job log), but it doesn't get the inline 
> "Files changed" annotation
>   this script's own comment says it exists to provide -- for this checker, a 
> contributor is back to
>   downloading the full job log to find the violation, the exact problem this 
> code was written to
>   avoid.
>   
>   Reproduce: any scalastyle failure from a checker that reports a column 
> through the sbt-logger
>   path (nonascii is one; there may be others) run through dev/scalastyle's 
> GITHUB_ACTIONS
>   annotation block. 
>   
>   Fix direction: extend format (b)'s regex (or add a third branch) to also 
> match
>   `[error] <path>:<line>:<col>: <message>` and pass the line (and optionally 
> the column) through to
>   emit_annotation, without misclassifying it as a Scala compiler error.



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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to