generated from finos-labs/project-blueprint
-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
VSCode Extension Skeleton - Validation
- Loading branch information
Showing
18 changed files
with
10,711 additions
and
215 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: CALM VSCode Extension | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- "main" | ||
paths: | ||
- "plugins/calm-vscode/**" | ||
push: | ||
branches: | ||
- "main" | ||
paths: | ||
- "plugins/calm-vscode/**" | ||
|
||
defaults: | ||
run: | ||
working-directory: ./plugins/calm-vscode | ||
|
||
jobs: | ||
calm-vscode-extension-tests: | ||
name: Run unit tests and lint on the calm-vscode module. | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: v20 | ||
- run: npm ci | ||
- run: npm run test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
{ | ||
"env": { | ||
"browser": true, | ||
"es2021": true | ||
}, | ||
"ignorePatterns": ["out/", ".vscode-test/"], | ||
"extends": [ | ||
"eslint:recommended", | ||
"plugin:@typescript-eslint/recommended" | ||
], | ||
"overrides": [ | ||
], | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"ecmaVersion": "latest", | ||
"sourceType": "module" | ||
}, | ||
"plugins": [ | ||
"@typescript-eslint" | ||
], | ||
"rules": { | ||
"indent": [ | ||
"error", | ||
4 | ||
], | ||
"linebreak-style": [ | ||
"error", | ||
"unix" | ||
], | ||
"quotes": [ | ||
"error", | ||
"single" | ||
], | ||
"semi": [ | ||
"error", | ||
"always" | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { defineConfig } from '@vscode/test-cli'; | ||
|
||
export default defineConfig({ | ||
files: 'out/test/**/*.test.js', | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
.vscode/** | ||
.vscode-test/** | ||
src/** | ||
.gitignore | ||
.yarnrc | ||
vsc-extension-quickstart.md | ||
**/tsconfig.json | ||
**/eslint.config.mjs | ||
**/*.map | ||
**/*.ts | ||
**/.vscode-test.* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Change Log | ||
|
||
All notable changes to the "calm-vscode" extension will be documented in this file. | ||
|
||
Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file. | ||
|
||
## [Unreleased] | ||
|
||
- Ability to validate a CALM document when saving with the extension loaded. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# calm-vscode | ||
|
||
## Commands Added | ||
|
||
* `calm-vscode.validate` - Automatically validate any CALM file that we're within. This will run on save and trigger the | ||
|
||
## CALM File Detection | ||
|
||
Right now the CALM file detection is incredibly rudamentary. It assumes that you're within one of the following; | ||
|
||
* Pattern | ||
* Instansiation of a Pattern | ||
|
||
This logic will need to be revisisted once [#490](https://github.com/finos/architecture-as-code/issues/490) is tackled. | ||
|
||
## Developing for the Extension Locally | ||
|
||
Steps are given under the assumption that you're using VSCode. | ||
|
||
* Clone down the repository. | ||
* Open the project within VSCode, the `settings.json` / `launch.json` should cover you for what is required. | ||
* Currently `plugins/calm-vscode` depends on other modules internally, so go to shared and run `npm install && npm run watch`. | ||
* `ctrl+shift+d` - select `Run Extension` and hit `F5` to launch a test IDE with the in-development IDE. | ||
|
||
### Caveats | ||
|
||
#### JSON Formatting | ||
|
||
We're using `spectral` and `ajxvs` for JSON schema validation and external rule validation - this applies some formatting when performing validation so line numbers don't always align with the file that is open. | ||
|
||
To get around this - before the `validate` command is executed it will first format the document. If we can determine how to stop `spectral` and `ajvxs` from behaving this way we can remove this limitation. | ||
|
||
## Known Issues | ||
|
||
* Currently validation is only triggered upon saving, this could be improved massively. | ||
* CALM file validation needs to be refactored once the issue mentioned above is addressed. |
Oops, something went wrong.