Azure / Azure/data-api-builder

[Refactor] Move to file-scoped namespaces

Aperta
#1,595 1 commento 1 reazione 0 assegnatari Vedi su GitHub
cleanup good first issue hacktoberfest improvement
Lingua principale
C#
Stelle
1.5k
Fork
370
Merge medio
3g 22h
PR unite (30g)
9

Descrizione

C# introduced [file scoped namespaces](https://learn.microsoft.com/dotnet/csharp/language-reference/proposals/csharp-10.0/file-scoped-namespaces) which means that instead of writing this:

```c#
namespace Some.Namespace {
public class SomeType {
public int SomeProperty { get; set; }
}
}
```

We can write this:

```c#
namespace Some.Namespace;

public class SomeType {
public int SomeProperty { get; set; }
}
```

With this, members of a namespace are at the same level as the namespace declaration, reducing the amount of whitespace in a file and aligning with more of how modern C# examples are written.

This can be enforced with an `.editorconfig` rule:

```
[*.cs]
csharp_style_namespace_declarations = file_scoped:warning
```

The refactor is straight forward, navigate to the `namespace` declaration in the file and add a `;` to the end of the line, VS will perform the rest of the refactoring for you.

Undertaking this can be done piece by piece and considered as part of general code hygiene.

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Non sono specificati file o test particolari. Inizia individuando i file C# con dichiarazioni di namespace con ambito a blocco e verificando se il repository contiene una regola .editorconfig per le dichiarazioni di namespace. Converti le dichiarazioni in modo incrementale, quindi verifica che i progetti interessati continuino a compilare e che i relativi test abbiano esito positivo.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
csharp
Ambito
tooling
Tipo di issue
Refactoring
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
42/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.