Skip to content

Commit c85bbb3

Browse files
author
Maksim Sadym
committed
Add checks
1 parent c67515e commit c85bbb3

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

.github/workflows/test.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,12 @@ jobs:
4949
with:
5050
name: cddl
5151
path: "*.cddl"
52+
no-split-vars:
53+
runs-on: ubuntu-20.04
54+
steps:
55+
- uses: actions/checkout@v2
56+
- uses: actions/setup-node@v1
57+
with:
58+
node-version: 14.x
59+
- name: Check no break lines inside blocks
60+
run: node ./scripts/formatter/no_split_var.js

scripts/formatter/no_split_var.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
#!/usr/bin/env node
22

33
const fs = require('fs')
4-
const path = require('path')
5-
const specPath = path.resolve(__dirname, '..', '..', 'index.bs')
6-
const specLines = fs.readFileSync(specPath, 'utf-8')
4+
const specLines = fs.readFileSync('../../index.bs', 'utf-8')
75
.toString()
86
.split('\n');
97

@@ -15,8 +13,7 @@ for (let i = 0; i < specLines.length; i++) {
1513
for (let pair of openClosePairs) {
1614
if (line.lastIndexOf(pair[0]) > line.lastIndexOf(pair[1])) {
1715
failed.push(
18-
`Unclosed ${line.substring(line.lastIndexOf(pair[0]))} at line ${i
19-
+ 1}`)
16+
`Unclosed ${line.substring(line.lastIndexOf(pair[0]))} at line ${i+ 1}`)
2017
}
2118
}
2219

scripts/test.sh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,3 @@ $ROOT/scripts/cddl/generate.js
1919

2020
cddl compile-cddl --cddl local.cddl
2121
cddl compile-cddl --cddl remote.cddl
22-
23-
# Check break lines inside blocks.
24-
$ROOT/scripts/formatter/no_split_var.js

0 commit comments

Comments
 (0)