Skip to content

Add PSProvideDefaultParameterValue Rule #174

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

Merged
merged 14 commits into from
May 18, 2015
Merged

Add PSProvideDefaultParameterValue Rule #174

merged 14 commits into from
May 18, 2015

Conversation

GoodOlClint
Copy link
Contributor

Per suggestions in #133 Added new rule for parameters and modified PSAvoidUninitializedVariable rule to ignore variables defined in either the function arguments or a param block.

@@ -65,13 +65,16 @@ public IEnumerable<DiagnosticRecord> AnalyzeScript(Ast ast, string fileName)

HashSet<string> paramVariables = new HashSet<string>();

if (isDscResourceFile && targetResourcesFunctions.Contains(funcAst.Name, StringComparer.OrdinalIgnoreCase))
// don't raise the rules for variables in the param block.
if (funcAst.Body != null && funcAst.Body.ParamBlock != null && funcAst.Body.ParamBlock.Parameters != null)

Choose a reason for hiding this comment

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

If we don't raise this error for param block, I think you can remove the checking for whether this is a DSC resource file.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Taken care of in 2528ca6

@yutingc
Copy link
Contributor

yutingc commented May 18, 2015

Thanks @GoodOlClint for the new rule. Changes look good to me.

@raghushantha
Copy link
Member

Thanks for your contributions GoodOlClint. Your changes are good and the build went well. We will merge the fixes.

raghushantha added a commit that referenced this pull request May 18, 2015
@raghushantha raghushantha merged commit a848091 into PowerShell:development May 18, 2015
@GoodOlClint GoodOlClint deleted the PSProvideDefaultParameterValue branch May 18, 2015 17:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants