You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "AshishGhodvinde (via GitHub)" <gi...@apache.org> on 2026/09/05 18:28:29 UTC

[PR] fix: disable conflicting IfBraceChecker [datafusion-comet]

AshishGhodvinde opened a new pull request, #5721:
URL: https://github.com/apache/datafusion-comet/pull/5721

   ## Which issue does this PR close?
   
   Closes #5711
   
   ## Rationale for this change
   
   `make format` uses Scalafmt, which can wrap long brace-less `if`/`else` expressions across multiple lines without adding braces. Scalastyle's `IfBraceChecker` then rejects the formatted code.
   
   Since Scalafmt is the canonical formatter and cannot automatically add braces, the `IfBraceChecker` rule can conflict with the formatter and leave code that fails Scalastyle after formatting.
   
   ## What changes are included in this PR?
   
   - Disabled `IfBraceChecker` in `dev/scalastyle-config.xml`.
   - No Scala source files were changed.
   
   ## How are these changes tested?
   
   - Ran Scalastyle directly against the Spark Scala sources:
     `mvnw.cmd scalastyle:check -pl spark -Dscalastyle.failOnViolation=true -Dscalastyle.verbose=true`
   - Scalastyle scanned 153 Scala source files and reported no `IfBraceChecker` violations.
   - The check still reports an unrelated existing `Class.forName` violation in `spark/src/main/scala/org/apache/spark/sql/comet/util/Utils.scala:131`.
   - A full `test-compile` could not complete locally because of unrelated missing generated protobuf/dependency classes.


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] fix: disable conflicting IfBraceChecker [datafusion-comet]

Posted by "AshishGhodvinde (via GitHub)" <gi...@apache.org>.
AshishGhodvinde commented on PR #5721:
URL: https://github.com/apache/datafusion-comet/pull/5721#issuecomment-5554027775

   Heyy, I've completed the implementation for this issue and opened this PR with the proposed fix.
   
   The change is limited to disabling the conflicting `IfBraceChecker` in `dev/scalastyle-config.xml`. The PR is ready for review, and the CI workflows are currently awaiting maintainer approval.
   
   Please let me know if any changes are needed. Thankss!


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] fix: disable conflicting IfBraceChecker [datafusion-comet]

Posted by "github-actions[bot] (via GitHub) via github" <gi...@datafusion.apache.org>.
github-actions[bot] closed pull request #5721: fix: disable conflicting IfBraceChecker
URL: https://github.com/apache/datafusion-comet/pull/5721


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] fix: disable conflicting IfBraceChecker [datafusion-comet]

Posted by "AshishGhodvinde (via GitHub)" <gi...@apache.org>.
AshishGhodvinde commented on PR #5721:
URL: https://github.com/apache/datafusion-comet/pull/5721#issuecomment-5557035125

   Thanks for the suggestion! I looked into `rewrite.insertBraces.minLines` using the pinned Scalafmt 3.6.1 version.
   
   I tested both `minLines = 1` and `minLines = 2` with `IfBraceChecker` still enabled.
   
   ### What I found
   
   - **`minLines = 1`** does fix the `IfBraceChecker` violations, but it causes quite a lot of unrelated formatting changes: **295 Scala files** were modified, with around **6,158 lines of churn**, and approximately **565 single-expression method bodies** gained braces.
   - **`minLines = 2`** reduces the churn somewhat (**249 files**, around **4,166 lines**), but it still leaves **4 `IfBraceChecker` violations** when scanning all relevant main, test, and Spark-version source directories.
   
   The `minLines = 2` violations are cases where Scalafmt wraps a single-statement `if`/`else` branch across a line break but doesn't insert braces.
   
   I also found that my initial `minLines = 2` check was incomplete because the default Scalastyle Maven configuration doesn't cover all of the repository's test and Spark-version source directories. I reran the check explicitly across those directories and reproduced the 4 violations.
   
   So after testing this more broadly, neither `minLines = 1` nor `minLines = 2` seems like a good fit without introducing significant formatting churn or, in the case of `minLines = 2`, still leaving the original issue unresolved.
   
   I haven't changed the PR implementation yet. For now, the `IfBraceChecker` change remains as-is.


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] fix: disable conflicting IfBraceChecker [datafusion-comet]

Posted by "github-actions[bot] (via GitHub) via github" <gi...@datafusion.apache.org>.
github-actions[bot] commented on PR #5721:
URL: https://github.com/apache/datafusion-comet/pull/5721#issuecomment-6715685522

   Thank you for your contribution. Unfortunately, this pull request is stale because it has been open 60 days with no activity. Please remove the stale label or comment or this will be closed in 7 days.


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org