Thanks Martin for the info.

I think is a good idea to have our own ".editorconfig" at some place. Maybe we could add it to yast-devtools and deploy the file in the user home?

Regarding the rules, I would add both: trim_trailing_whitespace and insert_final_newline. I see none case where they could be a problem.

And for the special libstorage-ng rules, I would keep them only in the libstorage-ng repository. They are quite particular. In fact, I have been reviewing some C++ style guides (there are quite some) and almost all of them avoid to use tabs. So, in our default ".editorconfig" I would use other rules for cpp files.


On 6/17/19 12:19 PM, Martin Vidner wrote:
Hi,

some time ago I started using a new code editor[1], and I found that unlike my
other editor[2] it has difficulties in divinating the indentation styles of
various code bases.

Fortunately, a reasonable standard has emerged that lets a code base declare
how to indent, in a way that editors can easily understand:

   https://editorconfig.org/

Here's a declaration I've been using for our Ruby code:

     # top-most EditorConfig file
     root = true
# 2 space indentation
     [*.rb]
     indent_style = space
     indent_size = 2

And here's the one from libstorage-ng, capturing the not-quite-trivial rules
of "the Tab key indents 4 columns, but compress 8 spaces into Tab characters"

     # https://EditorConfig.org  -*- ini -*-
     # This is a unified way to tell all your editors
     # about the proper indentation style in this repo.
     #
     # Emacs:   https://github.com/editorconfig/editorconfig-emacs#readme
     # Vim:     https://github.com/editorconfig/editorconfig-vim#readme
     # VS Code: 
https://marketplace.visualstudio.com/items?itemName=EditorConfig.EditorConfig
# don't continue looking in upper directories, this is the top level
     root = true
[*.{h,cc}]
     indent_style = tab
     indent_size = 4
     tab_width = 8

I've added it to a couple of repos so far, where I needed it.

1. Should we improve these declarations? (Add
    trim_trailing_whitespace[3], insert_final_newline)
2. Should we add a master copy to yast-devtools? (It would need to be copied
    manually, but it would serve as the representation of the current best
    practice)

[1]: https://en.wikipedia.org/wiki/Visual_Studio_Code
[2]: https://en.wikipedia.org/wiki/GNU_Emacs
[3]: https://github.com/yast/yast-packager/pull/441#discussion_r294163050
      thanks to Lada for prompting this

--
To unsubscribe, e-mail: [email protected]
To contact the owner, e-mail: [email protected]

Reply via email to