server icon indicating copy to clipboard operation
server copied to clipboard

PROPOSAL: Use File Scoped Namespaces

Open justindbaur opened this issue 3 years ago • 1 comments

Type of change

- [ ] Bug fix
- [ ] New feature development
- [x] Tech debt (refactoring, code cleanup, dependency upgrades, etc)
- [ ] Build/deploy pipeline (DevOps)
- [ ] Other

Objective

In C# 10 you can now define file scoped namespaces which turn the namespace declaration into a single line statement and no need to indent it. This saves us 4 spaces horizontally. If this PR is merged it will need to be added to the .git-blame-ignore-revs.

Code changes

  • .editorconfig: Add a setting to prefer file scoped namespaces at a warning level.
  • All other changes were made from using dotnet format

Before you submit

- [x] I have checked for formatting errors (`dotnet format --verify-no-changes`) (required)
- [ ] If making database changes - I have also updated Entity Framework queries and/or migrations
- [ ] I have added **unit tests** where it makes sense to do so (encouraged but not required)
- [ ] This change requires a **documentation update** (notify the documentation team)
- [ ] This change has particular **deployment requirements** (notify the DevOps team)

Reason for hold: To have an internal discussion about whether we want to adopt this.

justindbaur avatar Jun 30 '22 01:06 justindbaur

I'm happy with this change as well! Probably easier to re-run the changes on the latest master though.

Hinton avatar Jul 25 '22 14:07 Hinton