GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — Refactor rules methods by Haimasker · Pull Request #2182 · PowerShell/PSScriptAnalyzer Conversation
|
| File | Description |
|---|---|
| Utils/RuleMaker.psm1 | Updates the rule-generation template to emit the new SourceType property. |
| Rules/UseVerboseMessageInDSCResource.cs | Replaces GetSourceType() with SourceType property. |
| Rules/UseUTF8EncodingForHelpFile.cs | Replaces GetSourceType() with SourceType property. |
| Rules/UseUsingScopeModifierInNewRunspaces.cs | Replaces GetSourceType() with SourceType property; whitespace cleanup. |
| Rules/UseToExportFieldsInManifest.cs | Replaces GetSourceType() with SourceType property; whitespace cleanup. |
| Rules/UseSupportsShouldProcess.cs | Replaces GetSourceType() with SourceType property. |
| Rules/UseStandardDSCFunctionsInResource.cs | Replaces GetSourceType() with SourceType property; whitespace cleanup. |
| Rules/UseSingularNouns.cs | Replaces GetSourceType() override with SourceType override; whitespace cleanup. |
| Rules/UseSingleValueFromPipelineParameter.cs | Replaces GetSourceType() override with SourceType override; whitespace cleanup. |
| Rules/UseShouldProcessForStateChangingFunctions.cs | Replaces GetSourceType() with SourceType property; whitespace cleanup. |
| Rules/UseShouldProcessCorrectly.cs | Replaces GetSourceType() with SourceType property. |
| Rules/UsePSCredentialType.cs | Replaces GetSourceType() with SourceType property. |
| Rules/UseProcessBlockForPipelineCommand.cs | Replaces GetSourceType() with SourceType property; whitespace cleanup. |
| Rules/UseOutputTypeCorrectly.cs | Replaces GetSourceType() with SourceType property. |
| Rules/UseLiteralInitializerForHashtable.cs | Replaces GetSourceType() with SourceType property. |
| Rules/UseIdenticalParametersDSC.cs | Replaces GetSourceType() with SourceType property; whitespace cleanup. |
| Rules/UseIdenticalMandatoryParametersDSC.cs | Replaces GetSourceType() with SourceType property. |
| Rules/UseDeclaredVarsMoreThanAssignments.cs | Replaces GetSourceType() with SourceType property. |
| Rules/UseCorrectCasing.cs | Replaces GetSourceType() override with SourceType override. |
| Rules/UseConstrainedLanguageMode.cs | Replaces GetSourceType() override with SourceType override; whitespace cleanup. |
| Rules/UseConsistentWhitespace.cs | Replaces GetSourceType() override with SourceType override; whitespace cleanup. |
| Rules/UseConsistentParametersKind.cs | Replaces GetSourceType() override with SourceType override. |
| Rules/UseConsistentParameterSetName.cs | Replaces GetSourceType() override with SourceType override. |
| Rules/UseConsistentIndentation.cs | Replaces GetSourceType() override with SourceType override; whitespace cleanup. |
| Rules/UseCompatibleCmdlets.cs | Replaces GetSourceType() with SourceType property. |
| Rules/UseCmdletCorrectly.cs | Replaces GetSourceType() with SourceType property. |
| Rules/UseBOMForUnicodeEncodedFile.cs | Replaces GetSourceType() with SourceType property; whitespace cleanup. |
| Rules/UseApprovedVerbs.cs | Replaces GetSourceType() with SourceType property. |
| Rules/ReviewUnusedParameter.cs | Replaces GetSourceType() with SourceType property; whitespace cleanup. |
| Rules/ReturnCorrectTypesForDSCFunctions.cs | Replaces GetSourceType() with SourceType property; whitespace cleanup. |
| Rules/ProvideCommentHelp.cs | Replaces GetSourceType() override with SourceType override. |
| Rules/PossibleIncorrectUsageOfRedirectionOperator.cs | Replaces GetSourceType() with SourceType property. |
| Rules/PossibleIncorrectUsageOfAssignmentOperator.cs | Replaces GetSourceType() with SourceType property. |
| Rules/PossibleIncorrectComparisonWithNull.cs | Replaces GetSourceType() with SourceType property; whitespace cleanup. |
| Rules/PlaceOpenBrace.cs | Replaces GetSourceType() override with SourceType override. |
| Rules/PlaceCloseBrace.cs | Replaces GetSourceType() override with SourceType override. |
| Rules/MissingModuleManifestField.cs | Replaces GetSourceType() with SourceType property; whitespace cleanup. |
| Rules/MisleadingBacktick.cs | Replaces GetSourceType() with SourceType property. |
| Rules/DscTestsPresent.cs | Replaces GetSourceType() with SourceType property; whitespace cleanup. |
| Rules/DscExamplesPresent.cs | Replaces GetSourceType() with SourceType property; whitespace cleanup. |
| Rules/CompatibilityRules/UseCompatibleSyntax.cs | Replaces GetSourceType() override with SourceType override. |
| Rules/CompatibilityRules/CompatibilityRule.cs | Replaces GetSourceType() override with SourceType override. |
| Rules/AvoidUsingWriteHost.cs | Replaces GetSourceType() with SourceType property. |
| Rules/AvoidUsingWMICmdlet.cs | Replaces GetSourceType() with SourceType property; whitespace cleanup. |
| Rules/AvoidUsingPlainTextForPassword.cs | Replaces GetSourceType() with SourceType property. |
| Rules/AvoidUsingInvokeExpression.cs | Replaces GetSourceType() override with SourceType override. |
| Rules/AvoidUsingDoubleQuotesForConstantString.cs | Replaces GetSourceType() override with SourceType override; whitespace cleanup. |
| Rules/AvoidUsingDeprecatedManifestFields.cs | Replaces GetSourceType() with SourceType property. |
| Rules/AvoidUsingConvertToSecureStringWithPlainText.cs | Replaces GetSourceType() override with SourceType override. |
| Rules/AvoidUsingComputerNameHardcoded.cs | Replaces GetSourceType() override with SourceType override. |
| Rules/AvoidUsingBrokenHashAlgorithms.cs | Replaces GetSourceType() override with SourceType override. |
| Rules/AvoidUsingAllowUnencryptedAuthentication.cs | Replaces GetSourceType() override with SourceType override. |
| Rules/AvoidUserNameAndPasswordParams.cs | Replaces GetSourceType() with SourceType property; whitespace cleanup. |
| Rules/AvoidTrailingWhitespace.cs | Replaces GetSourceType() with SourceType property. |
| Rules/AvoidShouldContinueWithoutForce.cs | Replaces GetSourceType() with SourceType property; whitespace cleanup. |
| Rules/AvoidSemicolonsAsLineTerminators.cs | Replaces GetSourceType() override with SourceType override. |
| Rules/AvoidReservedWordsAsFunctionNames.cs | Replaces GetSourceType() with SourceType property; whitespace cleanup. |
| Rules/AvoidReservedParams.cs | Replaces GetSourceType() with SourceType property. |
| Rules/AvoidReservedCharInCmdlet.cs | Replaces GetSourceType() with SourceType property; whitespace cleanup. |
| Rules/AvoidPositionalParameters.cs | Replaces GetSourceType() override with SourceType override; whitespace cleanup. |
| Rules/AvoidOverwritingBuiltInCmdlets.cs | Replaces GetSourceType() override with SourceType override. |
| Rules/AvoidNullOrEmptyHelpMessageAttribute.cs | Replaces GetSourceType() with SourceType property; whitespace cleanup. |
| Rules/AvoidMultipleTypeAttributes.cs | Replaces GetSourceType() with SourceType property; whitespace cleanup. |
| Rules/AvoidLongLines.cs | Replaces GetSourceType() override with SourceType override; whitespace cleanup. |
| Rules/AvoidInvokingEmptyMembers.cs | Replaces GetSourceType() with SourceType property; whitespace cleanup. |
| Rules/AvoidGlobalVars.cs | Replaces GetSourceType() with SourceType property. |
| Rules/AvoidGlobalFunctions.cs | Replaces GetSourceType() with SourceType property. |
| Rules/AvoidGlobalAliases.cs | Replaces GetSourceType() with SourceType property. |
| Rules/AvoidExclaimOperator.cs | Replaces GetSourceType() override with SourceType override; whitespace cleanup. |
| Rules/AvoidEmptyCatchBlock.cs | Replaces GetSourceType() with SourceType property. |
| Rules/AvoidDefaultValueForMandatoryParameter.cs | Replaces GetSourceType() with SourceType property; whitespace cleanup. |
| Rules/AvoidDefaultTrueValueSwitchParameter.cs | Replaces GetSourceType() with SourceType property. |
| Rules/AvoidAssignmentToAutomaticVariable.cs | Replaces GetSourceType() with SourceType property. |
| Rules/AvoidAlias.cs | Replaces GetSourceType() with SourceType property; whitespace cleanup. |
| Rules/AlignAssignmentStatement.cs | Replaces GetSourceType() override with SourceType override; whitespace cleanup. |
| Engine/Generic/RuleSourceType.cs | Renames the enum type from SourceType to RuleSourceType; updates doc comment. |
| Engine/Generic/RuleInfo.cs | Updates RuleInfo.SourceType and constructors to use RuleSourceType. |
| Engine/Generic/IRule.cs | Changes the rule contract from GetSourceType() to a SourceType property. |
| Engine/Generic/ExternalRule.cs | Updates external rule implementation to SourceType property. |
| Engine/Generic/ConfigurableRule.cs | Replaces abstract GetSourceType() with abstract SourceType property. |
| Engine/Generic/AvoidParameterGeneric.cs | Replaces abstract GetSourceType() with abstract SourceType property. |
| Engine/Generic/AvoidCmdletGeneric.cs | Replaces abstract GetSourceType() with abstract SourceType property. |
| Engine/Commands/GetScriptAnalyzerRuleCommand.cs | Switches to reading rule.SourceType when producing RuleInfo. |
Engine/Generic/RuleSourceType.cs:10
SourceType to RuleSourceType (and changing the rule contract from GetSourceType() to a SourceType property) is a breaking API change for any external rule implementations or consumers compiled against previous versions. If maintaining compatibility is required, consider keeping SourceType (or providing an [Obsolete] shim) and adding the new property/mapping without removing the old symbols until a major version bump.💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
dd25a91 to
23c7f9e
Compare
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 77 out of 79 changed files in this pull request and generated 4 comments.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
since the only value of this is to reduce number of lines of code and there are still many others methods left, it leaves state after this PR inconsistent. I think we have to make a decision first whether we want to go through this or not Andy Jordan (@andyleejordan) and if so we need to do it all in one go
Sorry, something went wrong.
There was an error while loading. Please reload this page.
This seems like something that could all be done in go by Opus 4.7 pretty easily. Let's not piecemeal it. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Sure. I am marking request as "wip", will finish it soon. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
23c7f9e to
1632c12
Compare
* Refactor methods into one-liners using lambda operator. * Add automatic code style check into build process.
1632c12 to
8358c0c
Compare
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 83 out of 85 changed files in this pull request and generated 1 comment.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| function Test-CodeStyle | ||
| { | ||
| if ( -not $script:DotnetExe ) { | ||
| $script:DotnetExe = Get-DotnetExe | ||
| } | ||
| $dotnetArgs = "format", | ||
| "--verify-no-changes", | ||
| "style" | ||
| $formatOutput = & $script:DotnetExe $dotnetArgs 2>&1 | ||
| if ( $LASTEXITCODE -ne 0 ) { | ||
| Write-Verbose -Verbose -Message "dotnet is $(${script:DotnetExe}.Source)" | ||
| $dotnetArgs | Foreach-Object {"dotnetArg: $_"} | Write-Verbose -Verbose | ||
| Get-PSCallStack | Write-Verbose -Verbose | ||
| Write-Verbose -Verbose -Message "$formatOutput" | ||
| throw "Please, fix code style via running 'dotnet format style' command." | ||
| } | ||
| } |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Denis Melnikov (@Haimasker) Can you test please whether this suggestions makes sense and works?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
The style check depends on the caller’s working directory instead of explicitly targeting the repository solution.
build.psm1:92
dotnet format is invoked without a solution path before the function changes to $projectRoot, so it searches the caller's current directory. Unlike the rest of this build function, invoking build.ps1 by absolute path from outside the repository will now fail even though PSScriptAnalyzer.sln is available via $projectRoot. Pass the solution explicitly so the build remains independent of the caller's working directory.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
At least 1 approving review is required to merge this pull request.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.