Skip to content

Commit e284305

Browse files
committed
Merge pull request #399 from korygill/development
Improve post-build command, fix spelling mistakes.
2 parents 07f1f2b + 3735e37 commit e284305

20 files changed

+257
-254
lines changed

Engine/Generic/AvoidCmdletGeneric.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ namespace Microsoft.Windows.PowerShell.ScriptAnalyzer.Generic
2424
public abstract class AvoidCmdletGeneric : IScriptRule
2525
{
2626
/// <summary>
27-
/// AnalyzeScript: Analyzes the given Ast and returns DiagnosticRecords based on the anaylsis.
27+
/// AnalyzeScript: Analyzes the given Ast and returns DiagnosticRecords based on the analysis.
2828
/// </summary>
2929
/// <param name="ast">The script's ast</param>
3030
/// <param name="fileName">The name of the script file being analyzed</param>
@@ -38,7 +38,7 @@ public IEnumerable<DiagnosticRecord> AnalyzeScript(Ast ast, string fileName)
3838

3939
List<String> cmdletNameAndAliases = Microsoft.Windows.PowerShell.ScriptAnalyzer.Helper.Instance.CmdletNameAndAliases(GetCmdletName());
4040

41-
// Iterrates all CommandAsts and check the command name.
41+
// Iterates all CommandAsts and check the command name.
4242
foreach (CommandAst cmdAst in commandAsts)
4343
{
4444
if (cmdAst.GetCommandName() == null) continue;

Engine/Generic/AvoidParameterGeneric.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ namespace Microsoft.Windows.PowerShell.ScriptAnalyzer.Generic
2323
public abstract class AvoidParameterGeneric : IScriptRule
2424
{
2525
/// <summary>
26-
/// AnalyzeScript: Analyzes the given Ast and returns DiagnosticRecords based on the anaylsis.
26+
/// AnalyzeScript: Analyzes the given Ast and returns DiagnosticRecords based on the analysis.
2727
/// </summary>
2828
/// <param name="ast">The script's ast</param>
2929
/// <param name="fileName">The name of the script file being analyzed</param>
@@ -35,7 +35,7 @@ public IEnumerable<DiagnosticRecord> AnalyzeScript(Ast ast, string fileName)
3535
// Finds all CommandAsts.
3636
IEnumerable<Ast> commandAsts = ast.FindAll(testAst => testAst is CommandAst, true);
3737

38-
// Iterrates all CommandAsts and check the condition.
38+
// Iterates all CommandAsts and check the condition.
3939
foreach (CommandAst cmdAst in commandAsts)
4040
{
4141
if (CommandCondition(cmdAst) && cmdAst.CommandElements != null)

Engine/Generic/ILogger.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public interface ILogger
3434
string GetName();
3535

3636
/// <summary>
37-
/// GetDescription: Retrives the description of the logger.
37+
/// GetDescription: Retrieves the description of the logger.
3838
/// </summary>
3939
/// <returns>The description of the logger</returns>
4040
string GetDescription();

Engine/Generic/IScriptRule.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ namespace Microsoft.Windows.PowerShell.ScriptAnalyzer.Generic
2525
public interface IScriptRule : IRule
2626
{
2727
/// <summary>
28-
/// AnalyzeScript: Analyzes the given Ast and returns DiagnosticRecords based on the anaylsis.
28+
/// AnalyzeScript: Analyzes the given Ast and returns DiagnosticRecords based on the analysis.
2929
/// </summary>
3030
/// <param name="ast">The script's ast</param>
3131
/// <param name="fileName">The name of the script file being analyzed</param>

Engine/Generic/SourceType.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public enum SourceType : uint
2323
Builtin = 0,
2424

2525
/// <summary>
26-
/// MANAGED: Indicates the script analyzer rule is contirbuted as a managed rule.
26+
/// MANAGED: Indicates the script analyzer rule is contributed as a managed rule.
2727
/// </summary>
2828
Managed = 1,
2929

Engine/PSScriptAnalyzer.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ CompanyName = 'Microsoft Corporation'
2323
Copyright = '(c) Microsoft Corporation 2015. All rights reserved.'
2424

2525
# Description of the functionality provided by this module
26-
Description = 'PSScriptAnalyzer provides script analysis and checks for potential code defects in the scripts by applying a group of builtin or customized rules on the scripts being analyzed.'
26+
Description = 'PSScriptAnalyzer provides script analysis and checks for potential code defects in the scripts by applying a group of built-in or customized rules on the scripts being analyzed.'
2727

2828
# Minimum version of the Windows PowerShell engine required by this module
2929
PowerShellVersion = '5.0'

Engine/ScriptAnalyzer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -888,7 +888,7 @@ public Dictionary<string, List<string>> CheckRuleExtension(string[] path, PathIn
888888
}
889889
}
890890

891-
// Resloves relative paths.
891+
// Resolves relative paths.
892892
try
893893
{
894894
for (int i = 0; i < validModPaths.Count; i++)

Engine/ScriptAnalyzerEngine.csproj

Lines changed: 114 additions & 113 deletions
Original file line numberDiff line numberDiff line change
@@ -1,114 +1,115 @@
1-
<?xml version="1.0" encoding="utf-8"?>
2-
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3-
<PropertyGroup>
4-
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5-
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
6-
<ProjectGuid>{F4BDE3D0-3EEF-4157-8A3E-722DF7ADEF60}</ProjectGuid>
7-
<OutputType>Library</OutputType>
8-
<NoStandardLibraries>false</NoStandardLibraries>
9-
<AssemblyName>Microsoft.Windows.PowerShell.ScriptAnalyzer</AssemblyName>
10-
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
11-
<FileAlignment>512</FileAlignment>
12-
<TargetFrameworkProfile />
13-
</PropertyGroup>
14-
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
15-
<DebugSymbols>true</DebugSymbols>
16-
<DebugType>full</DebugType>
17-
<Optimize>false</Optimize>
18-
<OutputPath>bin\Debug\</OutputPath>
19-
<DefineConstants>DEBUG;TRACE</DefineConstants>
20-
<ErrorReport>prompt</ErrorReport>
21-
<WarningLevel>4</WarningLevel>
22-
<Prefer32Bit>false</Prefer32Bit>
23-
</PropertyGroup>
24-
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
25-
<DebugType>pdbonly</DebugType>
26-
<Optimize>true</Optimize>
27-
<OutputPath>bin\Release\</OutputPath>
28-
<DefineConstants>TRACE</DefineConstants>
29-
<ErrorReport>prompt</ErrorReport>
30-
<WarningLevel>4</WarningLevel>
31-
<Prefer32Bit>false</Prefer32Bit>
32-
</PropertyGroup>
33-
<PropertyGroup>
34-
<RootNamespace>Microsoft.Windows.PowerShell.ScriptAnalyzer</RootNamespace>
35-
</PropertyGroup>
36-
<ItemGroup>
37-
<Reference Include="Microsoft.CSharp" />
38-
<Reference Include="System" />
39-
<Reference Include="System.ComponentModel.Composition" />
40-
<Reference Include="System.Core" />
41-
<Reference Include="System.Data" />
42-
<Reference Include="System.Data.DataSetExtensions" />
43-
<Reference Include="System.Management.Automation, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
44-
<SpecificVersion>False</SpecificVersion>
45-
<HintPath>..\..\..\..\..\..\fbl_srv2_ci_mgmt.binaries.amd64chk\monad\System.Management.Automation.dll</HintPath>
46-
</Reference>
47-
<Reference Include="System.Xml" />
48-
<Reference Include="System.Xml.Linq" />
49-
</ItemGroup>
50-
<ItemGroup>
51-
<Compile Include="Commands\GetScriptAnalyzerRuleCommand.cs" />
52-
<Compile Include="Commands\InvokeScriptAnalyzerCommand.cs" />
53-
<Compile Include="Generic\AvoidCmdletGeneric.cs" />
54-
<Compile Include="Generic\AvoidParameterGeneric.cs" />
55-
<Compile Include="Generic\SuppressedRecord.cs" />
56-
<Compile Include="Generic\DiagnosticRecord.cs" />
57-
<Compile Include="Generic\ExternalRule.cs" />
58-
<Compile Include="Generic\IDSCResourceRule.cs" />
59-
<Compile Include="Generic\IExternalRule.cs" />
60-
<Compile Include="Generic\ILogger.cs" />
61-
<Compile Include="Generic\IRule.cs" />
62-
<Compile Include="Generic\IScriptRule.cs" />
63-
<Compile Include="Generic\ITokenRule.cs" />
64-
<Compile Include="Generic\LoggerInfo.cs" />
65-
<Compile Include="Generic\RuleInfo.cs" />
66-
<Compile Include="Generic\RuleSuppression.cs" />
67-
<Compile Include="Generic\RuleSeverity.cs" />
68-
<Compile Include="Generic\SkipNamedBlock.cs" />
69-
<Compile Include="Generic\SkipTypeDefinition.cs" />
70-
<Compile Include="Generic\SourceType.cs" />
71-
<Compile Include="Helper.cs" />
72-
<Compile Include="IOutputWriter.cs" />
73-
<Compile Include="Loggers\WriteObjectsLogger.cs" />
74-
<Compile Include="SafeDirectoryCatalog.cs" />
75-
<Compile Include="ScriptAnalyzer.cs" />
76-
<Compile Include="SpecialVars.cs" />
77-
<Compile Include="Strings.Designer.cs">
78-
<AutoGen>True</AutoGen>
79-
<DesignTime>True</DesignTime>
80-
<DependentUpon>Strings.resx</DependentUpon>
81-
</Compile>
82-
<Compile Include="VariableAnalysis.cs" />
83-
<Compile Include="VariableAnalysisBase.cs" />
84-
</ItemGroup>
85-
<ItemGroup>
86-
<None Include="PSScriptAnalyzer.psd1" />
87-
<None Include="ScriptAnalyzer.format.ps1xml" />
88-
<None Include="ScriptAnalyzer.types.ps1xml" />
89-
</ItemGroup>
90-
<ItemGroup>
91-
<EmbeddedResource Include="Strings.resx">
92-
<Generator>ResXFileCodeGenerator</Generator>
93-
<LastGenOutput>Strings.Designer.cs</LastGenOutput>
94-
</EmbeddedResource>
95-
</ItemGroup>
96-
<ItemGroup>
97-
<Content Include="about_PSScriptAnalyzer.help.txt" />
98-
</ItemGroup>
99-
<Import Project="$(MSBuildToolsPath)\Microsoft.CSHARP.Targets" />
100-
<ProjectExtensions>
101-
<VisualStudio AllowExistingFolder="true" />
102-
</ProjectExtensions>
103-
<PropertyGroup>
104-
<PostBuildEvent>mkdir "$(SolutionDir)$(SolutionName)"
105-
copy /y "$(ProjectDir)\*.ps1xml" "$(SolutionDir)$(SolutionName)"
106-
copy /y "$(ProjectDir)\*.psd1" "$(SolutionDir)$(SolutionName)"
107-
mkdir "$(SolutionDir)$(SolutionName)\Configurations"
108-
copy /y "$(ProjectDir)\Configurations\*.psd1" "$(SolutionDir)$(SolutionName)\Configurations"
109-
copy /y "$(TargetPath)" "$(SolutionDir)$(SolutionName)"
110-
mkdir "$(SolutionDir)$(SolutionName)\en-US"
111-
copy /y "$(ProjectDir)\about_*.help.txt" "$(SolutionDir)$(SolutionName)\en-US"
112-
copy /y "$(ProjectDir)\*Help.xml" "$(SolutionDir)$(SolutionName)\en-US"</PostBuildEvent>
113-
</PropertyGroup>
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
6+
<ProjectGuid>{F4BDE3D0-3EEF-4157-8A3E-722DF7ADEF60}</ProjectGuid>
7+
<OutputType>Library</OutputType>
8+
<NoStandardLibraries>false</NoStandardLibraries>
9+
<AssemblyName>Microsoft.Windows.PowerShell.ScriptAnalyzer</AssemblyName>
10+
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
11+
<FileAlignment>512</FileAlignment>
12+
<TargetFrameworkProfile />
13+
</PropertyGroup>
14+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
15+
<DebugSymbols>true</DebugSymbols>
16+
<DebugType>full</DebugType>
17+
<Optimize>false</Optimize>
18+
<OutputPath>bin\Debug\</OutputPath>
19+
<DefineConstants>DEBUG;TRACE</DefineConstants>
20+
<ErrorReport>prompt</ErrorReport>
21+
<WarningLevel>4</WarningLevel>
22+
<Prefer32Bit>false</Prefer32Bit>
23+
</PropertyGroup>
24+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
25+
<DebugType>pdbonly</DebugType>
26+
<Optimize>true</Optimize>
27+
<OutputPath>bin\Release\</OutputPath>
28+
<DefineConstants>TRACE</DefineConstants>
29+
<ErrorReport>prompt</ErrorReport>
30+
<WarningLevel>4</WarningLevel>
31+
<Prefer32Bit>false</Prefer32Bit>
32+
</PropertyGroup>
33+
<PropertyGroup>
34+
<RootNamespace>Microsoft.Windows.PowerShell.ScriptAnalyzer</RootNamespace>
35+
</PropertyGroup>
36+
<ItemGroup>
37+
<Reference Include="Microsoft.CSharp" />
38+
<Reference Include="System" />
39+
<Reference Include="System.ComponentModel.Composition" />
40+
<Reference Include="System.Core" />
41+
<Reference Include="System.Data" />
42+
<Reference Include="System.Data.DataSetExtensions" />
43+
<Reference Include="System.Management.Automation, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
44+
<SpecificVersion>False</SpecificVersion>
45+
<HintPath>..\..\..\..\..\..\fbl_srv2_ci_mgmt.binaries.amd64chk\monad\System.Management.Automation.dll</HintPath>
46+
</Reference>
47+
<Reference Include="System.Xml" />
48+
<Reference Include="System.Xml.Linq" />
49+
</ItemGroup>
50+
<ItemGroup>
51+
<Compile Include="Commands\GetScriptAnalyzerRuleCommand.cs" />
52+
<Compile Include="Commands\InvokeScriptAnalyzerCommand.cs" />
53+
<Compile Include="Generic\AvoidCmdletGeneric.cs" />
54+
<Compile Include="Generic\AvoidParameterGeneric.cs" />
55+
<Compile Include="Generic\SuppressedRecord.cs" />
56+
<Compile Include="Generic\DiagnosticRecord.cs" />
57+
<Compile Include="Generic\ExternalRule.cs" />
58+
<Compile Include="Generic\IDSCResourceRule.cs" />
59+
<Compile Include="Generic\IExternalRule.cs" />
60+
<Compile Include="Generic\ILogger.cs" />
61+
<Compile Include="Generic\IRule.cs" />
62+
<Compile Include="Generic\IScriptRule.cs" />
63+
<Compile Include="Generic\ITokenRule.cs" />
64+
<Compile Include="Generic\LoggerInfo.cs" />
65+
<Compile Include="Generic\RuleInfo.cs" />
66+
<Compile Include="Generic\RuleSuppression.cs" />
67+
<Compile Include="Generic\RuleSeverity.cs" />
68+
<Compile Include="Generic\SkipNamedBlock.cs" />
69+
<Compile Include="Generic\SkipTypeDefinition.cs" />
70+
<Compile Include="Generic\SourceType.cs" />
71+
<Compile Include="Helper.cs" />
72+
<Compile Include="IOutputWriter.cs" />
73+
<Compile Include="Loggers\WriteObjectsLogger.cs" />
74+
<Compile Include="SafeDirectoryCatalog.cs" />
75+
<Compile Include="ScriptAnalyzer.cs" />
76+
<Compile Include="SpecialVars.cs" />
77+
<Compile Include="Strings.Designer.cs">
78+
<AutoGen>True</AutoGen>
79+
<DesignTime>True</DesignTime>
80+
<DependentUpon>Strings.resx</DependentUpon>
81+
</Compile>
82+
<Compile Include="VariableAnalysis.cs" />
83+
<Compile Include="VariableAnalysisBase.cs" />
84+
</ItemGroup>
85+
<ItemGroup>
86+
<None Include="PSScriptAnalyzer.psd1" />
87+
<None Include="ScriptAnalyzer.format.ps1xml" />
88+
<None Include="ScriptAnalyzer.types.ps1xml" />
89+
</ItemGroup>
90+
<ItemGroup>
91+
<EmbeddedResource Include="Strings.resx">
92+
<Generator>ResXFileCodeGenerator</Generator>
93+
<LastGenOutput>Strings.Designer.cs</LastGenOutput>
94+
</EmbeddedResource>
95+
</ItemGroup>
96+
<ItemGroup>
97+
<Content Include="about_PSScriptAnalyzer.help.txt" />
98+
</ItemGroup>
99+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSHARP.Targets" />
100+
<ProjectExtensions>
101+
<VisualStudio AllowExistingFolder="true" />
102+
</ProjectExtensions>
103+
<PropertyGroup>
104+
<PostBuildEvent>
105+
if not exist "$(SolutionDir)$(SolutionName)" mkdir "$(SolutionDir)$(SolutionName)"
106+
copy /y "$(ProjectDir)*.ps1xml" "$(SolutionDir)$(SolutionName)"
107+
copy /y "$(ProjectDir)*.psd1" "$(SolutionDir)$(SolutionName)"
108+
if not exist "$(SolutionDir)$(SolutionName)\Configurations" mkdir "$(SolutionDir)$(SolutionName)\Configurations"
109+
copy /y "$(ProjectDir)Configurations\*.psd1" "$(SolutionDir)$(SolutionName)\Configurations"
110+
copy /y "$(TargetPath)" "$(SolutionDir)$(SolutionName)"
111+
if not exist "$(SolutionDir)$(SolutionName)\en-US" mkdir "$(SolutionDir)$(SolutionName)\en-US"
112+
copy /y "$(ProjectDir)about_*.help.txt" "$(SolutionDir)$(SolutionName)\en-US"
113+
copy /y "$(ProjectDir)*Help.xml" "$(SolutionDir)$(SolutionName)\en-US"</PostBuildEvent>
114+
</PropertyGroup>
114115
</Project>

Engine/VariableAnalysis.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ private void ProcessParameters(IEnumerable<ParameterAst> parameters)
133133
}
134134

135135
/// <summary>
136-
/// Used to analyze scriptbloct, functionmemberast or functiondefinitionast
136+
/// Used to analyze scriptblock, functionmemberast or functiondefinitionast
137137
/// </summary>
138138
/// <param name="ast"></param>
139139
/// <returns></returns>

Engine/VariableAnalysisBase.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,7 @@ internal static Block[] SetDominators(Block entry, List<Block> Blocks)
552552

553553
Block dom = block._predecessors[0];
554554

555-
// Get first proccessed node
555+
// Get first processed node
556556
foreach (var pred in block._predecessors)
557557
{
558558
if (dominators[pred.PostOrder] != null)
@@ -828,14 +828,14 @@ internal static Tuple<Dictionary<string, VariableAnalysisDetails>, Dictionary<st
828828
}
829829
}
830830

831-
// Initialize variables in internaldictionary to undetermined
831+
// Initialize variables in internal dictionary to undetermined
832832
foreach (var key in InternalVariablesDictionary.Keys.ToList())
833833
{
834834
InternalVariablesDictionary[key].Constant = Undetermined.UndeterminedConstant;
835835
InternalVariablesDictionary[key].Type = typeof(Undetermined);
836836
}
837837

838-
// Initialze DefinedBlock of phi function. If it is null then that phi function is not initialized;
838+
// Initialize DefinedBlock of phi function. If it is null then that phi function is not initialized;
839839
foreach (var block in blocks)
840840
{
841841
foreach (var phi in block.Phis)
@@ -956,7 +956,7 @@ internal static Tuple<Dictionary<string, VariableAnalysisDetails>, Dictionary<st
956956
{
957957
CommandExpressionAst cmeAst = assigned._rightAst as CommandExpressionAst;
958958
MemberExpressionAst memAst = (cmeAst != null) ? (cmeAst.Expression as MemberExpressionAst) : null;
959-
// Don't handle the this case because this is handled in assignmenttarget
959+
// Don't handle the this case because this is handled in assignment target
960960

961961
if (memAst != null && memAst.Expression is VariableExpressionAst)
962962
{
@@ -2042,7 +2042,7 @@ public object VisitNamedAttributeArgument(NamedAttributeArgumentAst namedAttribu
20422042
/// <returns></returns>
20432043
public object VisitParameter(ParameterAst parameterAst)
20442044
{
2045-
// Nothing to do now, we've already allocated parameters in the first pass looking for all variable naems.
2045+
// Nothing to do now, we've already allocated parameters in the first pass looking for all variable names.
20462046
System.Diagnostics.Debug.Assert(false, "Code is unreachable");
20472047
return null;
20482048
}
@@ -2812,7 +2812,7 @@ public object VisitBinaryExpression(BinaryExpressionAst binaryExpressionAst)
28122812
// left operand is always evaluated, visit it's expression in the current block.
28132813
binaryExpressionAst.Left.Visit(this.Decorator);
28142814

2815-
// The right operand is condtionally evaluated. We aren't generating any code here, just
2815+
// The right operand is conditionally evaluated. We aren't generating any code here, just
28162816
// modeling the flow graph, so we just visit the right operand in a new block, and have
28172817
// both the current and new blocks both flow to a post-expression block.
28182818
var targetBlock = new Block();

0 commit comments

Comments
 (0)