Azure / Azure/azure-sdk-tools

Deduplicate and standarize reusable code into shared library: logging, file utils, etc.

Open
#5,281 3 comments 1 reaction 1 assignee Claimed by @konrad-jamrozik View on GitHub
Central-EngSys
Dominant language
C#
Stars
135
Forks
260
Avg merge
1d 22h
Merged PRs (30d)
115

Description

A lot of our tools implement one-off abstractions, like logging or file system utilities. This leads to duplication and lack of consistency.

This work item is about building a case for deduplicating all such code into one reusable library per language, with initial focus on .NET. The benefits include less code to maintain and established conventions to follow.

### .NET deduplication candidates

Below follows a list of candidate code to be deduplicated; if you find more, please add a comment in this issue, and I will incorporate it in this list!

- Per my chat with @benbp and @weshaggard, we should deduplicate our logging, by establishing logging conventions. For example, right now, some of our tools use `Console.Out` (e.g. [CODEOWNERS interpreter](https://github.com/Azure/azure-sdk-tools/blob/965e7ade6dde525f9c7770d794f54cf970030451/tools/code-owners-parser/CodeOwnersParser/MatchedCodeownersEntry.cs#L82)), some of them use the .NET [`AddSimpleConsole`](https://learn.microsoft.com/en-us/dotnet/core/extensions/console-log-formatter#simple) (e.g. [`notification-creator`](https://github.com/Azure/azure-sdk-tools/blob/965e7ade6dde525f9c7770d794f54cf970030451/tools/notification-configuration/notification-creator/Program.cs#L46)), and we also have custom code like `SimplerConsoleFormatter` written by @hallipr (in the secret rotation tool).
- [CodeOwnersParser.FileHelpers](https://github.com/Azure/azure-sdk-tools/blob/965e7ade6dde525f9c7770d794f54cf970030451/tools/code-owners-parser/CodeOwnersParser/FileHelpers.cs) is a candidate for reuse.
- `Azure.Sdk.Tools.SecretRotation.Configuration.PlanConfiguration.GetFileContents`
- NUnit vs xUnit (NUnit!)
- Which command line tool to use. See discussion on `Azure.Sdk.Tools.SecretRotation.Cli.csproj` by @hallipr. Candidate: https://github.com/commandlineparser/commandline
- `GetHashCode` that supports enumerables: https://github.com/Azure/azure-sdk-tools/pull/5636
- Diff tool for git, etc. We have tons of implementations of it. (added 3/29/2023 during discussion about openapi-alps)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.