vrjdev opened a new pull request, #59003:
URL: https://github.com/apache/spark/pull/59003

   ### What changes were proposed in this pull request?
   `dev/scalastyle` emits inline GitHub `::error` annotations for scalastyle 
violations reported through sbt's logger, matching lines of shape `[error] 
<path>:<line>: <message>`. The regex required whitespace immediately after 
`:<line>:`, on the assumption that the absence of a `:<col>:` distinguishes it 
from a genuine Scala compiler error of shape `[error] <path>:<line>:<col>: 
<msg>`. That assumption doesn't hold for every scalastyle checker -- the 
`nonascii` checker's sbt-logger output includes a column, e.g. `[error] 
.../StringExpressionsSuite.scala:1065:17: nonascii.message`, which matched 
neither regex branch and so silently got no annotation.
   
   This PR makes the column optional in both regex branches (the 
native-console-writer branch already captured an optional column but discarded 
it) and threads it through to GitHub's `::error ...,col=<n>` annotation 
parameter when present.
   
   A genuine Scala compiler error can't reach this code path: 
`project/SparkBuild.scala`'s `enableScalaStyle`/`cachedScalaStyle` deliberately 
does not attach style checking to `(Compile / compile)`, precisely so a broken 
compile elsewhere can't cascade into the style job (and vice versa) -- see the 
comment above `enableScalaStyle`.
   
   ### Why are the changes needed?
   Without this, a scalastyle violation from a checker that reports a column 
(e.g. `nonascii`) still correctly fails the build, but gets no inline "Files 
changed" annotation -- exactly the problem this script's annotation logic 
exists to prevent (per its own comment: "Without this, a violation cascades 
into ~7 red CI checks... forcing the user to download a full job log to find 
the actual violation"). A contributor hitting this checker has to download the 
full job log to find the violation.
   
   ### Does this PR introduce _any_ user-facing change?
   No. This only affects GitHub Actions CI annotations for `dev/scalastyle`, a 
contributor-facing tooling script; it doesn't change Spark's behavior, build 
output, or the pass/fail result of any check.
   
   ### How was this patch tested?
   - Verified the regex against four synthetic cases (both formats, with and 
without a column), confirming the fix and no behavior change for the two cases 
that already worked.
   - End-to-end: temporarily introduced a real non-ASCII character outside an 
existing `scalastyle:off` block in `StringExpressionsSuite.scala`, ran 
`dev/scalastyle` with `GITHUB_ACTIONS=true`, confirmed the violation is now 
annotated with file/line/column (`::error 
file=...,line=60,col=3,title=Scalastyle::nonascii.message`) instead of being 
silently dropped, then reverted the temporary change.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   Generated-by: Claude Code claude-sonnet-5
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to