Skip to content

Commit

Permalink
Add checks
Browse files Browse the repository at this point in the history
  • Loading branch information
Maksim Sadym committed Dec 2, 2022
1 parent c67515e commit c85bbb3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
9 changes: 9 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,12 @@ jobs:
with:
name: cddl
path: "*.cddl"
no-split-vars:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 14.x
- name: Check no break lines inside blocks
run: node ./scripts/formatter/no_split_var.js
7 changes: 2 additions & 5 deletions scripts/formatter/no_split_var.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
#!/usr/bin/env node

const fs = require('fs')
const path = require('path')
const specPath = path.resolve(__dirname, '..', '..', 'index.bs')
const specLines = fs.readFileSync(specPath, 'utf-8')
const specLines = fs.readFileSync('../../index.bs', 'utf-8')
.toString()
.split('\n');

Expand All @@ -15,8 +13,7 @@ for (let i = 0; i < specLines.length; i++) {
for (let pair of openClosePairs) {
if (line.lastIndexOf(pair[0]) > line.lastIndexOf(pair[1])) {
failed.push(
`Unclosed ${line.substring(line.lastIndexOf(pair[0]))} at line ${i
+ 1}`)
`Unclosed ${line.substring(line.lastIndexOf(pair[0]))} at line ${i+ 1}`)
}
}

Expand Down
3 changes: 0 additions & 3 deletions scripts/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,3 @@ $ROOT/scripts/cddl/generate.js

cddl compile-cddl --cddl local.cddl
cddl compile-cddl --cddl remote.cddl

# Check break lines inside blocks.
$ROOT/scripts/formatter/no_split_var.js

0 comments on commit c85bbb3

Please sign in to comment.