-
-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Address EditorConfig violations #158550
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
base: main
Are you sure you want to change the base?
Address EditorConfig violations #158550
Changes from all commits
c804b60
bf8df6c
c1c9357
e1aba58
36ec0a8
88885b7
9afa92f
abe991c
531e7e0
17d5b84
ce20a9d
fae5a69
e4ae2be
8605f46
9bc7837
f461a04
9def9bf
01442a2
2d20dfb
96a128c
f90897f
3818858
3aa31b5
8274359
2cb1ac6
f95d472
69cdd43
896ddea
b269a27
d2e526e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,107 @@ | ||
| # Ignore external repositories as checking for EditorConfig violations there | ||
| # is their responsibility and out of scope for here. See also: | ||
| # https://github.com/rust-lang/rustc-dev-guide/blob/main/src/external-repos.md | ||
| # Subtrees | ||
| src/tools/clippy | ||
| src/tools/miri | ||
| library/portable-simd | ||
| src/tools/rustfmt | ||
| src/tools/rust-analyzer | ||
| compiler/rustc_codegen_cranelift | ||
| compiler/rustc_codegen_gcc | ||
| src/doc/rustc-dev-guide | ||
| library/compiler-builtins | ||
| library/stdarch | ||
| # Submodules | ||
| src/doc/nomicon | ||
| src/tools/cargo | ||
| src/doc/reference | ||
| src/doc/book | ||
| src/doc/rust-by-example | ||
| src/doc/edition-guide | ||
| src/llvm-project | ||
| src/doc/embedded-book | ||
| library/backtrace | ||
| src/tools/rustc-perf | ||
| src/tools/enzyme | ||
| src/gcc | ||
|
|
||
| # Ignore binary files | ||
| src/etc/installer/gfx/* | ||
| *.auxv | ||
| *.png | ||
| *.ico | ||
| *.woff | ||
| *.woff2 | ||
| tests/run-make/checksum-freshness/binary_file | ||
| tests/ui/macros/not-utf8.bin | ||
|
|
||
| # Some special cases cannot be handled: | ||
| # Markdown file (space indentation) with 'make' code (tab indentation) | ||
| src/doc/rustc/src/jobserver.md | ||
| # Test file with different line endings and indentations | ||
| tests/pretty/block-comment-wchar.rs | ||
| # Test file for normalize some CRFL line endings to LF | ||
| tests/ui/asm/normalize-offsets-for-crlf.s | ||
| # Test file with CR in frontmatter | ||
| tests/ui/frontmatter/content-cr.rs | ||
| # Test file which uses CRLF line endings but only inside strings | ||
| tests/ui/lexer/crlf-in-byte-string-literal.rs | ||
| # Test files with CR line ending but only in some doc comments | ||
| tests/ui/lexer/lex-bare-cr-* | ||
| tests/ui/parser/several-carriage-returns-in-doc-comment.rs | ||
| # Test file with tab indentation and one CR line ending | ||
| tests/ui/parser/bad-char-literals.rs | ||
| # Test file with CR line ending inside string | ||
| tests/ui/parser/raw/raw-byte-string-literals.rs | ||
| tests/ui/parser/trailing-carriage-return-in-string.rs | ||
|
|
||
| # File types with a mixed formatting which is perhaps intentional. | ||
| # Disabling only check for some properties (like indent_size) is currently not supported. | ||
|
|
||
| # There are different languages in these files (for example css and xml in svg files) | ||
| *.diff | ||
| *.svg | ||
| src/ci/docker/host-x86_64/disabled/dist-x86_64-dragonfly/patch-toolchain | ||
| # Often mixed indentation for example due to alignment with previous line | ||
| *.c | ||
| *.coverage | ||
| *.cpp | ||
| *.css | ||
| *.err | ||
| *.fixed | ||
| *.goml | ||
| *.h | ||
| *.js | ||
| *.ld | ||
| *.py | ||
| *.rs | ||
| *.stderr | ||
| *.stdout | ||
| *.ts | ||
| *.wxs | ||
| tests/run-make/linker-warning/*.txt | ||
| tests/run-make/macos-deployment-target-warning/*.txt | ||
| library/std/src/sys/pal/sgx/abi/entry.S | ||
| tests/pretty/block-comment-wchar.pp | ||
| tests/run-make-cargo/thumb-none-qemu/example/memory.x | ||
| src/bootstrap/mk/Makefile.in | ||
| src/etc/rust_analyzer_eglot.el | ||
| src/librustdoc/html/static/fonts/README.txt | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The content of this README looks almost like Markdown. Only some formatting bugs may need to be fixed. Should that be changed to a Markdown file? If the content and file ending would be changed, it would not be necessary to ignore it here. |
||
| # The first { in these files is always indented with one space | ||
| *.mir | ||
| # Alignment and some test files without final newline | ||
| *.html | ||
| *.html.template | ||
| # Shell scripts with the content of patches inlines | ||
| src/ci/docker/scripts/musl.sh | ||
| src/ci/docker/scripts/solaris-toolchain.sh | ||
| # Shell scripts with alignments with previous line | ||
| src/ci/docker/host-x86_64/disabled/dist-x86_64-haiku/llvm-config.sh | ||
| src/etc/pre-push.sh | ||
|
|
||
| # The clap_complete output uses tabs but there is a fix for the next version: | ||
| # https://github.com/clap-rs/clap/pull/6422 | ||
| # When src/bootstrap/Cargo.toml is using a clap_complete version with that fix, | ||
| # this ignore can be removed. | ||
| src/etc/completions/*.fish | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,8 +22,26 @@ trim_trailing_whitespace = false | |
| [tests/**.{rs,js}] | ||
| trim_trailing_whitespace = true | ||
| # these specific source files need to have trailing whitespace. | ||
| [tests/ui/{frontmatter/frontmatter-whitespace-3.rs,parser/shebang/shebang-space.rs}] | ||
| [tests/ui/{frontmatter/{fence-whitespace-trailing-1.rs,frontmatter-whitespace-3.rs},parser/shebang/shebang-space.rs}] | ||
| trim_trailing_whitespace = false | ||
| # these specific files have a UTF-8 BOM to test with that charset | ||
| [tests/ui/codemap_tests/utf8-bom.rs] | ||
| charset = utf-8-bom | ||
| # these specific files have CRLF line endings to test on them | ||
| [tests/{rustdoc-ui/intra-doc/warning-crlf.rs,ui/{frontmatter/frontmatter-crlf.rs,lexer/lexer-crlf-*.rs}}] | ||
| end_of_line = crlf | ||
| # these specific files have an UTF-8 BOM and CRLF line endings to test on these | ||
| [tests/ui/{include-macros/data.bin,json/json-bom-plus-crlf*.rs}] | ||
| charset = utf-8-bom | ||
| end_of_line = crlf | ||
| # these specific files have no trailing newline to test on these | ||
| [tests/ui/{lint/unused_parens_multibyte_recovery.rs,parser/{macro/macro-missing-right-paren.rs,missing_right_paren.rs}}] | ||
| insert_final_newline = false | ||
| [tests/{pretty/issue-74745.rs,ui/{parser/issues/issue-{62524,68730,58094-missing-right-square-bracket}.rs,type/issue-91268.rs}}] | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These files all have the name pattern |
||
| insert_final_newline = false | ||
| # Most args files have to be without final newline, otherwise tests in aarch64-gnu-llvm-21-1 fail | ||
| [tests/**.args] | ||
| insert_final_newline = false | ||
|
|
||
| [src/llvm-project] | ||
| indent_style = unset | ||
|
|
@@ -36,9 +54,36 @@ max_line_length = 100 | |
| # double whitespace at end of line | ||
| # denotes a line break in Markdown | ||
| trim_trailing_whitespace = false | ||
| # Markdown has heavily context specific indentations. | ||
| # For example, the indentation in lists depend on the length of the list marker | ||
| # (such as '- ' or '100. '), at least in the GitHub Markdown flavor: | ||
| # https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#nested-lists | ||
| # Therefore, pressing tab should insert a single space to encourage situative accurate indentations. | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is maybe a matter of taste if inserting only one space with a tab is a nice solution for this or not. Another one would be to keep the default |
||
| indent_size = 1 | ||
|
|
||
| [*.yml] | ||
| [*.{json,json5,yml,yaml,askama,ll,natvis,nix}] | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we were to add such an indentation rule, I do not think it should group all these unrelated kinds of files such that they would all get changed together. This opinion generalizes across other changes this PR makes, as it enthusiastically uses expansion rules in ways that don't necessarily align with natural groupings. |
||
| indent_size = 2 | ||
|
|
||
| [Makefile] | ||
| [{src/doc/full-toc.inc,src/etc/xhelp,src/tools/nix-dev-shell/envrc-flake}] | ||
| indent_size = 2 | ||
|
|
||
| # You should NOT modify these files with your editor, | ||
| # but if you do it anyway use the correct formatting. | ||
| [Cargo.lock] | ||
| indent_size = 1 | ||
| [yarn.lock] | ||
| indent_size = 2 | ||
|
Comment on lines
+70
to
+75
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I do not believe this indentation is a stable detail that is mandated as part of the format of these lockfiles, so no, I do not think there should be an admonishment to "use the correct formatting" as it can become incorrect with a small diff to Cargo or Yarn and there is no real reason to prevent such. |
||
|
|
||
| [{Makefile,Makefile.in,.gitmodules}] | ||
| indent_style = tab | ||
|
|
||
| # The license texts should NEVER be modified. | ||
| # Therefore disable everything to avoid accidental changes on save. | ||
| [**{LICENSE,COPY{ING,RIGHT}}**] | ||
| charset = unset | ||
| indent_style = unset | ||
| indent_size = unset | ||
| tab_width = unset | ||
| trim_trailing_whitespace = unset | ||
| insert_final_newline = unset | ||
| spelling_language = unset | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -131,7 +131,7 @@ elf_entry: | |
| sub %rax,%rdx /* all chars written? */ | ||
| jnz .Lelf_entry_call | ||
|
|
||
| .Lelf_exit: | ||
| .Lelf_exit: | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please do not change so much as a single character of an assembly file if there is no technical need and you are not willing to verify the SGX assembly still works as-intended on the platform it is used on, which is not something our test suite covers. |
||
| movq $60,%rax /* exit() syscall */ | ||
| movq $1,%rdi /* exit code 1 */ | ||
| syscall | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This Makefile uses two styles of indentation. First, for targets of a Makefile you need to use tab characters for indentation. Otherwise, it is syntactically wrong. Second, there is some further code at the beginning of this file and there 2 spaces are in use for indentation. I do not know if using only tab character for indentation would be fine for this file or not.
View changes since the review
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is that "according to POSIX" or "according to what is accepted by GNU Make"? Are you quite sure we are otherwise compatible with versions of
makethat are not GNU Make and that this is the only thing holding us back?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The targets in a Makefile need to use tab characters for indentation according to POSIX (see section "Target rules" here) and GNU Make (see here). In this file all targets are with tab characters. The code which uses spaces for indentation is no target:
rust/src/bootstrap/mk/Makefile.in
Lines 10 to 14 in 99576cf
I do not know if the spaces there are correct or even necessary with respect to POSIX or GNU Make.