-
-
Notifications
You must be signed in to change notification settings - Fork 805
standards
- Do Nots
- Naming Convention
- Commands
- Parameters
- SQL Server Instance
- Variables
- Documentation
- Examples
- Format
- Templates
- Tests
- Testing/QA
- Depend or incorporate commands from external modules unless you have explicit permissions/approval (via an issue) from the module owner.
- Incorporate any use of the SQL Server modules (sqlps or sqlserver).
- Use the built-in write output commands (e.g.
Write-Output
,Write-Host
,Write-Verbose
). (See Implementing the messaging system for details on our output commands). - Use any backticks for line continuation.
All of our public commands have the Dba
prefix on the noun and are singular in name.
We only utilize the approved verbs in PowerShell.
Parameters, referring to inputs for the commands, are to use camel caps where each word is capitalized (e.g. SqlInstance
).
Unless circumstances dictate otherwise any command should support multiple objects being passed as input and support piping.
The server or instance name to pass as input will always be utilize the $SqlInstance
parameter for any command that requires it. When iterating over these in an foreach loop refer to the single object as $instance
(e.g. foreach ($instance in $SqlInstance)
)
When referencing the parameters/inputs within code they should use the camel caps (e.g. $Databases
) but other processing variables should utilize camel casing such as $databaseName
.
This refers to the comment-based help (CBH) that is required for each command. All public commands in the module are required to have CBH (we test for this in PR processing). The documentation should be complete and at a minimum include the following sections for CBH (some will repeat):
<#
.SYNOPSIS
.DESCRIPTION
.PARAMETER
This will be one for each parameter input the command utilizes
.NOTES
Tags: AvailabilityGroup, HA, AG
Author: First LastName (@twitterHandle), YourWebSite.net
Website: https://dbatools.io
Copyright: (c) 2018 by dbatools, licensed under MIT
License: MIT https://opensource.org/licenses/MIT
.LINK
https://dbatools.io/Verb-DbaNoun
.EXAMPLE
#>
The NOTES section will be required to contain the website, copyright and license information.
The examples provide a way for users to see how the command can be used for various scenarios or combinations of parameters/inputs. A good start of examples to provide are given below:
- Splatting
- Piping input from other commands (e.g.
Get-DbaNoun ... | Set-DbaNoun ...
) - Passing in multiple values to a given parameter (where supported)
- Outputting only certain properties, or otherwise manipulating output for a certain purpose
The format of the examples should include a view as if you are on an interactive prompt running the command. So a sample where you may have multiple calls:
<#
.EXAMPLE
PS C:\> $data = Get-DbaNoun -SqlInstance MyServer ....
PS C:\> $data | Set-DbaNoun ...
#>
Where you may do a multi-line call on the command line you will include the >>
just as the PowerShell prompt would:
<#
.EXAMPLE
PS C:\> $files = Get-ChildItem C:\temp
PS C:\> foreach ($f in $files) {
>> Verb-DbaNoun -SqlInstance MyServer -Name $f ....
>> }
#>