Skip to content

Commit 25df8fb

Browse files
grahamcbehlendorf
authored andcommitted
Add an .editorconfig; document git whitespace settings
Most of the projects I work on don't use tabs, and while authoring my first patch I had to wrestle with my editor to not introduce whitespace editors. The `.editorconfig` file is supported by a large number of editors out of the box, and many more with plugins. As a first-time contributor, I can't say for certain these settings are totally correct, but thus far git and my editor are satisfied enough. I considered adding `git config --local format.signOff true` but wanted to respect the warning: format.signOff A boolean value which lets you enable the -s/--signoff option of format-patch by default. Note: Adding the Signed-off-by: line to a patch should be a conscious act and means that you certify you have the rights to submit this work under the same open source license. Please see the SubmittingPatches document for further discussion. Reviewed-by: George Melikov <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Graham Christensen <[email protected]> Closes #9892
1 parent e4c4390 commit 25df8fb

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

.editorconfig

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
root = true
2+
3+
[*]
4+
end_of_line = lf
5+
insert_final_newline = true
6+
trim_trailing_whitespace = true
7+
8+
[*.{c,h}]
9+
tab_width = 8
10+
indent_style = tab

.github/CONTRIBUTING.md

+12-3
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,8 @@ changes easier to review and approve which speeds up the merging process.
137137
* Try to keep pull requests simple. Simple code with comments is much easier
138138
to review and approve.
139139
* All proposed changes must be approved by a ZFS on Linux organization member.
140-
* If you have an idea you'd like to discuss or which requires additional testing, consider opening it as a draft pull request.
141-
Once everything is in good shape and the details have been worked out you can remove its draft status.
140+
* If you have an idea you'd like to discuss or which requires additional testing, consider opening it as a draft pull request.
141+
Once everything is in good shape and the details have been worked out you can remove its draft status.
142142
Any required reviews can then be finalized and the pull request merged.
143143

144144
#### Tests and Benchmarks
@@ -177,6 +177,16 @@ We currently use [C Style and Coding Standards for
177177
SunOS](http://www.cis.upenn.edu/%7Elee/06cse480/data/cstyle.ms.pdf) as our
178178
coding convention.
179179

180+
This repository has an `.editorconfig` file. If your editor [supports
181+
editorconfig](https://editorconfig.org/#download), it will
182+
automatically respect most of this project's whitespace preferences.
183+
184+
Additionally, Git can help warn on whitespace problems as well:
185+
186+
```
187+
git config --local core.whitespace trailing-space,space-before-tab,indent-with-non-tab,-tab-in-indent
188+
```
189+
180190
### Commit Message Formats
181191
#### New Changes
182192
Commit messages for new changes must meet the following guidelines:
@@ -315,4 +325,3 @@ but may be used in any situation where there are co-authors.
315325
The email address used here should be the same as on the GitHub profile of said user.
316326
If said user does not have their email address public, please use the following instead:
317327
`Co-authored-by: Name <[username]@users.noreply.github.com>`
318-

0 commit comments

Comments
 (0)