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

tools: Added .editorconfig file for basic encoding/indentation enforcement #2993

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
root = true

[*]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm personally confused as to when to use * and **. In the hello world style example on http://editorconfig.org they show [*] as a sort of default setting for all files, but they also explain how * does not include slashes. So wouldn't that mean that this rule will match only files in the root dir? That would be a very odd default, so I must be mistaken. I just can't find an explanation for it.

Copy link
Contributor

Choose a reason for hiding this comment

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

That's the thing that confuses me too about editorconfig. I think * is fine for a catch-all, but you should double check if the correct files match with the CLI tool.

Choose a reason for hiding this comment

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

@ronkorving this works because patterns without a slash are equivalent to **/pattern (essentially matching in the root directory and all child directories). If you need to match something specifically in the root, add an initial slash like /* (which will only match top-level files). We modeled this after the way globs work in .gitignore.

end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true

Choose a reason for hiding this comment

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

I would recommend adding insert_final_newline = true for all files. This will stop disputes between vim, Visual Studio, and a number of other editors that have different defaults for that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

All files seems a bit aggressive, no? Not better to do this on a per-file-category basis?

Copy link
Contributor

Choose a reason for hiding this comment

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

+1

Copy link
Contributor Author

Choose a reason for hiding this comment

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

+1 on whose comment? :)

Copy link
Contributor

Choose a reason for hiding this comment

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

Yours ofcourse :-)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

\o/


[vcbuild.bat]
end_of_line = crlf

[*.{md,markdown}]
trim_trailing_whitespace = false
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not trimming this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Someone mentioned before that end of line spaces can be used to enforce white lines iirc. I'm not a fan of the practice, but I think the only alternative to that is introducing <br> tags into the content.

Copy link
Contributor

Choose a reason for hiding this comment

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

If that is the case, I am okay with that. @silverwind

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, trailing space to force a line break in markdown. Not a fan of it either, but we should leave that option available to collaborators.


[{lib,src,test}/**.js]
indent_style = space
indent_size = 2

[src/**.{h,cc}]
indent_style = space
indent_size = 2

[test/*.py]
indent_style = space
indent_size = 2

[configure]
indent_style = space
indent_size = 2

[Makefile]
indent_style = tab
indent_size = 8

[{deps,tools}/**]
indent_style = ignore
indent_size = ignore
end_of_line = ignore
trim_trailing_whitespace = ignore
charset = ignore