Skip to content

Converted to GFM #1

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 1 commit into from
Mar 31, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
142 changes: 52 additions & 90 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,111 +1,73 @@
<html>
<head>
<title></title>
</head>
<body>
<p><strong>Introduction</strong></p>
Introduction
============

<p>ScriptAnalyzer is a static code checker for Windows PowerShell modules and scripts. ScriptAnalyzer checks the quality of Windows PowerShell code by running a set of rules. The rules are based on PowerShell best practices identified by PowerShell Team and the community. It generates DiagnosticResults (errors and warnings) to inform users about potential code defects and suggests possible solutions for improvements.</p>
ScriptAnalyzer is a static code checker for Windows PowerShell modules and scripts. ScriptAnalyzer checks the quality of Windows PowerShell code by running a set of rules. The rules are based on PowerShell best practices identified by PowerShell Team and the community. It generates DiagnosticResults (errors and warnings) to inform users about potential code defects and suggests possible solutions for improvements.

<p>ScriptAnalyzer is shipped with a collection of built-in rules that checks various aspects of PowerShell code such as presence of uninitialized variables, usage of PSCredential Type, usage of Invoke-Expression etc. Additional functionalities such as exclude/include specific rules are also supported.</p>
ScriptAnalyzer is shipped with a collection of built-in rules that checks various aspects of PowerShell code such as presence of uninitialized variables, usage of PSCredential Type, usage of Invoke-Expression etc. Additional functionalities such as exclude/include specific rules are also supported.

<p>&nbsp;</p>
ScriptAnalyzer cmdlets
======================
```
Get-ScriptAnalyzerRule [-CustomizedRulePath <string[]>] [-Name <string[]>] [<CommonParameters>]

<p><strong>ScriptAnalyzer cmdlets:</strong></p>
Invoke-ScriptAnalyzer [-Path] <string> [-CustomizedRulePath <string[]>] [-ExcludeRule <string[]>] [-IncludeRule <string[]>] [-Severity <string[]>] [-Recurse] [<CommonParameters>]
```

<p>Get-ScriptAnalyzerRule &nbsp;[-CustomizedRulePath &lt;string[]&gt;]<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[-Name &lt;string[]&gt;]<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[&lt;CommonParameters&gt;]</p>
Requirements
============

<p><br />
Invoke-ScriptAnalyzer [-Path] &lt;string&gt; [-CustomizedRulePath &lt;string[]&gt;]&nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [-ExcludeRule &lt;string[]&gt;]&nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [-IncludeRule &lt;string[]&gt;]&nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [-Severity &lt;string[]&gt;]&nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [-Recurse]&nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [&lt;CommonParameters&gt;]</p>
WS2012R2 / Windows 8.1 / Windows OS running PowerShell v5.0 which can be obtained using [Windows Management Framework 5.0 Preview February 2015](http://go.microsoft.com/fwlink/?LinkId=398175).

<p>&nbsp;</p>
Installation
============

<p>&nbsp;</p>
1. Build the Code using Visual Studio

<p><strong>Requirements</strong></p>
2. Copy following files to ```$env:ProgramFiles\WindowsPowerShell\Modules\ScriptAnalyzer```

<p>WS2012R2 / Windows 8.1 / Windows OS containing PowerShell v5.0 which can be obtained using Windows Management Framework 5.0 Preview February 2015.</p>
3. In PowerShell Console:
```powershell
Import-Module $env:ProgramFiles\WindowsPowerShell\Modules\ScriptAnalyzer\PSScriptAnalyzer.psd1
```

<p>&nbsp;</p>
To confirm installation: run ```Get-ScriptAnalyzerRule``` in the PowerShell console to obtain the built-in rules

<p><strong>Installation</strong></p>
Building the Code
=================

<p>1) &nbsp; &nbsp; &nbsp;Build the Code using Visual Studio</p>
Use Visual Studio or any C# compiler to build the code

<p>2) &nbsp; &nbsp; &nbsp;Copy following files to $env:ProgramFiles\WindowsPowerShell\Modules\ScriptAnalyzer</p>
Running Tests
=============

<p>3) &nbsp; &nbsp; &nbsp;In PowerShell Console :<br />
Import-Module $env:ProgramFiles\WindowsPowerShell\Modules\ScriptAnalyzer\PSScriptAnalyzer.psd1</p>
Pester-based ScriptAnalyzer Tests are located in ```<branch>/ScriptAnalyzer/Tests``` folder

<p>To confirm installation:</p>
* Ensure Pester is installed on the machine
* Go the Tests folder in your local repository
* Run Engine Tests:
.\InvokeScriptAnalyzer.tests.ps1
* Run Tests for Built-in rules:
.\*.ps1 (Example - .\ AvoidConvertToSecureStringWithPlainText.ps1)


<p>&middot; &nbsp; &nbsp; &nbsp; &nbsp; Run Get-ScriptAnalyzerRule in the PowerShell console to obtain the built-in rules</p>
Contributing to ScriptAnalyzer
==============================

<p>&nbsp;</p>
You are welcome to contribute to this project. There are many ways to contribute:

<p><br />
<strong>Building the Code</strong></p>
1. Submit a bug report via [Issues]( https://github.com/PowerShell/ScriptAnalyzer/issues). For a guide to submitting good bug reports, please read [Painless Bug Tracking](http://www.joelonsoftware.com/articles/fog0000000029.html).
2. Verify fixes for bugs.
3. Submit your fixes for a bug. Before submitting, please make sure you have:
* Performed code reviews of your own
* Updated the test cases if needed
* Run the test cases to ensure no feature breaks or test breaks
* Added the test cases for new code
4. Submit a feature request.
5. Help answer questions in the discussions list.
6. Submit test cases.
7. Tell others about the project.
8. Tell the developers how much you appreciate the product!

<p>Use Visual Studio or any C# compiler to build the code</p>
You might also read these two blog posts about contributing code: [Open Source Contribution Etiquette](http://tirania.org/blog/archive/2010/Dec-31.html) by Miguel de Icaza, and [Don’t “Push” Your Pull Requests](http://www.igvita.com/2011/12/19/dont-push-your-pull-requests/) by Ilya Grigorik.

<p>&nbsp;</p>

<p><br />
<strong>Running Tests</strong></p>

<p>Pester based ScriptAnalyzer Tests are located in &ldquo;&lt;branch&gt;/ScriptAnalyzer/Tests&rdquo; folder</p>

<ul>
<li>Ensure Pester is installed on the machine</li>
<li>Go the Tests folder in your local repository</li>
<li>Run Engine Tests:
<ul>
<li>.\InvokeScriptAnalyzer.tests.ps1</li>
</ul>
</li>
<li>Run Tests for Built-in rules:
<ul>
<li>.\*.ps1 (Example - .\ AvoidConvertToSecureStringWithPlainText.ps1)<br />
&nbsp;</li>
</ul>
</li>
</ul>

<p><br />
<strong>Contributing to ScriptAnalyzer</strong></p>

<p>You are welcome to contribute to this project. There are many ways to contribute:</p>

<ul>
<li>Submit a bug report via Issues. For a guide to submitting good bug reports, please read Painless Bug Tracking.</li>
<li>Verify fixes for bugs.</li>
<li>Submit your fixes for a bug. Before submitting, please make sure you have:
<ul>
<li>Performed code reviews of your own</li>
<li>Updated the test cases if needed</li>
<li>Run the test cases to ensure no feature breaks or test breaks</li>
<li>Added the test cases for new code</li>
</ul>
</li>
<li>Submit a feature request.</li>
<li>Help answer questions in the discussions list.</li>
<li>Submit test cases.</li>
<li>Tell others about the project.</li>
<li>Tell the developers how much you appreciate the product!</li>
</ul>

<p><br />
You might also read these two blog posts about contributing code: Open Source Contribution Etiquette by Miguel de Icaza, and Don&rsquo;t &ldquo;Push&rdquo; Your Pull Requests by Ilya Grigorik.</p>

<p>Before submitting a feature or substantial code contribution, please discuss it with the Windows PowerShell team via Issues, and ensure it follows the product roadmap. Note that all code submissions will be rigorously reviewed by the Windows PowerShell Team. Only those that meet a high bar for both quality and roadmap fit will be merged into the source.</p>

<p>&nbsp;</p>
</body>
</html>
Before submitting a feature or substantial code contribution, please discuss it with the Windows PowerShell team via [Issues](https://github.com/PowerShell/ScriptAnalyzer/issues), and ensure it follows the product roadmap. Note that all code submissions will be rigorously reviewed by the Windows PowerShell Team. Only those that meet a high bar for both quality and roadmap fit will be merged into the source.