Telegram.Bot icon indicating copy to clipboard operation
Telegram.Bot copied to clipboard

EditorConfig

Open poulad opened this issue 7 years ago • 7 comments

There are various dev envs that we use. In order to have consistency through our code, I suggest using EditorConfig.

@Tuscen suggests https://github.com/RehanSaeed/EditorConfig/blob/master/.editorconfig

poulad avatar Mar 10 '18 17:03 poulad

I suggest to use it as a base and tweak it.

In particular:

  • Use LF for everything instead of CRLF
  • Insert final new line
  • Change dotnet_style_qualification_for_* to false
  • Change csharp_preserve_single_line_blocks to false
  • Add csharp_prefer_simple_default_expression = true
  • Add csharp_prefer_braces = true

Everything else seems fine.

See https://kent-boogaart.com/blog/editorconfig-reference-for-c-developers

Though I don't have a clear opinion on whether we should use warnings or errors.

tuscen avatar Mar 10 '18 18:03 tuscen

As @pouladpld mentioned once - tests require explicit type specification instead of var declaration. So it should be separate configuration for these cases.

karb0f0s avatar Mar 10 '18 19:03 karb0f0s

@Tuscen I believe we should mark them as errors. However, CI checks will happen on develop branch so a bit of messy code on feature branches(before getting to develop) would be fine.

poulad avatar Mar 10 '18 20:03 poulad

@Tuscen suggests StyleCop as an alternative.

poulad avatar Mar 12 '18 05:03 poulad

@pouladpld I guess we still need editorconfig to have common editor configs like line ending and such.

tuscen avatar Mar 14 '18 19:03 tuscen

@Tuscen well, we can have more than 1

poulad avatar Mar 14 '18 22:03 poulad

could be a good example of setting codestyle https://github.com/TelegramBots/Telegram.Bot/blob/ff61b89527f493ee081a2161ff304d4941357d73/src/Telegram.Bot/Exceptions/ForbiddenExceptions/ChatNotInitiatedException.cs#L13 vs https://github.com/TelegramBots/Telegram.Bot/blob/ff61b89527f493ee081a2161ff304d4941357d73/src/Telegram.Bot/Exceptions/BadRequestExceptions/BotBlockedException.cs#L12 single line vs multiline. braces on same line vs braces on single line

karb0f0s avatar Mar 29 '18 05:03 karb0f0s