All Projects → MathieuBuisson → Pscodehealth

MathieuBuisson / Pscodehealth

Licence: mit
PowerShell module gathering PowerShell code quality and maintainability metrics

Programming Languages

powershell
5483 projects

Projects that are alternatives of or similar to Pscodehealth

Htmlhint
⚙️ The static code analysis tool you need for your HTML
Stars: ✭ 2,723 (+2518.27%)
Mutual labels:  code-quality, code-analysis
jdepend
A Java package dependency analyzer that generates design quality metrics.
Stars: ✭ 13 (-87.5%)
Mutual labels:  code-analysis, code-quality
Detekt Intellij Plugin
detekt plugin for IntelliJ
Stars: ✭ 150 (+44.23%)
Mutual labels:  code-quality, code-analysis
static-code-analysis-plugin
A plugin to simplify Static Code Analysis on Gradle. Not restricted to, but specially useful, in Android projects, by making sure all analysis can access the SDK classes.
Stars: ✭ 36 (-65.38%)
Mutual labels:  code-analysis, code-quality
Sonar Kotlin
SonarQube plugin for Kotlin
Stars: ✭ 412 (+296.15%)
Mutual labels:  code-quality, code-analysis
Pdepend
PHP_Depend is an adaptation of the established Java development tool JDepend. This tool shows you the quality of your design in terms of extensibility, reusability and maintainability.
Stars: ✭ 727 (+599.04%)
Mutual labels:  code-quality, code-analysis
code-assert
Assert that the java code of a project satisfies certain checks.
Stars: ✭ 94 (-9.62%)
Mutual labels:  code-analysis, code-quality
Wotan
Pluggable TypeScript and JavaScript linter
Stars: ✭ 271 (+160.58%)
Mutual labels:  code-quality, code-analysis
Pmd
An extensible multilanguage static code analyzer.
Stars: ✭ 3,667 (+3425.96%)
Mutual labels:  code-quality, code-analysis
Phpdependencyanalysis
Static code analysis to find violations in a dependency graph
Stars: ✭ 505 (+385.58%)
Mutual labels:  code-quality, code-analysis
App Githooks
Plugin-based system to run specific actions and checks when git hooks are triggered.
Stars: ✭ 5 (-95.19%)
Mutual labels:  code-quality, code-analysis
Enhanced Syntax Highlighting
[Marketplace] Lightweight "editor classifier extension" for Visual Studio based on the async Roslyn APIs to enhanced highlighting custom tags in C# code.
Stars: ✭ 69 (-33.65%)
Mutual labels:  code-analysis
Php Language Server
PHP Implementation of the VS Code Language Server Protocol 🆚↔🖥
Stars: ✭ 1,019 (+879.81%)
Mutual labels:  code-analysis
Unused
Deprecated; see https://github.com/unused-code/unused
Stars: ✭ 879 (+745.19%)
Mutual labels:  code-quality
Phpqa
Docker image that provides static analysis tools for PHP
Stars: ✭ 853 (+720.19%)
Mutual labels:  code-quality
Code Checker
✅ A simple tool to check source code against a set of Nette coding standards.
Stars: ✭ 76 (-26.92%)
Mutual labels:  code-analysis
Static Analysis
⚙️ A curated list of static analysis (SAST) tools for all programming languages, config files, build tools, and more.
Stars: ✭ 9,310 (+8851.92%)
Mutual labels:  code-quality
Ruby warning filter
Verbose Ruby mode without the noise
Stars: ✭ 9 (-91.35%)
Mutual labels:  code-quality
Janett
Java to C#.Net Translator
Stars: ✭ 8 (-92.31%)
Mutual labels:  code-analysis
Feflow
🚀 A command line tool aims to improve front-end engineer workflow and standard, powered by TypeScript.
Stars: ✭ 942 (+805.77%)
Mutual labels:  code-quality

PSCodeHealth      PSCodeHealth Logo

Build status Coverage Status Documentation Status PS Gallery

Overview

"If you can't measure it, you can't improve it."
Peter Drucker

PSCodeHealth allows you to measure the quality and maintainability of your PowerShell code, based on a variety of metrics related to :

  • Code length
  • Code complexity
  • Code smells, styling issues and violations of best practices
  • Tests and test coverage
  • Comment-based help

It can allow you to ensure that your code is compliant with metrics goals (quality gates). You can use the default (built-in) compliance rules, and you can also customize some (or all) compliance rules to fit your goals.

These features can be leveraged from within your PowerShell release pipeline.

PSCodeHealth can also generate a highly visual HTML report so that you can interpret the results at a glance, and easily share them.
For example, here is what the Summary tab looks like :
HTML report - Summary section
 

And here is an example of what the Style & Best Practices tab looks like :
HTML report - Style & Best Practices section

Requirements

Before using PSCodeHealth, you need :

  • PowerShell 5.x
  • The Pester PowerShell module (version 3.4.0 or later)
  • The PSScriptAnalyzer PowerShell module
  • Internet access when opening the HTML report (to download some CSS and Javascript for Bootstrap, jQuery and Chart.js)

Installation

From the PowerShell Gallery

The easiest and preferred way to install PSCodeHealth is via the PowerShell Gallery. For more information, see the PowerShell Gallery Getting Started page.

Run the following command to install PSCodeHealth and its 2 dependencies (Pester and PSScriptAnalyzer) :

Install-Module -Name PSCodeHealth -Repository PSGallery

From Chocolatey

If you prefer to manage PSCodeHealth as a Windows package, you can use Chocolatey. If you don't have Chocolatey, you can install it from the Chocolately Install page. With Chocolatey installed, execute the following command to install:

choco install pscodehealth

Note: the PSCodeHealth Chocolatey package is provided and supported by the community.

From Github

As an alternative, you can clone this repository to a location on your system and copy the PSCodeHealth subfolder into : C:\Program Files\WindowsPowerShell\Modules\.

Getting Started

To evaluate the code quality of a single script, simply use the Invoke-PSCodeHealth command.
Specify the relative or full path of the script file via the Path parameter and specify the location of the tests via the TestsPath parameter, like so :

PS C:\> Invoke-PSCodeHealth -Path '.\coveralls\Coveralls.ps1' -TestsPath '.\coveralls'

Files    Functions      LOC (Average)  Findings       Findings       Complexity    Test Coverage
                                       (Total)        (Average)      (Average)                  
-----    ---------      -------------  -------------- -------------- ------------- -------------
1        9              22.33          0              0              2             39.58 %      

To evaluate the code quality of all the PowerShell code in a directory, specify the relative or full path of the directory via the Path parameter, like so :

PS C:\> Invoke-PSCodeHealth -Path '.\coveralls' -TestsPath '.\coveralls'

Files    Functions      LOC (Average)  Findings       Findings       Complexity    Test Coverage
                                       (Total)        (Average)      (Average)                  
-----    ---------      -------------  -------------- -------------- ------------- -------------
3        9              22.33          0              0              2             38.78 %      

To view the per-function information, access the FunctionHealthRecords property of the output of Invoke-PSCodeHealth :

C:\> $HealthReport = Invoke-PSCodeHealth -Path '.\coveralls' -TestsPath '.\coveralls'
C:\> $HealthReport.FunctionHealthRecords

Function Name               Lines of Code   Complexity     Contains Help  Test Coverage  ScriptAnalyzer
                                                                                            Findings   
-------------               -------------   ----------     -------------  -------------  --------------
Add-CoverageInfo            14              1              False          0 %                  0       
Merge-CoverageResult        21              1              False          0 %                  0       
Get-CoverageArray           30              5              False          94.44 %              0       
Format-FileCoverage         24              2              False          100 %                0       
Get-CommandsForFile         16              1              False          100 %                0       
Get-GitInfo                 23              2              False          0 %                  0       
Format-Coverage             39              3              False          0 %                  0       
Publish-Coverage            18              1              False          0 %                  0       
Get-CoveragePercentage      16              2              False          100 %                0       

To output the PSCodeHealth report as an HTML file, use the HtmlReportPath parameter to specify the full path of the HTML file :

C:\> Invoke-PSCodeHealth -Path '.\coveralls' -TestsPath '.\coveralls' -HtmlReportPath "$env:USERPROFILE\Desktop\Report.html"

The above command will not output anything to the PowerShell pipeline, unless you add the PassThru parameter.

Want to know more ? Head to the full documentation :
http://pscodehealth.readthedocs.io/en/latest/

Contributing to PSCodeHealth

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

  1. Submit issues. In this case, please use the project's issue template.
  2. Submit a fix for an issue.
  3. Submit a feature request.
  4. Submit test cases.
  5. Tell others about the project.
  6. Tell the developers how much you appreciate the project !

For more information on how to contribute to PSCodeHealth, please refer to the contributing guidelines document.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].