{"id":13570516,"url":"https://github.com/PowerShell/PSScriptAnalyzer","last_synced_at":"2025-04-04T07:31:37.657Z","repository":{"id":29608820,"uuid":"33149177","full_name":"PowerShell/PSScriptAnalyzer","owner":"PowerShell","description":"Download ScriptAnalyzer from PowerShellGallery","archived":false,"fork":false,"pushed_at":"2025-03-20T20:05:46.000Z","size":26542,"stargazers_count":1938,"open_issues_count":380,"forks_count":391,"subscribers_count":114,"default_branch":"main","last_synced_at":"2025-04-03T09:49:07.647Z","etag":null,"topics":["analyzer","formatter","hacktoberfest","linter","powershell","powershell-gallery","scriptanalyzer"],"latest_commit_sha":null,"homepage":"https://www.powershellgallery.com/packages/PSScriptAnalyzer/","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PowerShell.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.MD","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-03-30T21:26:25.000Z","updated_at":"2025-04-01T16:50:34.000Z","dependencies_parsed_at":"2023-02-15T13:16:14.982Z","dependency_job_id":"66e71ab8-2512-414d-9b57-11710ec8de03","html_url":"https://github.com/PowerShell/PSScriptAnalyzer","commit_stats":{"total_commits":2147,"total_committers":108,"mean_commits":19.87962962962963,"dds":0.5486725663716814,"last_synced_commit":"f7304c77fbbc1b237c70b6f731cccd54a457bea2"},"previous_names":[],"tags_count":35,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PowerShell%2FPSScriptAnalyzer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PowerShell%2FPSScriptAnalyzer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PowerShell%2FPSScriptAnalyzer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PowerShell%2FPSScriptAnalyzer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PowerShell","download_url":"https://codeload.github.com/PowerShell/PSScriptAnalyzer/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247138711,"owners_count":20890093,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["analyzer","formatter","hacktoberfest","linter","powershell","powershell-gallery","scriptanalyzer"],"created_at":"2024-08-01T14:00:52.972Z","updated_at":"2025-04-04T07:31:37.650Z","avatar_url":"https://github.com/PowerShell.png","language":"C#","readme":"# PSScriptAnalyzer\n\n\u003cimg src=\"logo.png\" width=\"180\"\u003e\n\n[![Build Status](https://dev.azure.com/powershell/psscriptanalyzer/_apis/build/status/psscriptanalyzer-ci?branchName=master)](https://dev.azure.com/powershell/psscriptanalyzer/_build/latest?definitionId=80\u0026branchName=master)\n[![Join the chat at https://gitter.im/PowerShell/PSScriptAnalyzer](https://badges.gitter.im/PowerShell/PSScriptAnalyzer.svg)](https://gitter.im/PowerShell/PSScriptAnalyzer?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge\u0026utm_content=badge)\n\n## Table of Contents\n\n\u003c!-- toc --\u003e\n\n- [Introduction](#introduction)\n- [Documentation Notice](#documentation-notice)\n- [Installation](#installation)\n- [Contributions are welcome](#contributions-are-welcome)\n- [Creating a Release](#creating-a-release)\n- [Code of Conduct](#code-of-conduct)\n- [Security Policy](#security-policy)\n\n\u003c!-- tocstop --\u003e\n\n## Introduction\n\nPSScriptAnalyzer is a static code checker for PowerShell modules and scripts. PSScriptAnalyzer\nchecks the quality of PowerShell code by running a [set of rules](docs/Rules). The rules are based\non PowerShell best practices identified by PowerShell Team and the community. It generates\nDiagnosticResults (errors and warnings) to inform users about potential code defects and suggests\npossible solutions for improvements.\n\nPSScriptAnalyzer ships with a collection of built-in rules that check various aspects of\nPowerShell code such as:\n\n- The presence of uninitialized variables\n- Use of **PSCredential** type\n- Use of `Invoke-Expression`\n- And many more\n\n[Back to ToC](#table-of-contents)\n\n## DOCUMENTATION NOTICE\n\nConceptual user documentation has been moved out of the source code repository and into the\ndocumentation repository so that it can be published on learn.microsoft.com.\n\nThe goal of this migration is to have the user documentation on learn.microsoft.com. The source code\nrepository should only contain documentation for the code base, such as how to build the code or how\nto contribute to the code.\n\nUser documentation that has been migrated:\n\n- Most of the contents of this README can be found in the\n  [PSScriptAnalyzer overview](https://learn.microsoft.com/powershell/utility-modules/psscriptanalyzer/overview)\n- For cmdlet reference, see\n  [PSScriptAnalyzer](https://learn.microsoft.com/powershell/module/psscriptanalyzer)\n- For rules, see\n  [Rules overview](https://learn.microsoft.com/powershell/utility-modules/psscriptanalyzer/rules/readme)\n- The `PowerShellBestPractices.md` content has been moved to\n  [PSScriptAnalyzer rules and recommendations](https://learn.microsoft.com/powershell/utility-modules/psscriptanalyzer/rules-recommendations)\n- The `ScriptRuleDocumentation.md` content has been moved to\n  [Creating custom rules](https://learn.microsoft.com/powershell/utility-modules/psscriptanalyzer/create-custom-rule)\n\nThere is one exception - the documentation for the rules and cmdlets will remain in the [docs](docs)\nfolder to facilitate build testing and to be archived as part of each release. Only the\ndocumentation for the latest release is published on on learn.microsoft.com.\n\n## Installation\n\nTo install **PSScriptAnalyzer** from the PowerShell Gallery, see\n[Installing PSScriptAnalyzer](https://learn.microsoft.com/powershell/utility-modules/psscriptanalyzer/overview#installing-psscriptanalyzer).\n\nTo install **PSScriptAnalyzer** from source code:\n\n### Requirements\n\n- [Latest .NET 8.0 SDK](https://dotnet.microsoft.com/en-us/download/dotnet/8.0)\n- If building for Windows PowerShell versions, then the .NET Framework 4.6.2 [targeting pack](https://dotnet.microsoft.com/en-us/download/dotnet-framework/net462) (also referred to as developer/targeting pack) need to be installed. This is only possible on Windows.\n- Optional but recommended for development: [Visual Studio 2022](https://www.visualstudio.com/downloads)\n- Or [Visual Studio Code](https://code.visualstudio.com/download)\n- [Pester v5 PowerShell module, available on PowerShell Gallery](https://github.com/pester/Pester)\n- [PlatyPS PowerShell module, available on PowerShell Gallery](https://github.com/PowerShell/platyPS/releases)\n\n### Steps\n\n- Obtain the source\n  - Download the latest source code from the\n    [release page](https://github.com/PowerShell/PSScriptAnalyzer/releases) OR\n  - Clone the repository (needs git)\n\n    ```powershell\n    git clone https://github.com/PowerShell/PSScriptAnalyzer\n    ```\n\n- Navigate to the source directory\n\n  ```powershell\n  cd path/to/PSScriptAnalyzer\n  ```\n\n- Building You can either build using the `Visual Studio` solution `PSScriptAnalyzer.sln` or build\n  using `PowerShell` specifically for your platform as follows:\n  - The default build is for the currently used version of PowerShell\n\n    ```powershell\n    .\\build.ps1\n    ```\n\n  - Windows PowerShell version 5.0\n\n    ```powershell\n    .\\build.ps1 -PSVersion 5\n    ```\n\n  - PowerShell 7\n\n    ```powershell\n    .\\build.ps1 -PSVersion 7\n    ```\n\n- Rebuild documentation since it gets built automatically only the first time\n\n  ```powershell\n  .\\build.ps1 -Documentation\n  ```\n\n- Build all versions (PowerShell v5 and v7) and documentation\n\n  ```powershell\n  .\\build.ps1 -All\n  ```\n\n- Import the module\n\n  ```powershell\n  Import-Module .\\out\\PSScriptAnalyzer\\[version]\\PSScriptAnalyzer.psd1\n  ```\n\nTo confirm installation: run `Get-ScriptAnalyzerRule` in the PowerShell console to obtain the\nbuilt-in rules.\n\n- Adding/Removing resource strings\n\n  For adding/removing resource strings in the `*.resx` files, it is recommended to use\n  `Visual Studio` since it automatically updates the strongly typed `*.Designer.cs` files. The\n  `Visual Studio 2017 Community Edition` is free to use but should you not have/want to use\n  `Visual Studio` then you can either manually adapt the `*.Designer.cs` files or use the\n  `New-StronglyTypedCsFileForResx.ps1` script although the latter is discouraged since it leads to a\n  bad diff of the `*.Designer.cs` files.\n\n### Tests\n\nPester-based ScriptAnalyzer Tests are located in `path/to/PSScriptAnalyzer/Tests` folder.\n\n- Ensure [Pester](https://www.powershellgallery.com/packages/Pester) of at least version 5.3 is installed\n- In the root folder of your local repository, run:\n\n```powershell\n./build -Test\n```\n\nTo retrieve the results of the run, you can use the tools which are part of the build module (`build.psm1`)\n\n```powershell\nImport-Module ./build.psm1\nGet-TestResults\n```\n\nTo retrieve only the errors, you can use the following:\n\n```powershell\nImport-Module ./build.psm1\nGet-TestFailures\n```\n\n[Back to ToC](#table-of-contents)\n\n## Using PSScriptAnalyzer\n\nThe documentation in this section can be found in\n[Using PSScriptAnalyzer](https://learn.microsoft.com/powershell/utility-modules/psscriptanalyzer/using-scriptanalyzer).\n\n## Contributions are welcome\n\nThere are many ways to contribute:\n\n1. Open a new bug report, feature request or just ask a question by opening a\n   [new issue](https://github.com/PowerShell/PSScriptAnalyzer/issues/new/choose).\n2. Participate in the discussions of\n   [issues](https://github.com/PowerShell/PSScriptAnalyzer/issues),\n   [pull requests](https://github.com/PowerShell/PSScriptAnalyzer/pulls) and test fixes or new\n   features.\n3. Submit your own fixes or features as a pull request but please discuss it beforehand in an issue.\n4. Submit test cases.\n\n[Back to ToC](#table-of-contents)\n\n## Creating a Release\n\n- Update changelog (`changelog.md`) with the new version number and change set. When updating the\n  changelog please follow the same pattern as that of previous change sets (otherwise this may break\n  the next step).\n- Import the ReleaseMaker module and execute `New-Release` cmdlet to perform the following actions.\n  - Update module manifest (engine/PSScriptAnalyzer.psd1) with the new version number and change set\n  - Update the version number in `Engine/Engine.csproj` and `Rules/Rules.csproj`\n  - Create a release build in `out/`\n\n```powershell\nImport-Module .\\Utils\\ReleaseMaker.psm1\nNew-Release\n```\n\n- Sign the binaries and PowerShell files in the release build and publish the module to\n  [PowerShell Gallery](https://www.powershellgallery.com).\n- Draft a new release on github and tag `master` with the new version number.\n\n[Back to ToC](#table-of-contents)\n\n## Code of Conduct\n\nPlease see our [Code of Conduct](CODE_OF_CONDUCT.md) before participating in this project.\n\n[Back to ToC](#table-of-contents)\n\n## Security Policy\n\nFor any security issues, please see our [Security Policy](SECURITY.md).\n\n[Back to ToC](#table-of-contents)\n","funding_links":[],"categories":["C#","C# #","C\\#","Testing"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FPowerShell%2FPSScriptAnalyzer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FPowerShell%2FPSScriptAnalyzer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FPowerShell%2FPSScriptAnalyzer/lists"}