From f01eceba4e7f963e13e4f8d1e86bb0806c5198ea Mon Sep 17 00:00:00 2001 From: Joey Aiello Date: Tue, 31 Mar 2015 13:29:03 -0700 Subject: [PATCH] Converted to GFM Reworked everything from HTML to GFM. Should be easier to maintain going forward. --- README.md | 142 ++++++++++++++++++++---------------------------------- 1 file changed, 52 insertions(+), 90 deletions(-) diff --git a/README.md b/README.md index 98b38005d..9ebd7531c 100644 --- a/README.md +++ b/README.md @@ -1,111 +1,73 @@ - - - - - -

Introduction

+Introduction +============ -

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.

+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. -

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.

+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. -

 

+ScriptAnalyzer cmdlets +====================== +``` +Get-ScriptAnalyzerRule [-CustomizedRulePath ] [-Name ] [] -

ScriptAnalyzer cmdlets:

+Invoke-ScriptAnalyzer [-Path] [-CustomizedRulePath ] [-ExcludeRule ] [-IncludeRule ] [-Severity ] [-Recurse] [] +``` -

Get-ScriptAnalyzerRule  [-CustomizedRulePath <string[]>]
-                                             [-Name <string[]>]
-                                             [<CommonParameters>]

+Requirements +============ -


-Invoke-ScriptAnalyzer [-Path] <string> [-CustomizedRulePath <string[]>] 
-                                          [-ExcludeRule <string[]>] 
-                                          [-IncludeRule <string[]>] 
-                                          [-Severity <string[]>] 
-                                          [-Recurse] 
-                                          [<CommonParameters>]

+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). -

 

+Installation +============ -

 

+1. Build the Code using Visual Studio -

Requirements

+2. Copy following files to ```$env:ProgramFiles\WindowsPowerShell\Modules\ScriptAnalyzer``` -

WS2012R2 / Windows 8.1 / Windows OS containing PowerShell v5.0 which can be obtained using Windows Management Framework 5.0 Preview February 2015.

+3. In PowerShell Console: +```powershell +Import-Module $env:ProgramFiles\WindowsPowerShell\Modules\ScriptAnalyzer\PSScriptAnalyzer.psd1 +``` -

 

+To confirm installation: run ```Get-ScriptAnalyzerRule``` in the PowerShell console to obtain the built-in rules -

Installation

+Building the Code +================= -

1)      Build the Code using Visual Studio

+Use Visual Studio or any C# compiler to build the code -

2)      Copy following files to $env:ProgramFiles\WindowsPowerShell\Modules\ScriptAnalyzer

+Running Tests +============= -

3)      In PowerShell Console :
-Import-Module $env:ProgramFiles\WindowsPowerShell\Modules\ScriptAnalyzer\PSScriptAnalyzer.psd1

+Pester-based ScriptAnalyzer Tests are located in ```/ScriptAnalyzer/Tests``` folder -

To confirm installation:

+* 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) + -

·         Run Get-ScriptAnalyzerRule in the PowerShell console to obtain the built-in rules

+Contributing to ScriptAnalyzer +============================== -

 

+You are welcome to contribute to this project. There are many ways to contribute: -


-Building the Code

+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! -

Use Visual Studio or any C# compiler to build the code

+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. -

 

- -


-Running Tests

- -

Pester based ScriptAnalyzer Tests are located in “<branch>/ScriptAnalyzer/Tests” folder

- -
    -
  • 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)
      -  
    • -
    -
  • -
- -


-Contributing to ScriptAnalyzer

- -

You are welcome to contribute to this project. There are many ways to contribute:

- -
    -
  • Submit a bug report via Issues. For a guide to submitting good bug reports, please read Painless Bug Tracking.
  • -
  • Verify fixes for bugs.
  • -
  • 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
    • -
    -
  • -
  • Submit a feature request.
  • -
  • Help answer questions in the discussions list.
  • -
  • Submit test cases.
  • -
  • Tell others about the project.
  • -
  • Tell the developers how much you appreciate the product!
  • -
- -


-You might also read these two blog posts about contributing code: Open Source Contribution Etiquette by Miguel de Icaza, and Don’t “Push” Your Pull Requests by Ilya Grigorik.

- -

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.

- -

 

- - +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.