Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ignored tests for formatting #124704

Merged
merged 1 commit into from
May 4, 2024
Merged

Conversation

Urgau
Copy link
Member

@Urgau Urgau commented May 4, 2024

This PR fixes the ignored rules in rustfmt.toml that were changed in #124613 to allow formatting rmake.rs but ended up allowing formatting every Rust files in tests/.

The fix is a bit involved since we need to workaround a .gitignore pattern limitation:

An optional prefix "!" which negates the pattern; any matching file excluded by a previous pattern will become included again. It is not possible to re-include a file if a parent directory of that file is excluded. Git doesn’t list excluded directories for performance reasons, so any patterns on contained files have no effect, no matter where they are defined.

Workaround using https://stackoverflow.com/a/5534865

I tested the fix by changing the formatting in an rmake.rs and UI test, and verifying that only the rmake.rs files were formatted.

Fixes #124613 (comment)
cc @GuillaumeGomez
r? @onur-ozkan

@rustbot rustbot added A-meta Area: Issues & PRs about the rust-lang/rust repository itself S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 4, 2024
@GuillaumeGomez
Copy link
Member

It's super weird that x.py fmt was not formatting any test file when I tested my PR locally. Well, at least it makes more sense now. Thanks!

@bors r+ p=1

@bors
Copy link
Contributor

bors commented May 4, 2024

📌 Commit f43e3e2 has been approved by GuillaumeGomez

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 4, 2024
@Urgau
Copy link
Member Author

Urgau commented May 4, 2024

It's super weird that x.py fmt was not formatting any test file when I tested my PR locally. Well, at least it makes more sense now. Thanks!

x.py fmt only allows formatting files and have been changed, so if no files have been changed rustfmt will not be run on them, even if it would happily re-format them.

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request May 4, 2024
…llaumeGomez

Fix ignored tests for formatting

This PR fixes the ignored rules in `rustfmt.toml` that were changed in rust-lang#124613 to allow formatting `rmake.rs` but ended up allowing formatting every Rust files in `tests/`.

The fix is a bit involved since we need to workaround a [`.gitignore` pattern limitation](https://git-scm.com/docs/gitignore#_pattern_format):
> An optional prefix "!" which negates the pattern; any matching file excluded by a previous pattern will become included again. It is not possible to re-include a file if a parent directory of that file is excluded. Git doesn’t list excluded directories for performance reasons, so any patterns on contained files have no effect, no matter where they are defined.

Workaround using https://stackoverflow.com/a/5534865

I tested the fix by changing the formatting in an `rmake.rs` and UI test, and verifying that only the `rmake.rs` files were formatted.

Fixes rust-lang#124613 (comment)
cc `@GuillaumeGomez`
r? `@onur-ozkan`
bors added a commit to rust-lang-ci/rust that referenced this pull request May 4, 2024
…iaskrgr

Rollup of 5 pull requests

Successful merges:

 - rust-lang#122441 (Improve several `Read` implementations)
 - rust-lang#124584 (Various improvements to entrypoint code)
 - rust-lang#124699 (Use `unchecked_sub` in `split_at`)
 - rust-lang#124704 (Fix ignored tests for formatting)
 - rust-lang#124709 (Miri subtree update)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request May 4, 2024
…aumeGomez

Fix ignored tests for formatting

This PR fixes the ignored rules in `rustfmt.toml` that were changed in rust-lang#124613 to allow formatting `rmake.rs` but ended up allowing formatting every Rust files in `tests/`.

The fix is a bit involved since we need to workaround a [`.gitignore` pattern limitation](https://git-scm.com/docs/gitignore#_pattern_format):
> An optional prefix "!" which negates the pattern; any matching file excluded by a previous pattern will become included again. It is not possible to re-include a file if a parent directory of that file is excluded. Git doesn’t list excluded directories for performance reasons, so any patterns on contained files have no effect, no matter where they are defined.

Workaround using https://stackoverflow.com/a/5534865

I tested the fix by changing the formatting in an `rmake.rs` and UI test, and verifying that only the `rmake.rs` files were formatted.

Fixes rust-lang#124613 (comment)
cc `@GuillaumeGomez`
r? `@onur-ozkan`
@bors
Copy link
Contributor

bors commented May 4, 2024

⌛ Testing commit f43e3e2 with merge 29573d7...

@matthiaskrgr
Copy link
Member

@bors retry

bors added a commit to rust-lang-ci/rust that referenced this pull request May 4, 2024
…iaskrgr

Rollup of 5 pull requests

Successful merges:

 - rust-lang#122441 (Improve several `Read` implementations)
 - rust-lang#124584 (Various improvements to entrypoint code)
 - rust-lang#124699 (Use `unchecked_sub` in `split_at`)
 - rust-lang#124704 (Fix ignored tests for formatting)
 - rust-lang#124709 (Miri subtree update)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors
Copy link
Contributor

bors commented May 4, 2024

⌛ Testing commit f43e3e2 with merge 1a851da...

@bors
Copy link
Contributor

bors commented May 4, 2024

☀️ Test successful - checks-actions
Approved by: GuillaumeGomez
Pushing 1a851da to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label May 4, 2024
@bors bors merged commit 1a851da into rust-lang:master May 4, 2024
7 checks passed
@rustbot rustbot added this to the 1.80.0 milestone May 4, 2024
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (1a851da): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
2.2% [2.2%, 2.3%] 2
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Cycles

This benchmark run did not return any relevant results for this metric.

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 674.772s -> 674.198s (-0.09%)
Artifact size: 315.91 MiB -> 315.96 MiB (0.02%)

@Urgau Urgau deleted the fix-ignored-tests-fmt branch May 4, 2024 21:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-meta Area: Issues & PRs about the rust-lang/rust repository itself merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants