* add editorconfig support

* update gh action

* add diff for yaml/yml

* updates

* update vscode tabs

* Change EOL handling in lint action

* trying windows

* revert to linux and remove editorconfig

* updates

* changes
This commit is contained in:
Jack Tracey 2022-10-03 08:11:35 +01:00 коммит произвёл GitHub
Родитель 86a4da115c
Коммит d287261512
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
7 изменённых файлов: 117 добавлений и 94 удалений

15
.editorconfig Normal file
Просмотреть файл

@ -0,0 +1,15 @@
root = true
[*]
indent_size = 2
charset = utf-8
end_of_line = lf
trim_trailing_whitespace = true
insert_final_newline = true
[*.{yml,yaml}]
indent_size = 2
charset = utf-8
end_of_line = lf
trim_trailing_whitespace = true
insert_final_newline = true

3
.gitattributes поставляемый Normal file
Просмотреть файл

@ -0,0 +1,3 @@
* text=auto eol=lf
*.bicep -text
*.bicepparam -text

2
.github/workflows/code-review.yml поставляемый
Просмотреть файл

@ -13,6 +13,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
@ -32,6 +33,7 @@ jobs:
VALIDATE_MARKDOWN: true
VALIDATE_POWERSHELL: true
VALIDATE_YAML: true
VALIDATE_EDITORCONFIG: true
markdown-link-check:
name: Markdown Link Check

136
.vscode/bicep.code-snippets поставляемый
Просмотреть файл

@ -1,70 +1,70 @@
{
"Bicep minimum sample": {
"scope": "bicep",
"prefix": "bicep-minimum-sample",
"description": "A minmum sample for testing and examples.",
"body": [
"//",
"// Minimum deployment sample",
"//",
"",
"// Use this sample to deploy the minimum resource configuration.",
"",
"targetScope = 'resourceGroup'",
"",
"// ----------",
"// PARAMETERS",
"// ----------",
"",
"@description('The Azure location to deploy to.')",
"param location string = resourceGroup().location",
"",
"// ---------",
"// RESOURCES",
"// ---------",
"",
"@description('Minimum resource configuration')",
"module ${1} '../${2}}.bicep' = {",
" name: '${1}'",
" params: {",
" parLocation: location",
" parTags: {}",
" }",
"}"
]
},
"Bicep baseline sample": {
"scope": "bicep",
"prefix": "bicep-baseline-sample",
"description": "A sample that aligned to WAF recommendations.",
"body": [
"//",
"// Baseline deployment sample",
"//",
"",
"// Use this sample to deploy a Well-Architected aligned resource configuration.",
"",
"targetScope = 'resourceGroup'",
"",
"// ----------",
"// PARAMETERS",
"// ----------",
"",
"@description('The Azure location to deploy to.')",
"param location string = resourceGroup().location",
"",
"// ---------",
"// RESOURCES",
"// ---------",
"",
"@description('Baseline resource configuration')",
"module ${1} '../${2}}.bicep' = {",
" name: '${1}'",
" params: {",
" parLocation: location",
" parTags: {}",
" }",
"}"
]
}
"Bicep minimum sample": {
"scope": "bicep",
"prefix": "bicep-minimum-sample",
"description": "A minmum sample for testing and examples.",
"body": [
"//",
"// Minimum deployment sample",
"//",
"",
"// Use this sample to deploy the minimum resource configuration.",
"",
"targetScope = 'resourceGroup'",
"",
"// ----------",
"// PARAMETERS",
"// ----------",
"",
"@description('The Azure location to deploy to.')",
"param location string = resourceGroup().location",
"",
"// ---------",
"// RESOURCES",
"// ---------",
"",
"@description('Minimum resource configuration')",
"module ${1} '../${2}}.bicep' = {",
" name: '${1}'",
" params: {",
" parLocation: location",
" parTags: {}",
" }",
"}"
]
},
"Bicep baseline sample": {
"scope": "bicep",
"prefix": "bicep-baseline-sample",
"description": "A sample that aligned to WAF recommendations.",
"body": [
"//",
"// Baseline deployment sample",
"//",
"",
"// Use this sample to deploy a Well-Architected aligned resource configuration.",
"",
"targetScope = 'resourceGroup'",
"",
"// ----------",
"// PARAMETERS",
"// ----------",
"",
"@description('The Azure location to deploy to.')",
"param location string = resourceGroup().location",
"",
"// ---------",
"// RESOURCES",
"// ---------",
"",
"@description('Baseline resource configuration')",
"module ${1} '../${2}}.bicep' = {",
" name: '${1}'",
" params: {",
" parLocation: location",
" parTags: {}",
" }",
"}"
]
}
}

19
.vscode/extensions.json поставляемый
Просмотреть файл

@ -1,10 +1,11 @@
{
// Recommended extensions for ALZ Bicep
"recommendations": [
"ms-azuretools.vscode-bicep",
"vsls-contrib.codetour",
"msazurermtools.azurerm-vscode-tools",
"bencoleman.armview",
"bewhite.psrule-vscode"
]
}
// Recommended extensions for ALZ Bicep
"recommendations": [
"ms-azuretools.vscode-bicep",
"vsls-contrib.codetour",
"msazurermtools.azurerm-vscode-tools",
"bencoleman.armview",
"bewhite.psrule-vscode",
"editorconfig.editorconfig"
]
}

28
.vscode/tasks.json поставляемый
Просмотреть файл

@ -1,16 +1,16 @@
{
"version": "2.0.0",
"tasks": [
{
"type": "PSRule",
"problemMatcher": [
"$PSRule"
],
"label": "PSRule: Run analysis",
"presentation": {
"panel": "dedicated",
"clear": true
}
}
]
"version": "2.0.0",
"tasks": [
{
"type": "PSRule",
"problemMatcher": [
"$PSRule"
],
"label": "PSRule: Run analysis",
"presentation": {
"panel": "dedicated",
"clear": true
}
}
]
}

Просмотреть файл

@ -58,6 +58,7 @@ The following tooling/extensions are recommended to assist you developing for th
- [ARM Tools extension for Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=msazurermtools.azurerm-vscode-tools)
- [ARM Template Viewer extension for Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=bencoleman.armview)
- [PSRule extension for Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=bewhite.psrule-vscode)
- [EditorConfig for VS Code](https://marketplace.visualstudio.com/items?itemName=EditorConfig.EditorConfig)
- For visibility of Bracket Pairs:
- Inside Visual Studio Code, add "editor.bracketPairColorization.enabled": true to your settings.json, to enable bracket pair colorization.
@ -95,7 +96,6 @@ Throughout the development of Bicep code you should follow the [Bicep Best Pract
- Double line-breaks should exist between each element type section
- When intended for scopes above resource group deployment, targetScope should be indicated at the beginning of the file
### Bicep Elements Naming Standards
| Element Type | Naming Prefix | Example |
@ -140,13 +140,13 @@ param parExampleResourceGroupNamePrefix string = 'TEST'
var varExampleResourceGroupName = 'rsg-${parExampleResourceGroupNamePrefix}' // Create name for the example resource group
// RESOURCE DEPLOYMENTS
// RESOURCE DEPLOYMENTS
resource resExampleResourceGroup 'Microsoft.Resources/resourceGroups@2021-04-01' = {
name: varExampleResourceGroupName
location: 'uksouth' // Hardcoded as an example of commenting inside a resource
}
/*
/*
No modules being deployed in this example
*/
@ -274,3 +274,5 @@ To author Bicep modules that are in-line with the requirements for this project,
### Resource API Versions
Each resource must use the latest available, working, API version. If the latest API version cannot be used for any reason, a comment must be placed above the resource in the module file stating why and also called out as part of the PR.
> The Bicep linter rule `use-recent-api-versions` will now also check for this 👍