GmodDotNet icon indicating copy to clipboard operation
GmodDotNet copied to clipboard

[ENH] Create code styling MD

Open AaronJThompson opened this issue 5 years ago • 3 comments

Overview

As more developers join the project (hopefully I will become a contributor once work cools down), it will become increasingly difficult to maintain standardized code styling across the project, making it harder to read.

It will also be difficult to reject PR's due to code styling if there isn't a standard put in place.

Therefore I suggest we create a coding style MD (could be joined with a Best Practices MD) that we can all agree on when contributing code to the project. We can then also create code formatters based on this as well, possibly even linking it to CI so that PR's are blocked for incorrect formatting

Open to opinions on this one

AaronJThompson avatar Oct 21 '20 21:10 AaronJThompson

@AaronJThompson Yes, we definitely need code style guidelines. I think we should also use something like FxCop to make MSBuild to automatically detect style violations on managed code.

GlebChili avatar Oct 22 '20 13:10 GlebChili

what's about create .editorconfig?

SupinePandora43 avatar Nov 03 '20 11:11 SupinePandora43

There's tool for c# https://github.com/dotnet/format Uses .editorconfig Can return non zero code for checks (--check). Also can format code in source files.

.editorcofig can't cover the whole code styling, but already enough for things like

  • Spacing size and type
  • File encoding, line ending
  • Space trimming (excellent feature)
  • Newline insertion at end of file

Also contains many advanced settings (hope page will be in your native language)

SupinePandora43 avatar Jan 28 '21 17:01 SupinePandora43