seanfisk / python-project-template

A template Python project with a focus on best practices.
Other
543 stars 168 forks source link

Add .editorconfig #32

Closed Zearin closed 10 years ago

Zearin commented 10 years ago

EditorConfig site

seanfisk commented 10 years ago

I hadn't heard of EditorConfig, but it looks great! I'd like to try it out with my editor (Emacs) before merging.

Ironically, this file doesn't end with a final line terminator. Also, what would you think about adding trim_trailing_whitespace = true?

Zearin commented 10 years ago

I hadn't heard of EditorConfig, but it looks great! I'd like to try it out with my editor (Emacs) before merging.

Yeah, I love the idea. Unfortunately, my favorite code editor is TextMate 2, and editorconfig support for it is kind of weak (it has only partial support). So, mostly it’s for the sake of others.

But even if it doesn’t have programmatic support, it’s incredibly easy to glance at a .editorconfig file, even if you’ve never seen one before, and instantly understand the conventions for a project. So, although that’s much less than a fully automated tool, it’s still a small step towards consistency.

Ironically, this file doesn't end with a final line terminator.

Whoops! That’s probably my fault! (Remember how I said TextMate 2’s support was weak? Aargh!…)

Also, what would you think about adding trim_trailing_whitespace = true?

For most Python projects, that would be most helpful.

(Once again, unsupported for the TM2 EditorConfig plugin. But still worth including!)

seanfisk commented 10 years ago

I had a chance to try out EditorConfig, and it's awesome!

One thing for which it works well is contributing to projects, even if they don't have their own EditorConfig. I always hate trying to re-configure my editor when it doesn't match the project's guidelines -- it's a real pain. EditorConfig really helps there as it works on a project-specific basis.

I found out the hard way that editorconfig-emacs doesn't support this syntax:

# Matches the exact files either package.json or .travis.yml
[{package.json,.travis.yml}]
indent_style = space
indent_size = 2

I'm going to try to make a pull request, but until then we probably shouldn't use that syntax. Actually, not using that syntax is lame and repetitive, so if it's OK with you, I'd like to get it working with editorconfig-emacs before we merge.

More updates soon!

Zearin commented 10 years ago

I had a chance to try out EditorConfig, and it's awesome!

One thing for which it works well is contributing to projects, even if they don't have their own EditorConfig. I always hate trying to re-configure my editor when it doesn't match the project's guidelines -- it's a real pain. EditorConfig really helps there as it works on a project-specific basis.

Awesome! I’m glad you like it. :)

Agreed on helping project contributions point. At first I was

I found out the hard way that editorconfig-emacs doesn't support this syntax:

# Matches the exact files either package.json or .travis.yml
[{package.json,.travis.yml}]
indent_style = space
indent_size = 2

Wow. Lame!

I'm going to try to make a pull request, but until then we probably shouldn't use that syntax.

Definitely make a PR. EditorConfig may have a simple syntax, but every editor has its own quirks when it comes to implementing conformance to the .editorconfig file.

Emacs is probably the most famously configurable editor of all time, though, so they should be able to handle it! When you open that PR, could you please link to it from here?

Actually, not using that syntax is lame and repetitive, so if it's OK with you, I'd like to get it working with editorconfig-emacs before we merge.

Well, it’s your project. But personally I don’t see any harm in just leaving that instruction in the file; when editorconfig-emacs adds support, then it will simply “turn on” that functionality.

Is emacs your preferred editor?

More updates soon!

I look forward to hearing them! :)

seanfisk commented 10 years ago

Emacs is probably the most famously configurable editor of all time, though, so they should be able to handle it! When you open that PR, could you please link to it from here?

Will do.

Well, it’s your project. But personally I don’t see any harm in just leaving that instruction in the file; when editorconfig-emacs adds support, then it will simply “turn on” that functionality.

The issue is that it can be implemented by having separate sections for each type of file. But that's repetitive and kind of annoying. I'm just a little concerned because there is no mention in editorconfig-emacs that that syntax is not supported. According to the homepage, it was added in EditorConfig Core 0.11.0, so it might not be supported by editors across the board.

Is emacs your preferred editor?

Yes. It's far from perfect, but I really like what I've been able to do with it.

I will attempt to make a PR to editorconfig-emacs, and hopefully gauge how difficult it's going to be. We'll timebox that at about a week. If I can't do it within that time, we'll merge anyway. Sound OK?

seanfisk commented 10 years ago

I haven't yet had time to look at editorconfig-emacs, but I want this. So we're merging :)