GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Fix RCS1221: Use pattern matching instead of combination of 'as' operator and null check by xtqqczze · Pull Request #13333 · PowerShell/PowerShell

Conversation

@xtqqczze

@xtqqczze xtqqczze commented Aug 1, 2020 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

PR Summary

  • Autofix RCS1221

PR Context

  • Use 'is' operator instead of 'as' operator #13287
  • Use is not syntax and remove unnecessary parentheses #13323

PR Checklist

  • PR has a meaningful title
    • Use the present tense and imperative mood when describing your changes
  • Summarized changes
  • Make sure all .h, .cpp, .cs, .ps1 and .psm1 files have the correct copyright header
  • This PR is ready to merge and is not Work in Progress.
    • If the PR is work in progress, please add the prefix WIP: or [ WIP ] to the beginning of the title (the WIP bot will keep its status check at Pending while the prefix is present) and remove the prefix when the PR is ready.
  • Breaking changes
    • None
    • OR
    • [NA] Experimental feature(s) needed
      • [NA] Experimental feature name(s):
  • User-facing changes
    • Not Applicable
    • OR
    • [NA] Documentation needed
      • [NA] Issue filed:
  • Testing - New and feature
    • N/A or can only be tested interactively
    • OR
    • [NA] Make sure you've added a new test if existing tests do not effectively test the code changed
  • Tooling
    • I have considered the user experience from a tooling perspective and don't believe tooling will be impacted.
    • OR
    • [NA] I have considered the user experience from a tooling perspective and enumerated concerns in the summary. This may include:
      • Impact on PowerShell Editor Services which is used in the PowerShell extension for VSCode (which runs in a different PS Host).
      • Impact on Completions (both in the console and in editors) - one of PowerShell's most powerful features.
      • Impact on PSScriptAnalyzer (which provides linting & formatting in the editor extensions).
      • Impact on EditorSyntax (which provides syntax highlighting with in VSCode, GitHub, and many other editors).

This change is Reviewable

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@xtqqczze
xtqqczze requested review from Aditya Patwardhan (adityapatwardhan), Andrew (anmenaga) and Dongbo Wang (daxian-dbw) as code owners August 1, 2020 17:15
@ghost ghost assigned Rob Holt (rjmholt) Aug 1, 2020
@xtqqczze
xtqqczze requested review from Steve Lee (SteveL-MSFT) and Travis Plunk (TravisEz13) as code owners August 1, 2020 22:00
@xtqqczze
xtqqczze force-pushed the RCS1221 branch 3 times, most recently from 65557c3 to 03e25bf Compare August 2, 2020 16:49
@xtqqczze

xtqqczze commented Aug 2, 2020

Copy link
Copy Markdown
Contributor Author

Reverted IDE0019 commits due to high number of issues.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@xtqqczze
xtqqczze marked this pull request as draft August 2, 2020 17:00
@xtqqczze
xtqqczze marked this pull request as ready for review August 3, 2020 19:05
@xtqqczze xtqqczze changed the title Use pattern matching instead of combination of 'as' operator and null check Fix RCS1221: Use pattern matching instead of combination of 'as' operator and null check Aug 3, 2020
@xtqqczze

xtqqczze commented Aug 3, 2020

Copy link
Copy Markdown
Contributor Author

PR is ready for review

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@rjmholt Rob Holt (rjmholt) added Review - Needed The PR is being reviewed Review - Maintainer The PR/issue needs a review from the PowerShell repo Maintainers labels Aug 3, 2020
@xtqqczze

xtqqczze commented Aug 10, 2020

Copy link
Copy Markdown
Contributor Author

Ilya (@iSazonov) Can you review?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

iSazonov
Ilya (iSazonov) approved these changes Aug 10, 2020
View reviewed changes

@iSazonov Ilya (iSazonov) left a comment

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

LGTM with one comment.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread src/System.Management.Automation/help/ProviderContext.cs Resolved

Uh oh!

There was an error while loading. Please reload this page.

@daxian-dbw

Dongbo Wang (daxian-dbw) commented Sep 1, 2020

Copy link
Copy Markdown
Member

@PowerShell/powershell-maintainers reviewed this PR and agreed to accept it for 7.2-preivew. So we should delay merging it until after 7.1-RC1 release branch gets created.

The changes make sense, but it requires line-by-line review to make sure there is no potential incorrect change, so it's better to delay merging it till 7.2 preview to avoid possible regression.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ghost ghost removed the Review - Needed The PR is being reviewed label Sep 1, 2020
@daxian-dbw Dongbo Wang (daxian-dbw) removed the Review - Maintainer The PR/issue needs a review from the PowerShell repo Maintainers label Sep 1, 2020
@iSazonov
Ilya (iSazonov) marked this pull request as draft September 2, 2020 03:25
@iSazonov

Ilya (iSazonov) commented Sep 2, 2020

Copy link
Copy Markdown
Collaborator

Set Draft till 7.2. Preview1.

rjmholt reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ghost ghost added the Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept label Sep 5, 2020
@ghost ghost added the Stale label Sep 20, 2020
@ghost

Deleted user (ghost) commented Sep 20, 2020

Copy link
Copy Markdown

This pull request has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 15 days. It will be closed if no further activity occurs within 10 days of this comment.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ghost ghost closed this Sep 30, 2020
@rjmholt Rob Holt (rjmholt) removed Stale Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept labels Sep 30, 2020
@rjmholt Rob Holt (rjmholt) reopened this Sep 30, 2020
@iSazonov

Ilya (iSazonov) commented Oct 21, 2020

Copy link
Copy Markdown
Collaborator

Restarted CI Windows.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ghost ghost removed the Review - Needed The PR is being reviewed label Oct 21, 2020
@xtqqczze

xtqqczze commented Oct 22, 2020

Copy link
Copy Markdown
Contributor Author

Ilya (@iSazonov) It seems Github is still reporting the old PowerShell-CI-windows result. I shall rerun tests by rebasing instead.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@xtqqczze
xtqqczze force-pushed the RCS1221 branch from e6fb739 to 4ba68c0 Compare October 22, 2020 00:01
@xtqqczze

xtqqczze commented Oct 22, 2020

Copy link
Copy Markdown
Contributor Author

Ilya (@iSazonov) Should I fix pre-existing Codacy issues : Add curly braces around the nested statement(s) in this 'if' block.?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@iSazonov

Ilya (iSazonov) commented Oct 22, 2020

Copy link
Copy Markdown
Collaborator

Ilya (@iSazonov) Should I fix pre-existing Codacy issues : Add curly braces around the nested statement(s) in this 'if' block.?

In follow PR only.

xtqqczze reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@iSazonov Ilya (iSazonov) added the CL-CodeCleanup Indicates that a PR should be marked as a Code Cleanup change in the Change Log label Oct 22, 2020
This was referenced Oct 26, 2020
Use is not null syntax #13286
Closed
WIP: Enable IDE0019: InlineAsTypeCheck #13895
Closed
@xtqqczze
xtqqczze force-pushed the RCS1221 branch from 8228cf5 to f0b9981 Compare October 26, 2020 20:16
@xtqqczze
xtqqczze marked this pull request as draft October 26, 2020 20:17
xtqqczze added 2 commits October 26, 2020 20:18
@xtqqczze
Autofix RCS1221: Use pattern matching instead of combination of 'as' …
dbaa79f
…operator and null check

https://github.com/JosefPihrt/Roslynator/blob/master/docs/analyzers/RCS1221.md
@xtqqczze
Restore stripped comments
6fc7e01
@xtqqczze
xtqqczze force-pushed the RCS1221 branch from f0b9981 to 6fc7e01 Compare October 26, 2020 20:19
@xtqqczze
xtqqczze marked this pull request as ready for review October 29, 2020 22:10
iSazonov
Ilya (iSazonov) approved these changes Nov 5, 2020
View reviewed changes
@iSazonov

Ilya (iSazonov) commented Nov 5, 2020

Copy link
Copy Markdown
Collaborator
  • Use is not syntax (like Use is not syntax and remove unnecessary parentheses #13323, every change has been manually reviewed)

I don't see the change in the PR but we can do this later and I am ready to merge.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@xtqqczze

xtqqczze commented Nov 5, 2020

Copy link
Copy Markdown
Contributor Author
  • Use is not syntax (like Use is not syntax and remove unnecessary parentheses #13323, every change has been manually reviewed)

I don't see the change in the PR but we can do this later and I am ready to merge.

I think this change was removed in a rebase to refocus the PR. Further is not changes can be made in follow-up PR. So please merge this PR.

iSazonov reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@iSazonov
Ilya (iSazonov) merged commit 76cef3b into PowerShell:master Nov 5, 2020
@iSazonov Ilya (iSazonov) assigned Ilya (iSazonov) and unassigned Rob Holt (rjmholt) Nov 5, 2020
@iSazonov Ilya (iSazonov) added this to the 7.2.0-preview.1 milestone Nov 5, 2020
@xtqqczze
xtqqczze deleted the RCS1221 branch November 5, 2020 17:00
@iSazonov

Ilya (iSazonov) commented Nov 5, 2020

Copy link
Copy Markdown
Collaborator

xtqqczze Do you think about forcing Roslynator rules? We could add new GitHub Check.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@xtqqczze

xtqqczze commented Nov 5, 2020 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

Ilya (@iSazonov) I used Roslynator to make these changes as it was the easiest tool for me at the time of the PR. Now codestyle analyzers are included in .NET 5.0 we can use IDE0019 instead, see #13895.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@iSazonov

Ilya (iSazonov) commented Nov 5, 2020

Copy link
Copy Markdown
Collaborator

Now codestyle analyzers are included in .NET 5.0

All?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@xtqqczze

xtqqczze commented Nov 5, 2020

Copy link
Copy Markdown
Contributor Author

Now codestyle analyzers are included in .NET 5.0

All?

Many RCSXXXX rules have crossover with IDEXXXX and CAXXXX. If we also add StyleCop analyzers package like in #13963 we can likely cover most scenarios.

iSazonov reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ghost

Deleted user (ghost) commented Nov 17, 2020

Copy link
Copy Markdown

🎉v7.2.0-preview.1 has been released which incorporates this pull request.:tada:

Handy links:

  • Release Notes
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@xtqqczze xtqqczze mentioned this pull request Oct 27, 2022
Enable IDE0019: InlineAsTypeCheck #18399
Closed
Thatgfsj (Thatgfsj) pushed a commit to Thatgfsj-contribs/PowerShell that referenced this pull request Aug 6, 2026
@xtqqczze
Fix RCS1221: Use pattern matching instead of combination of 'as' oper…
da84a6b
…ator and null check (PowerShell#13333)

* Autofix RCS1221: Use pattern matching instead of combination of 'as' operator and null check

https://github.com/JosefPihrt/Roslynator/blob/master/docs/analyzers/RCS1221.md

* Restore stripped comments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@iSazonov Ilya (iSazonov) iSazonov approved these changes
@adityapatwardhan Aditya Patwardhan (adityapatwardhan) Awaiting requested review from adityapatwardhan adityapatwardhan is a code owner
@anmenaga Andrew (anmenaga) Awaiting requested review from anmenaga
@daxian-dbw Dongbo Wang (daxian-dbw) Awaiting requested review from daxian-dbw daxian-dbw is a code owner
@SteveL-MSFT Steve Lee (SteveL-MSFT) Awaiting requested review from SteveL-MSFT
@TravisEz13 Travis Plunk (TravisEz13) Awaiting requested review from TravisEz13 TravisEz13 is a code owner

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@iSazonov Ilya (iSazonov)

Labels

CL-CodeCleanup Indicates that a PR should be marked as a Code Cleanup change in the Change Log

Projects

None yet

Milestone

7.2.0-preview.1

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@xtqqczze @daxian-dbw @iSazonov @rjmholt
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.