Commit graph

102 commits

Author SHA1 Message Date
xtqqczze 0f2f23f67a
Enable IDE0049 PreferBuiltInOrFrameworkType (#14491) 2021-07-28 12:39:14 -07:00
xtqqczze 4dd25a432c
Enable IDE0029: UseCoalesceExpression (#15770)
Enable [IDE0029: UseCoalesceExpression](https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0029)
2021-07-15 09:17:46 +05:00
Konstantin Gukov 8dcd5a2e1c
Use nameof to get parameter names when creating ArgumentNullException (#15604) 2021-07-05 22:04:13 -07:00
Staffan Gustafsson efdc500ba5
Annotate ThrowTerminatingError with DoesNotReturn attribute (#15352) 2021-05-06 09:23:34 -07:00
xtqqczze b7a431a442
Fix SA1504: All accessors should be single-line or multi-lin (#14241)
https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1504.md
2021-01-09 12:44:38 +05:00
xtqqczze bb55515717
Fix SA1119 part 1 (#14204) 2021-01-09 12:41:51 +05:00
xtqqczze 9d4665f32f
Enable SA1003: Symbols should be spaced correctly (#14476)
https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1003.md
2020-12-23 21:21:26 +05:00
xtqqczze 0fd914fee1
Fix RCS1188: Remove redundant auto-property initialization part 1 (#14261)
https://github.com/JosefPihrt/Roslynator/blob/master/docs/analyzers/RCS1188.md
2020-11-27 13:17:38 +05:00
xtqqczze 908cf899e1
Fix SA1642 for Microsoft.Management.Infrastructure.CimCmdlets (#14239)
https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1642.md
2020-11-27 13:07:58 +05:00
xtqqczze b5fc2f34e4
Use xml documentation child blocks correctly (#14249) 2020-11-26 10:36:23 +05:00
xtqqczze c7bdb24ff3
Mark local variable as const (#13217)
RCS1118: Mark local variable as const https://github.com/JosefPihrt/Roslynator/blob/master/docs/analyzers/RCS1118.md
2020-11-24 20:06:16 +05:00
xtqqczze 0e0cd0b6df
Fix IDE0032: UseAutoProperty part 2 (#14244)
https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0032
2020-11-24 15:44:09 +05:00
xtqqczze bbe46f2772
Fix CA1822: Mark members as static part 1 (#14224)
https://docs.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1822
2020-11-24 12:01:01 +05:00
xtqqczze fa6caf957e
Use see keyword in documentation (#14220)
Fix [DOC104](https://github.com/DotNetAnalyzers/DocumentationAnalyzers/blob/master/docs/DOC104.md)
2020-11-24 09:35:46 +05:00
xtqqczze 0db5e8f3c9
Fix various xml documentation issues (#14223)
* Use correct paramref tag

* End summary tag in correct position

* Escape generic identifiers correctly

* https://github.com/DotNetAnalyzers/DocumentationAnalyzers/blob/master/docs/DOC202.md

* Remove extraneous space
2020-11-23 14:07:48 +05:00
xtqqczze 60643e27df
Enable CA1012: Abstract types should not have public constructors (#13940)
https://docs.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1012
2020-11-21 20:07:28 +05:00
xtqqczze 98117cd403
Fix IDE0090: Simplify new expression part 3 (#14201)
https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0090
2020-11-21 19:29:44 +05:00
xtqqczze cba73e724f
Enable SA1106: Code should not contain empty statements (#13964)
https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1106.md
2020-11-21 19:26:44 +05:00
xtqqczze 9e285298c0
Enable IDE0031: Null check can be simplified (#13548)
https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0031
2020-11-20 11:42:51 +05:00
xtqqczze 8f0c63156e
Remove unnecessary usings part 1 (#14014)
* Fix IDE0005: Remove unnecessary import

https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005

* Sort usings
2020-11-10 08:13:11 +05:00
xtqqczze 093edbb9a9
Make applicable private Guid fields readonly (#14000)
* Make applicable private Guid fields readonly

* Use in-modifier for passing a readonly Guid
2020-11-08 10:43:59 +05:00
xtqqczze 2e24380b8c
Fix CA1003: Use generic event handler instances (#13937)
https://docs.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1003
2020-11-07 16:30:19 +05:00
xtqqczze d6727dcf1b
Simplify delegate creation (#13578)
* Autofix RCS1048

* Autofix RCS1021
2020-11-05 22:25:26 +05:00
xtqqczze 76cef3b299
Fix RCS1221: Use pattern matching instead of combination of 'as' operator and null check (#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
2020-11-05 21:58:48 +05:00
xtqqczze eaad6c2235
Fix accessor order (#13538)
* Fix Microsoft.PowerShell.Commands.Utility

* Fix System.Management.Automation

* Fix Microsoft.Management.Infrastructure.CimCmdlets

* Fix Microsoft.PowerShell.Commands.Management

* Fix Microsoft.WSMan.Management
2020-11-05 10:05:50 +05:00
xtqqczze 739b55d459
Fix IDE0044: MakeFieldReadonly part 1 (#13884)
https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0044
2020-11-02 12:43:04 +05:00
Pat Leong 72608fb829
Use Environment.CurrentManagedThreadId (#13803) 2020-10-30 12:42:17 +05:00
xtqqczze af8558b065
Enable CA1834: Consider using 'StringBuilder.Append(char)' when applicable (#13878)
https://docs.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1834
2020-10-30 12:07:18 +05:00
xtqqczze 20401c9583
Enable IDE1005: InvokeDelegateWithConditionalAccess (#13911)
* Enable IDE1005: InvokeDelegateWithConditionalAccess

https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide1005
2020-10-28 22:35:51 +05:00
xtqqczze 859890374a
Use read-only auto-implemented properties (#13507)
* Autofix RCS1170: Use read-only auto-implemented property
2020-09-02 08:11:16 +05:00
xtqqczze 4597b41396
Use is not syntax where appropriate and remove unnecessary parentheses (#13323) 2020-07-31 16:41:59 -07:00
Dongbo Wang 4b9b0788ed
Revert "Use is null syntax (#13277)" (#13322)
This reverts commit 6c03776d74.
2020-07-30 16:06:38 -07:00
xtqqczze 6c03776d74
Use is null syntax (#13277)
Replace `== null` with `is null`
2020-07-30 18:04:03 +05:00
xtqqczze e41a28c2bd
Cleanup: Use int instead of long to avoid Interlocked.Read (#13069) 2020-07-10 11:43:41 -07:00
xtqqczze bd90f1921f
Code performance fixes (#12956)
* RCS1080: Use 'Count/Length' property instead of 'Any' method

* RCS1077: Optimize LINQ method call

* RCS1235: Optimize method call
2020-06-25 11:30:40 +05:00
Ilya 409bd318f1
Rename the CimCmdlet resource file (#12955) 2020-06-15 11:00:02 -07:00
xtqqczze 58c371ca31
Fix RCS1114: Remove redundant delegate creation (#12917) 2020-06-11 14:01:01 +05:00
xtqqczze 0d5d017f0f
Code redundancy fixes (#12916)
* Autofix `RCS1036: Remove redundant empty line`

* Autofix `RCS1037: Remove trailing white-space`

* Autofix `RCS1033: Remove redundant boolean literal`

* Autofix: `RCS1038: Remove empty statement`

* Autofix `RCS1041: Remove empty initializer`

* Autofix `RCS1097: Remove redundant 'ToString' call

* Autofix: `RCS1420: Operator is unnecessary`
2020-06-11 11:25:35 +05:00
xtqqczze e93381e73e
Add readonly modifier to internal static members (#11777)
# PR Summary

* Add readonly modifier to internal static members.

## PR Context

## PR Checklist

- [x] [PR has a meaningful title](https://github.com/PowerShell/PowerShell/blob/master/.github/CONTRIBUTING.md#pull-request---submission)
    - Use the present tense and imperative mood when describing your changes
- [x] [Summarized changes](https://github.com/PowerShell/PowerShell/blob/master/.github/CONTRIBUTING.md#pull-request---submission)
- [x] [Make sure all `.h`, `.cpp`, `.cs`, `.ps1` and `.psm1` files have the correct copyright header](https://github.com/PowerShell/PowerShell/blob/master/.github/CONTRIBUTING.md#pull-request---submission)
- [x] This PR is ready to merge and is not [Work in Progress](https://github.com/PowerShell/PowerShell/blob/master/.github/CONTRIBUTING.md#pull-request---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](https://github.com/PowerShell/PowerShell/blob/master/.github/CONTRIBUTING.md#making-breaking-changes)**
    - [x] None
    - **OR**
    - [ ] [Experimental feature(s) needed](https://github.com/MicrosoftDocs/PowerShell-Docs/blob/staging/reference/6/Microsoft.PowerShell.Core/About/about_Experimental_Features.md)
        - [ ] Experimental feature name(s): <!-- Experimental feature name(s) here -->
- **User-facing changes**
    - [x] Not Applicable
    - **OR**
    - [ ] [Documentation needed](https://github.com/PowerShell/PowerShell/blob/master/.github/CONTRIBUTING.md#pull-request---submission)
        - [ ] Issue filed: <!-- Number/link of that issue here -->
- **Testing - New and feature**
    - [x] N/A or can only be tested interactively
    - **OR**
    - [ ] [Make sure you've added a new test if existing tests do not effectively test the code changed](https://github.com/PowerShell/PowerShell/blob/master/.github/CONTRIBUTING.md#before-submitting)
- **Tooling**
    - [x] I have considered the user experience from a tooling perspective and don't believe tooling will be impacted.
    - **OR**
    - [ ] I have considered the user experience from a tooling perspective and enumerated concerns in the summary. This may include:
        - Impact on [PowerShell Editor Services](https://github.com/PowerShell/PowerShellEditorServices) which is used in the [PowerShell extension](https://github.com/PowerShell/vscode-powershell) 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](https://github.com/PowerShell/PSScriptAnalyzer) (which provides linting & formatting in the editor extensions).
        - Impact on [EditorSyntax](https://github.com/PowerShell/EditorSyntax) (which provides syntax highlighting with in VSCode, GitHub, and many other editors).
2020-05-31 05:10:22 +00:00
xtqqczze 4e98011833
cleanup: Use coalesce expression (#12829) 2020-05-31 10:01:08 +05:00
xtqqczze 0d5b7f5e6f
Add missing assessibility modifiers (#12820)
# PR Summary

Automated fix of [RCS1018](https://github.com/JosefPihrt/Roslynator/blob/master/docs/analyzers/RCS1018.md)

## PR Context

## PR Checklist

- [x] [PR has a meaningful title](https://github.com/PowerShell/PowerShell/blob/master/.github/CONTRIBUTING.md#pull-request---submission)
    - Use the present tense and imperative mood when describing your changes
- [x] [Summarized changes](https://github.com/PowerShell/PowerShell/blob/master/.github/CONTRIBUTING.md#pull-request---submission)
- [x] [Make sure all `.h`, `.cpp`, `.cs`, `.ps1` and `.psm1` files have the correct copyright header](https://github.com/PowerShell/PowerShell/blob/master/.github/CONTRIBUTING.md#pull-request---submission)
- [x] This PR is ready to merge and is not [Work in Progress](https://github.com/PowerShell/PowerShell/blob/master/.github/CONTRIBUTING.md#pull-request---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](https://github.com/PowerShell/PowerShell/blob/master/.github/CONTRIBUTING.md#making-breaking-changes)**
    - [x] None
    - **OR**
    - [ ] [Experimental feature(s) needed](https://github.com/MicrosoftDocs/PowerShell-Docs/blob/staging/reference/6/Microsoft.PowerShell.Core/About/about_Experimental_Features.md)
        - [ ] Experimental feature name(s): <!-- Experimental feature name(s) here -->
- **User-facing changes**
    - [x] Not Applicable
    - **OR**
    - [ ] [Documentation needed](https://github.com/PowerShell/PowerShell/blob/master/.github/CONTRIBUTING.md#pull-request---submission)
        - [ ] Issue filed: <!-- Number/link of that issue here -->
- **Testing - New and feature**
    - [x] N/A or can only be tested interactively
    - **OR**
    - [ ] [Make sure you've added a new test if existing tests do not effectively test the code changed](https://github.com/PowerShell/PowerShell/blob/master/.github/CONTRIBUTING.md#before-submitting)
- **Tooling**
    - [x] I have considered the user experience from a tooling perspective and don't believe tooling will be impacted.
    - **OR**
    - [ ] I have considered the user experience from a tooling perspective and enumerated concerns in the summary. This may include:
        - Impact on [PowerShell Editor Services](https://github.com/PowerShell/PowerShellEditorServices) which is used in the [PowerShell extension](https://github.com/PowerShell/vscode-powershell) 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](https://github.com/PowerShell/PSScriptAnalyzer) (which provides linting & formatting in the editor extensions).
        - Impact on [EditorSyntax](https://github.com/PowerShell/EditorSyntax) (which provides syntax highlighting with in VSCode, GitHub, and many other editors).
2020-05-31 04:46:24 +00:00
xtqqczze 05cab7fa5a
Formatting: Add empty line between declarations (#12824)
# PR Summary

Automated fixes:
* RCS0013: Add empty line between single-line declarations of different kind
* RCS010: Add empty line between declarations

## PR Context


## PR Checklist

- [x] [PR has a meaningful title](https://github.com/PowerShell/PowerShell/blob/master/.github/CONTRIBUTING.md#pull-request---submission)
    - Use the present tense and imperative mood when describing your changes
- [x] [Summarized changes](https://github.com/PowerShell/PowerShell/blob/master/.github/CONTRIBUTING.md#pull-request---submission)
- [x] [Make sure all `.h`, `.cpp`, `.cs`, `.ps1` and `.psm1` files have the correct copyright header](https://github.com/PowerShell/PowerShell/blob/master/.github/CONTRIBUTING.md#pull-request---submission)
- [x] This PR is ready to merge and is not [Work in Progress](https://github.com/PowerShell/PowerShell/blob/master/.github/CONTRIBUTING.md#pull-request---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](https://github.com/PowerShell/PowerShell/blob/master/.github/CONTRIBUTING.md#making-breaking-changes)**
    - [x] None
    - **OR**
    - [ ] [Experimental feature(s) needed](https://github.com/MicrosoftDocs/PowerShell-Docs/blob/staging/reference/6/Microsoft.PowerShell.Core/About/about_Experimental_Features.md)
        - [ ] Experimental feature name(s): <!-- Experimental feature name(s) here -->
- **User-facing changes**
    - [x] Not Applicable
    - **OR**
    - [ ] [Documentation needed](https://github.com/PowerShell/PowerShell/blob/master/.github/CONTRIBUTING.md#pull-request---submission)
        - [ ] Issue filed: <!-- Number/link of that issue here -->
- **Testing - New and feature**
    - [x] N/A or can only be tested interactively
    - **OR**
    - [ ] [Make sure you've added a new test if existing tests do not effectively test the code changed](https://github.com/PowerShell/PowerShell/blob/master/.github/CONTRIBUTING.md#before-submitting)
- **Tooling**
    - [x] I have considered the user experience from a tooling perspective and don't believe tooling will be impacted.
    - **OR**
    - [ ] I have considered the user experience from a tooling perspective and enumerated concerns in the summary. This may include:
        - Impact on [PowerShell Editor Services](https://github.com/PowerShell/PowerShellEditorServices) which is used in the [PowerShell extension](https://github.com/PowerShell/vscode-powershell) 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](https://github.com/PowerShell/PSScriptAnalyzer) (which provides linting & formatting in the editor extensions).
        - Impact on [EditorSyntax](https://github.com/PowerShell/EditorSyntax) (which provides syntax highlighting with in VSCode, GitHub, and many other editors).
2020-05-29 04:56:33 +00:00
Thomas Larsen 62bb436e71
Change CimCmdlets to use AliasAttribute (#12617) 2020-05-22 12:56:47 -07:00
xtqqczze e132e8b1c1
Rethrow to preserve stack details for better maintainability (#12723) 2020-05-22 10:33:36 -07:00
Reece Dunham 8b3937ecfe
CodeFactor cleanup (#12251)
* Code cleanup

Signed-off-by: Reece Dunham <me@rdil.rocks>

* whoops

* Update src/Microsoft.Management.Infrastructure.CimCmdlets/CimSessionOperations.cs

Co-Authored-By: Travis Plunk <travis.plunk@microsoft.com>

Co-authored-by: Travis Plunk <travis.plunk@microsoft.com>
2020-04-14 14:34:53 -07:00
Steve Lee b7cb335f03
Update copyright notice to latest guidance (#12190) 2020-03-24 11:08:37 -07:00
xtqqczze a34d0f3e80
Reformat code according to EditorConfig rules (#11681) 2020-01-31 14:56:22 -08:00
xtqqczze 70d9ed4d55 Remove Unicode BOM from text files (#11546) 2020-01-11 12:15:34 +05:00
Ilya d58a82ad19
Cleanup: use the built-in type alias (#10882) 2019-11-06 08:47:32 +05:00
Ilya 2ff65c100b Move some of the creations of WildcardPattern in outer loop to avoid unnecessary allocation (#10053) 2019-07-10 09:06:34 -07:00