Skip to content

Commit f928ca4

Browse files
committed
add support for Bicep, #939
1 parent 66ae6ae commit f928ca4

File tree

4 files changed

+73
-2
lines changed

4 files changed

+73
-2
lines changed

Unix/t/00_C.t

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,11 @@ my @Tests = (
102102
'ref' => '../tests/outputs/BUILD.yaml',
103103
'args' => '../tests/inputs/BUILD',
104104
},
105+
{
106+
'name' => 'Bicep',
107+
'ref' => '../tests/outputs/sample.bicep.yaml',
108+
'args' => '../tests/inputs/sample.bicep',
109+
},
105110
{
106111
'name' => 'BitBake',
107112
'ref' => '../tests/outputs/bitbake.yaml',

cloc

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8845,13 +8845,15 @@ sub set_constants { # {{{1
88458845
'BTM' => 'DOS Batch' ,
88468846
'blade' => 'Blade' ,
88478847
'blade.php' => 'Blade' ,
8848-
'build.xml' => 'Ant' ,
88498848
'b' => 'Brainfuck' ,
88508849
'bf' => 'Brainfuck' ,
8850+
'bicep' => 'Bicep' ,
8851+
'bicepparam' => 'Bicep' ,
88518852
'blp' => 'Blueprint' ,
88528853
'brs' => 'BrightScript' ,
8853-
'bzl' => 'Starlark' ,
88548854
'btp' => 'BizTalk Pipeline' ,
8855+
'build.xml' => 'Ant' ,
8856+
'bzl' => 'Starlark' ,
88558857
'odx' => 'BizTalk Orchestration' ,
88568858
'carbon' => 'Carbon' ,
88578859
'cpy' => 'COBOL' ,
@@ -9996,6 +9998,11 @@ sub set_constants { # {{{1
99969998
[ 'remove_matches' , '^\s*#' ],
99979999
[ 'remove_inline' , '#.*$' ],
999810000
],
10001+
'Bicep' => [
10002+
[ 'rm_comments_in_strings', '"', '/*', '*/' ],
10003+
[ 'rm_comments_in_strings', '"', '//', '' ],
10004+
[ 'call_regexp_common' , 'C++' ],
10005+
],
999910006
'BizTalk Pipeline' => [
1000010007
[ 'remove_html_comments', ],
1000110008
[ 'call_regexp_common' , 'HTML' ],
@@ -11896,6 +11903,7 @@ sub set_constants { # {{{1
1189611903
'basic' => 0.75,
1189711904
'Bazel' => 1.00,
1189811905
'bc' => 1.50,
11906+
'Bicep' => 3.00,
1189911907
'Blade' => 2.00,
1190011908
'bliss' => 0.75,
1190111909
'Blueprint' => 2.50,

tests/inputs/sample.bicep

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*
2+
https://learn.microsoft.com/en-us/azure/azure-resource-manager/bicep/file
3+
*/
4+
metadata description = 'Creates a storage account and a web app'
5+
6+
@description('The prefix to use for the storage account name.')
7+
@minLength(3)
8+
@maxLength(11)
9+
param storagePrefix string
10+
11+
param storageSKU string = 'Standard_LRS'
12+
param location string = resourceGroup().location
13+
14+
// Generate a unique name for the storage account
15+
var uniqueStorageName = '${storagePrefix}${uniqueString(resourceGroup().id)}'
16+
17+
// Create a storage account
18+
resource stg 'Microsoft.Storage/storageAccounts@2025-01-01' = {
19+
name: uniqueStorageName
20+
location: location
21+
sku: {
22+
name: storageSKU
23+
}
24+
kind: 'StorageV2'
25+
properties: {
26+
supportsHttpsTrafficOnly: true
27+
}
28+
}
29+
30+
// Deploy the web app module
31+
module webModule './webApp.bicep' = {
32+
name: 'webDeploy'
33+
params: {
34+
skuName: 'S1'
35+
location: location
36+
}
37+
}

tests/outputs/sample.bicep.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
# github.com/AlDanial/cloc
3+
header :
4+
cloc_url : github.com/AlDanial/cloc
5+
cloc_version : 2.07
6+
elapsed_seconds : 0.00441193580627441
7+
n_files : 1
8+
n_lines : 37
9+
files_per_second : 226.657876249662
10+
lines_per_second : 8386.3414212375
11+
report_file : ../outputs/sample.bicep.yaml
12+
'Bicep' :
13+
nFiles: 1
14+
blank: 5
15+
comment: 6
16+
code: 26
17+
SUM:
18+
blank: 5
19+
comment: 6
20+
code: 26
21+
nFiles: 1

0 commit comments

Comments
 (0)