Skip to content

Conversation

@CuteChuanChuan
Copy link
Contributor

@CuteChuanChuan CuteChuanChuan commented Nov 8, 2025

Which issue does this PR close?

Rationale for this change

This PR adds CI enforcement to ensure all code examples in documentation comments are properly formatted to maintain consistent code formatting, including examples in doc comments.

What changes are included in this PR?

This PR adds a new CI check in the check-fmt job that:

  1. Installs the nightly Rust toolchain
  2. Runs cargo +nightly fmt --all -- --check --config format_code_in_doc_comments=true

Note: format_code_in_doc_comments is currently an unstable feature.

Are these changes tested?

The command is tested locally with:

Are there any user-facing changes?

No user-facing changes.

@github-actions github-actions bot added the development-process Related to development process of DataFusion label Nov 8, 2025
@CuteChuanChuan CuteChuanChuan marked this pull request as draft November 8, 2025 05:36
@CuteChuanChuan CuteChuanChuan changed the title ci: add check for doc comment formatting [WIP] ci: add check for doc comment formatting Nov 8, 2025
@CuteChuanChuan CuteChuanChuan force-pushed the raymond/16915-format-ci branch from cadd5fb to 6f7c4fa Compare November 11, 2025 14:03
@github-actions github-actions bot added documentation Improvements or additions to documentation sql SQL Planner logical-expr Logical plan and expressions physical-expr Changes to the physical-expr crates optimizer Optimizer rules core Core DataFusion crate sqllogictest SQL Logic Tests (.slt) substrait Changes to the substrait crate catalog Related to the catalog crate common Related to common crate execution Related to the execution crate proto Related to proto crate functions Changes to functions implementation datasource Changes to the datasource crate ffi Changes to the ffi crate physical-plan Changes to the physical-plan crate spark labels Dec 10, 2025
@CuteChuanChuan CuteChuanChuan force-pushed the raymond/16915-format-ci branch from 305c31c to 2c1d0d6 Compare December 10, 2025 14:08
@github-actions github-actions bot removed documentation Improvements or additions to documentation sqllogictest SQL Logic Tests (.slt) substrait Changes to the substrait crate catalog Related to the catalog crate execution Related to the execution crate proto Related to proto crate functions Changes to functions implementation datasource Changes to the datasource crate labels Dec 10, 2025
@github-actions github-actions bot removed the ffi Changes to the ffi crate label Dec 10, 2025
@CuteChuanChuan CuteChuanChuan marked this pull request as ready for review December 10, 2025 17:31
@CuteChuanChuan CuteChuanChuan force-pushed the raymond/16915-format-ci branch from 2c1d0d6 to 0ed928f Compare December 10, 2025 17:31
@CuteChuanChuan CuteChuanChuan changed the title [WIP] ci: add check for doc comment formatting ci: add check for doc comment formatting Dec 10, 2025
@CuteChuanChuan
Copy link
Contributor Author

Hi @alamb ,

Following the discussion in PR #16916, I've prepared this PR to enable CI enforcement for doc comment formatting.

As you mentioned, we need to use the same version of cargo fmt to avoid conflicts. Since
format_code_in_doc_comments is only available in nightly, this PR uses cargo +nightly fmt consistently in CI.

This PR contains two commits:

  1. CI change: Install nightly toolchain and use cargo +nightly fmt --all -- --check --config format_code_in_doc_comments=true
  2. Format fixes: Apply nightly rustfmt formatting to all existing doc comment code
    examples

PTAL when you have chance. Thank you!

Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @CuteChuanChuan -- this looks really close. I think we just need to update where the command is run and this will be good to go from my perspective

Thank you for sticking with it

- Install nightly Rust toolchain with rustfmt component
- Use cargo +nightly fmt to check both regular code and doc comments
- Replace stable fmt check with nightly to avoid formatting conflicts
@CuteChuanChuan CuteChuanChuan force-pushed the raymond/16915-format-ci branch from 481a43d to bb6cfcf Compare December 20, 2025 13:33
@github-actions github-actions bot added proto Related to proto crate datasource Changes to the datasource crate labels Dec 20, 2025
@CuteChuanChuan CuteChuanChuan force-pushed the raymond/16915-format-ci branch from bb6cfcf to 3d932e2 Compare December 20, 2025 13:39
@CuteChuanChuan CuteChuanChuan force-pushed the raymond/16915-format-ci branch from 3d932e2 to dfdd028 Compare December 20, 2025 13:42
@CuteChuanChuan
Copy link
Contributor Author

Hi @alamb ,

Sorry for the late response. I've moved the nightly fmt command to ci/scripts/rust_fmt.sh as suggested.
PTAL when you have chances, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

common Related to common crate core Core DataFusion crate datasource Changes to the datasource crate development-process Related to development process of DataFusion logical-expr Logical plan and expressions optimizer Optimizer rules physical-expr Changes to the physical-expr crates physical-plan Changes to the physical-plan crate proto Related to proto crate spark sql SQL Planner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Chore: format documentation examples

2 participants