-
Notifications
You must be signed in to change notification settings - Fork 1
Code Quality
Marius Storhaug edited this page Nov 24, 2021
·
1 revision

To prevent bad code, align on coding practises and styles. As a developer you are responsible for your codes quality. Similar to other professionals, follow professional standards.

- PascalCase ?
Our repos contains settings for VSCode (.vscode folder on root), automating our devs VSCode to follow the teams standards:
"editor.formatOnPaste": true,
"editor.formatOnSave": true,
"files.autoSave": "afterDelay",
"files.autoSaveDelay": 10000,
"explorer.compactFolders": false,
"explorer.sortOrder": "filesFirst",- PascalCase for variables and parameters.
- Be verbose. Code should speak for itself, leading to less comments. Comments are lies waiting to happen.
- Use verbose variable names. Spell it out, not just
$aor$Obj, but$ProcessObjectsor$ParameterFilePath - Don't use aliases in scripts, spell it out, again making the scripts verbose and 'self documenting'.
-
gps->Get-Process
-
- Always define the parameter you are using, not just going on position or type match. i.e:
-
Get-Process 'notepad'->Get-Process -Name 'notepad'
-
- Follow one Brace and indentation style: 'Kernighan and Ritchie' (K&R), also known as 'One True Bracing Style' (OTBS)
Our repos contains settings for VSCode (.vscode folder on root), automating our devs VSCode to follow the teams standards:
- Powershell Development Guidelines | Microsoft Docs
- Powershell Practice and Style | GitBook.io
- Powershell Practice and Style | GitHub
- Capitalization guidelines - Powershell Practice and Style | GitHub
Our repos contains settings for VSCode (.vscode folder on root), automating our devs VSCode to follow the teams standards:
- Allow comments in JSON files, especially if there are references to GUIDs and other non-human readable references.
"files.associations": { // As ARM is written to support JSON,
"*.json": "jsonc" // comments will cause linting errors.
}, // This will make that no longer happen.This is a mock repo for testing