Skip to content

Add support for interface static abstract meths #21062

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

jborean93
Copy link
Collaborator

PR Summary

Add support for writing a PowerShell class that can implement an interface that contains a static abstract method introduced in C# 11.

I'm not too happy with the implementation done here for matching against the Type[] values. If you can think off a better/more performant way to do this then I'm happy to change it.

PR Context

Fixes: #21060

PR Checklist

@jborean93 jborean93 requested a review from daxian-dbw as a code owner January 13, 2024 07:11
@jborean93 jborean93 closed this Jan 13, 2024
@jborean93 jborean93 reopened this Jan 13, 2024
@iSazonov iSazonov added the CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log label Jan 13, 2024
@jborean93 jborean93 force-pushed the interface-static-abstract-meth branch from 286d581 to 08fc5b3 Compare January 13, 2024 11:30

This PR has 92 quantified lines of changes. In general, a change size of upto 200 lines is ideal for the best PR experience!


Quantification details

Label      : Small
Size       : +83 -9
Percentile : 36.8%

Total files changed: 2

Change summary by file extension:
.cs : +45 -9
.ps1 : +38 -0

Change counts above are quantified counts, based on the PullRequestQuantifier customizations.

Why proper sizing of changes matters

Optimal pull request sizes drive a better predictable PR flow as they strike a
balance between between PR complexity and PR review overhead. PRs within the
optimal size (typical small, or medium sized PRs) mean:

  • Fast and predictable releases to production:
    • Optimal size changes are more likely to be reviewed faster with fewer
      iterations.
    • Similarity in low PR complexity drives similar review times.
  • Review quality is likely higher as complexity is lower:
    • Bugs are more likely to be detected.
    • Code inconsistencies are more likely to be detected.
  • Knowledge sharing is improved within the participants:
    • Small portions can be assimilated better.
  • Better engineering practices are exercised:
    • Solving big problems by dividing them in well contained, smaller problems.
    • Exercising separation of concerns within the code changes.

What can I do to optimize my changes

  • Use the PullRequestQuantifier to quantify your PR accurately
    • Create a context profile for your repo using the context generator
    • Exclude files that are not necessary to be reviewed or do not increase the review complexity. Example: Autogenerated code, docs, project IDE setting files, binaries, etc. Check out the Excluded section from your prquantifier.yaml context profile.
    • Understand your typical change complexity, drive towards the desired complexity by adjusting the label mapping in your prquantifier.yaml context profile.
    • Only use the labels that matter to you, see context specification to customize your prquantifier.yaml context profile.
  • Change your engineering behaviors
    • For PRs that fall outside of the desired spectrum, review the details and check if:
      • Your PR could be split in smaller, self-contained PRs instead
      • Your PR only solves one particular issue. (For example, don't refactor and code new features in the same PR).

How to interpret the change counts in git diff output

  • One line was added: +1 -0
  • One line was deleted: +0 -1
  • One line was modified: +1 -1 (git diff doesn't know about modified, it will
    interpret that line like one addition plus one deletion)
  • Change percentiles: Change characteristics (addition, deletion, modification)
    of this PR in relation to all other PRs within the repository.


Was this comment helpful? 👍  :ok_hand:  :thumbsdown: (Email)
Customize PullRequestQuantifier for this repository.

@daxian-dbw
Copy link
Member

@jborean93 I need to investigate #21253 and a few other issues related the WDAC Audit feature, to see if we can fix the root causes for the v7.4.2 release. I will review your PowerShell Class PRs next Monday.

@microsoft-github-policy-service microsoft-github-policy-service bot removed the Review - Needed The PR is being reviewed label Mar 13, 2024
@jborean93
Copy link
Collaborator Author

Thanks for the update!

@iSazonov
Copy link
Collaborator

@jborean93 Please resolve merge conflicts.

@jborean93 jborean93 force-pushed the interface-static-abstract-meth branch from 08fc5b3 to 30998a3 Compare March 15, 2024 00:57

This PR has 86 quantified lines of changes. In general, a change size of upto 200 lines is ideal for the best PR experience!


Quantification details

Label      : Small
Size       : +80 -6
Percentile : 34.4%

Total files changed: 2

Change summary by file extension:
.cs : +42 -6
.ps1 : +38 -0

Change counts above are quantified counts, based on the PullRequestQuantifier customizations.

Why proper sizing of changes matters

Optimal pull request sizes drive a better predictable PR flow as they strike a
balance between between PR complexity and PR review overhead. PRs within the
optimal size (typical small, or medium sized PRs) mean:

  • Fast and predictable releases to production:
    • Optimal size changes are more likely to be reviewed faster with fewer
      iterations.
    • Similarity in low PR complexity drives similar review times.
  • Review quality is likely higher as complexity is lower:
    • Bugs are more likely to be detected.
    • Code inconsistencies are more likely to be detected.
  • Knowledge sharing is improved within the participants:
    • Small portions can be assimilated better.
  • Better engineering practices are exercised:
    • Solving big problems by dividing them in well contained, smaller problems.
    • Exercising separation of concerns within the code changes.

What can I do to optimize my changes

  • Use the PullRequestQuantifier to quantify your PR accurately
    • Create a context profile for your repo using the context generator
    • Exclude files that are not necessary to be reviewed or do not increase the review complexity. Example: Autogenerated code, docs, project IDE setting files, binaries, etc. Check out the Excluded section from your prquantifier.yaml context profile.
    • Understand your typical change complexity, drive towards the desired complexity by adjusting the label mapping in your prquantifier.yaml context profile.
    • Only use the labels that matter to you, see context specification to customize your prquantifier.yaml context profile.
  • Change your engineering behaviors
    • For PRs that fall outside of the desired spectrum, review the details and check if:
      • Your PR could be split in smaller, self-contained PRs instead
      • Your PR only solves one particular issue. (For example, don't refactor and code new features in the same PR).

How to interpret the change counts in git diff output

  • One line was added: +1 -0
  • One line was deleted: +0 -1
  • One line was modified: +1 -1 (git diff doesn't know about modified, it will
    interpret that line like one addition plus one deletion)
  • Change percentiles: Change characteristics (addition, deletion, modification)
    of this PR in relation to all other PRs within the repository.


Was this comment helpful? 👍  :ok_hand:  :thumbsdown: (Email)
Customize PullRequestQuantifier for this repository.

@jborean93
Copy link
Collaborator Author

Please resolve merge conflicts.

Done!

@microsoft-github-policy-service microsoft-github-policy-service bot added the Review - Needed The PR is being reviewed label Mar 22, 2024
@jborean93 jborean93 force-pushed the interface-static-abstract-meth branch from 30998a3 to 5856b5d Compare May 23, 2024 22:40
@daxian-dbw daxian-dbw added WG-Engine core PowerShell engine, interpreter, and runtime WG-NeedsReview Needs a review by the labeled Working Group labels Jun 10, 2024
@SeeminglyScience SeeminglyScience added WG-Reviewed A Working Group has reviewed this and made a recommendation and removed WG-NeedsReview Needs a review by the labeled Working Group labels Aug 5, 2024
@jborean93 jborean93 force-pushed the interface-static-abstract-meth branch from 5856b5d to ed0606a Compare September 2, 2024 02:35
@jborean93 jborean93 force-pushed the interface-static-abstract-meth branch from ed0606a to 869d10c Compare October 4, 2024 05:29
@jborean93 jborean93 force-pushed the interface-static-abstract-meth branch from 869d10c to 42dd8e3 Compare December 9, 2024 03:34
Add support for writing a PowerShell class that can implement an
interface that contains a static abstract method introduced in C# 11.
@jborean93 jborean93 force-pushed the interface-static-abstract-meth branch from 42dd8e3 to 78b7635 Compare December 10, 2024 20:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log Review - Needed The PR is being reviewed Small WG-Engine core PowerShell engine, interpreter, and runtime WG-Reviewed A Working Group has reviewed this and made a recommendation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Class static abstract methods on interfaces don't work
4 participants