Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make improvements to retrieve-codeowners tool: change accepted params (targetPath etc.) + refactor #5104

Merged
merged 1 commit into from
Jan 12, 2023

Conversation

konrad-jamrozik
Copy link
Contributor

@konrad-jamrozik konrad-jamrozik commented Jan 10, 2023

This PR is part of work required in preparation to merge:

Specifically, to enable review of ownership changes due to upcoming wildcards support, as explained in:

As such, this PR contributes to:

Following PR depends on this one:

Changes made

All changes are within the scope of following paths:

  • /tools/code-owners-parser/**
  • /tools/identity-resolutions/Services/GitHubService.cs
  • /tools/notification-configurator/**

Behavior changes:

  • RetrieveCodeOwners.Program now accepts:
    • targetPath instead of targetDirectory
    • excludeNonUserAliases instead of filterOutNonUserAliases
    • codeownersFilePathOrUrl instead of codeownersFilePath
    • the internal implementation didn't change for any of the params; just the param names were misleading
  • Added Debug.Assert(targetPath != null); precondition to CodeownersFile.GetMatchingCodeownersEntry
  • Parsing of CODEOWNERS line now will throw InvalidOperationException on case that should be impossible.

Refactoring changes:

  • Comments: documented RetrieveCodeOwners.Program.
  • Renames: made names consistent by changing all [c|C]odeOwner occurrences (except namespaces) to [c|C]odeowners. E.g. CodeOwnerEntry to CodeownersEntry.
  • Renamed MainTests to ProgramTests to follow the test naming convention of <class>Test not <method>Tests.
  • Addressed various IDE code quality rules (CA*) warnings: https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/
  • Addressed various IDE code style rules (IDE*) warnings: https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/
  • Made method names more consistent and predictable in CodeownersFile.
  • Extracted some intention-revealing methods, like ProcessCodeownersLine or IsCommentLine.
  • Reordered relevant params so that targetPath always comes first, before codeownersEntries.
  • Improved method and param names in Azure.Sdk.Tools.RetrieveCodeOwners.Tests.ProgramTests.
  • Broke lines at 120 chars.
  • Various other minor renames, method extractions and refactorings.

@@ -0,0 +1,115 @@
using System;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI: this file was renamed from CodeOwnersFile but git didn't pick up on that.

@konrad-jamrozik konrad-jamrozik changed the title Make improvements to retrieve-codeowners tool Make improvements to retrieve-codeowners tool: change accepted params + refactor Jan 11, 2023
@konrad-jamrozik konrad-jamrozik changed the title Make improvements to retrieve-codeowners tool: change accepted params + refactor Make improvements to retrieve-codeowners tool: change accepted params (targetPath etc.) + refactor Jan 11, 2023
@@ -0,0 +1,58 @@
using System.Collections.Generic;
Copy link
Contributor Author

@konrad-jamrozik konrad-jamrozik Jan 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI this file is renamed from MainTests.

@konrad-jamrozik konrad-jamrozik force-pushed the users/kojamroz/retrieve_tool_path branch 3 times, most recently from cde15ee to a1e7fee Compare January 11, 2023 01:38
@konrad-jamrozik konrad-jamrozik marked this pull request as ready for review January 11, 2023 01:48
@konrad-jamrozik konrad-jamrozik requested a review from a team as a code owner January 11, 2023 01:48
@konrad-jamrozik konrad-jamrozik force-pushed the users/kojamroz/retrieve_tool_path branch from 8b5af31 to 3758b5a Compare January 11, 2023 03:04
string targetDirectory,
bool filterOutNonUserAliases = false
)
string targetPath,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just keep in mind that you will need to update places like https://github.com/Azure/azure-sdk-tools/blob/main/eng/common/scripts/get-codeowners.ps1 when you update to the latest package version.

Copy link
Contributor Author

@konrad-jamrozik konrad-jamrozik Jan 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@konrad-jamrozik konrad-jamrozik merged commit 6a06646 into main Jan 12, 2023
@konrad-jamrozik konrad-jamrozik deleted the users/kojamroz/retrieve_tool_path branch January 12, 2023 20:59
ghost pushed a commit that referenced this pull request Feb 16, 2023
…ers` executable + add some tests; make assorted refactorings (#5103)

This PR is part of work required in preparation to merge:
- #5088

Specifically, to enable review of ownership changes due to upcoming wildcards support, as explained in:
- #5088 (comment)

As such, this PR contributes to:
- #2770

This PR is a prerequisite for following PRs:
- #5431

### Merging prerequisite

This PR can be merged only after the following PRs are merged and relevant NuGet package published
- #5437
- #5104

This is because this PR depends on that NuGet package.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Central-EngSys This issue is owned by the Engineering System team.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants