Skip to content

Commit 892332a

Browse files
authored
Create v0.0.1 (#4)
* Initial Commit * clean up readme * Add Description for README.md * Run Kani with command palette on a single file * Basic Flow for running Kani commands on rust source file * Refactor main flow outside the activation function (#1) * Clean up default comments * Refactor functionality outside the activate function * Add temp and out files to gitignore * Create v0.0.1
1 parent f4913f8 commit 892332a

34 files changed

+9187
-121
lines changed

.eslintrc.js

Lines changed: 57 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -9,75 +9,93 @@ module.exports = {
99
node: true,
1010
mocha: true,
1111
},
12-
plugins: ['@typescript-eslint', 'header', 'no-null'],
12+
plugins: ['@typescript-eslint', 'header', 'no-null', 'eslint-plugin-tsdoc'],
1313
extends: [
1414
'eslint:recommended',
1515
'plugin:@typescript-eslint/eslint-recommended',
1616
'plugin:@typescript-eslint/recommended-requiring-type-checking',
1717
'plugin:@typescript-eslint/recommended',
1818
'prettier',
19+
'plugin:import/recommended',
20+
'plugin:import/typescript',
1921
],
2022
rules: {
21-
curly: 2, // Enforce braces on "if"/"for"/etc.
22-
// TODO reenable this rule (by removing this off)
23+
curly: 2,
24+
"tsdoc/syntax": "warn",
2325
'no-async-promise-executor': 'off',
24-
// TODO reenable this rule (by removing this off)
2526
'@typescript-eslint/no-misused-promises': 'off',
26-
// TODO reenable this rule (by removing this off)
2727
'@typescript-eslint/prefer-regexp-exec': 'off',
28-
// TODO reenable this rule (by removing this off)
2928
'no-async-promise-executors': 'off',
30-
// TODO reenable this rule (by removing this off)
3129
'@typescript-eslint/consistent-type-assertions': 'off',
32-
// TODO reenable this rule (by removing this off)
3330
'@typescript-eslint/ban-ts-ignore': 'off',
34-
// TODO rennable this rule (by removing this off)
3531
'@typescript-eslint/class-name-casing': 'off',
36-
// TODO rennable this rule (by removing this off)
3732
'@typescript-eslint/no-inferrable-types': 'off',
38-
// TODO rennable this rule (by removing this off)
3933
'@typescript-eslint/no-unnecessary-type-assertion': 'off',
40-
// TODO rennable this rule (by removing this off)
41-
// this is another troublesome one, producing ~600 issues
4234
'@typescript-eslint/no-use-before-define': 'off',
43-
// TODO rennable this rule (by removing this off)
4435
'@typescript-eslint/camelcase': 'off',
45-
// TODO rennable this rule (by removing this off)
4636
'no-useless-escape': 'off',
47-
// TODO rennable this rule (by removing this off)
4837
'@typescript-eslint/require-await': 'off',
49-
// TODO rennable this rule (by removing this off)
5038
'@typescript-eslint/no-non-null-assertion': 'off',
51-
// TODO rennable this rule (by removing this off)
5239
'@typescript-eslint/no-explicit-any': 'off',
5340
'@typescript-eslint/no-unsafe-argument': 'off',
54-
// TODO rennable this rule (by removing this off)
55-
'@typescript-eslint/explicit-function-return-type': 'off',
56-
// TODO reenable this rule, tests mostly break this one (by changing off to error)
57-
// This currently produces 700 non fixable by --fix errors
41+
'@typescript-eslint/explicit-function-return-type': 'error',
5842
'sort-imports': 'off',
59-
// TODO rennable this rule (by removing this off)
60-
// namespaces are not great and we should stop using them
6143
'@typescript-eslint/no-namespace': 'off',
62-
// Turn this on by removing off when we fix namespaces
6344
'no-inner-declarations': 'off',
64-
// This is off because prettier takes care of it
6545
'no-extra-semi': 'off',
6646
'no-null/no-null': 'error',
6747
'@typescript-eslint/no-empty-function': 'off',
6848
'@typescript-eslint/no-unused-vars': 'off',
69-
// New rules --> New TODOs
70-
'@typescript-eslint/no-var-requires': 'off', // Should be able to remove with the full migration of SDK v3
71-
'@typescript-eslint/no-unsafe-member-access': 'off', // use typeguard before accessing a member
72-
'@typescript-eslint/no-unsafe-assignment': 'off', // 112 errors, similar to above
73-
'@typescript-eslint/no-unsafe-return': 'off', // 26 errors, similar to above
74-
'@typescript-eslint/no-unsafe-call': 'off', // 24 errors, need types for imported constructors
75-
'@typescript-eslint/restrict-template-expressions': 'off', // 294 errors, forces template literals to be a certain type
76-
'@typescript-eslint/no-floating-promises': 'off', // 274 errors, promises should catch errors or be awaited
77-
'@typescript-eslint/ban-ts-comment': 'off', // 27 errors, bans compiler error exceptions
78-
'@typescript-eslint/explicit-module-boundary-types': 'off', // Remove this once 'explicit-function-return-type' is on
79-
// Do not check loops so while(true) works. Potentially reevalute this.
49+
'@typescript-eslint/no-var-requires': 'off',
50+
'@typescript-eslint/no-unsafe-member-access': 'off',
51+
'@typescript-eslint/no-unsafe-assignment': 'off',
52+
'@typescript-eslint/no-unsafe-return': 'off',
53+
'@typescript-eslint/no-unsafe-call': 'off',
54+
'@typescript-eslint/restrict-template-expressions': 'off',
55+
'@typescript-eslint/no-floating-promises': 'off',
56+
'@typescript-eslint/ban-ts-comment': 'off',
57+
'@typescript-eslint/explicit-module-boundary-types': 'off',
8058
'no-constant-condition': ['error', { checkLoops: false }],
81-
'no-empty': 'off'
59+
'no-empty': 'off',
60+
'sort-imports': [
61+
'error',
62+
{
63+
ignoreCase: false,
64+
ignoreDeclarationSort: true, // don"t want to sort import lines, use eslint-plugin-import instead
65+
ignoreMemberSort: false,
66+
memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single'],
67+
allowSeparatedGroups: true,
68+
},
69+
],
70+
// turn on errors for missing imports
71+
'import/no-unresolved': 'off',
72+
// 'import/no-named-as-default-member': 'off',
73+
'import/order': [
74+
'error',
75+
{
76+
groups: [
77+
'builtin', // Built-in imports (come from NodeJS native) go first
78+
'external', // <- External imports
79+
'internal', // <- Absolute imports
80+
['sibling', 'parent'], // <- Relative imports, the sibling and parent types they can be mingled together
81+
'index', // <- index imports
82+
'unknown', // <- unknown
83+
],
84+
'newlines-between': 'always',
85+
alphabetize: {
86+
/* sort in ascending order. Options: ["ignore", "asc", "desc"] */
87+
order: 'asc',
88+
/* ignore case. Options: [true, false] */
89+
caseInsensitive: true,
90+
},
91+
},
92+
],
8293
},
83-
}
94+
settings: {
95+
'import/resolver': {
96+
typescript: {
97+
project: './tsconfig.json',
98+
},
99+
},
100+
},
101+
};

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,8 @@ tsconfig.lsif.json
5353
*.lsif
5454
*.db
5555
.clang-format
56+
*.vsix
57+
.vscode-test/
58+
out/
59+
*.d.ts
60+
.clang-format

.prettierrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{ "printWidth": 100, "singleQuote": true, "trailingComma": "all", "semi": true, "useTabs": true, "bracketSpacing": true, "tabWidth": 2 }

.vscode/extensions.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
// See http://go.microsoft.com/fwlink/?LinkId=827846
3+
// for the documentation about the extensions.json format
4+
"recommendations": [
5+
"dbaeumer.vscode-eslint"
6+
]
7+
}

.vscode/launch.json

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// A launch configuration that compiles the extension and then opens it inside a new window
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
{
6+
"version": "0.2.0",
7+
"configurations": [
8+
{
9+
"name": "Run Extension",
10+
"type": "extensionHost",
11+
"request": "launch",
12+
"args": [
13+
"--extensionDevelopmentPath=${workspaceFolder}"
14+
],
15+
"outFiles": [
16+
"${workspaceFolder}/out/**/*.js"
17+
],
18+
"preLaunchTask": "${defaultBuildTask}"
19+
},
20+
{
21+
"name": "Extension Tests",
22+
"type": "extensionHost",
23+
"request": "launch",
24+
"args": [
25+
"--extensionDevelopmentPath=${workspaceFolder}",
26+
"--extensionTestsPath=${workspaceFolder}/out/test/suite/index"
27+
],
28+
"outFiles": [
29+
"${workspaceFolder}/out/test/**/*.js"
30+
],
31+
"preLaunchTask": "${defaultBuildTask}"
32+
}
33+
]
34+
}

.vscode/settings.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Place your settings in this file to overwrite default and user settings.
2+
{
3+
"files.exclude": {
4+
"out": false // set this to true to hide the "out" folder with the compiled JS files
5+
},
6+
"search.exclude": {
7+
"out": true // set this to false to include "out" folder in search results
8+
},
9+
// Turn off tsc task auto detection since we have the necessary tasks as npm scripts
10+
"typescript.tsc.autoDetect": "off",
11+
"editor.formatOnSave": false,
12+
"eslint.validate": [
13+
"typescript"
14+
],
15+
"editor.codeActionsOnSave": {
16+
"source.fixAll": true
17+
}
18+
}

.vscode/tasks.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// See https://go.microsoft.com/fwlink/?LinkId=733558
2+
// for the documentation about the tasks.json format
3+
{
4+
"version": "2.0.0",
5+
"tasks": [
6+
{
7+
"type": "npm",
8+
"script": "watch",
9+
"problemMatcher": "$tsc-watch",
10+
"isBackground": true,
11+
"presentation": {
12+
"reveal": "never"
13+
},
14+
"group": {
15+
"kind": "build",
16+
"isDefault": true
17+
}
18+
}
19+
]
20+
}

.vscodeignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
.vscode/**
22
.vscode-test/**
3+
node_modules/**
4+
out/test/
35
src/**
46
.gitignore
57
.yarnrc

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Change Log
2+
3+
All notable changes to the "Kani" extension will be documented in this file.
4+
5+
## [Unreleased]
6+
7+
- Initial release

CONTRIBUTING.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,50 @@ If you think you have discovered a security issue please write to us at kani-ver
5252
Sensitive information can be encrypted using our [PGP key](https://github.com/model-checking/kani/blob/main/kani-verifier-security.public.key).
5353
See our [security disclosure instructions](.github/SECURITY.md) for more details.
5454

55+
# Contributing to the Extension
56+
57+
## What's in the folder
58+
59+
* This folder contains all of the files necessary for your extension.
60+
* `package.json` - this is the manifest file in which you declare your extension and command.
61+
* The sample plugin registers a command and defines its title and command name. With this information VS Code can show the command in the command palette. It doesn’t yet need to load the plugin.
62+
* `src/extension.ts` - this is the main file where you will provide the implementation of your command.
63+
* The file exports one function, `activate`, which is called the very first time your extension is activated (in this case by executing the command). Inside the `activate` function we call `registerCommand`.
64+
* We pass the function containing the implementation of the command as the second parameter to `registerCommand`.
65+
66+
## Get up and running straight away
67+
68+
* Press `F5` to open a new window with your extension loaded.
69+
* Run your command from the command palette by pressing (`Ctrl+Shift+P` or `Cmd+Shift+P` on Mac) and typing `Hello World`.
70+
* Set breakpoints in your code inside `src/extension.ts` to debug your extension.
71+
* Find output from your extension in the debug console.
72+
73+
## Make changes
74+
75+
* You can relaunch the extension from the debug toolbar after changing code in `src/extension.ts`.
76+
* You can also reload (`Ctrl+R` or `Cmd+R` on Mac) the VS Code window with your extension to load your changes.
77+
78+
## Explore the API
79+
80+
* You can open the full set of our API when you open the file `node_modules/@types/vscode/index.d.ts`.
81+
82+
## Run tests
83+
84+
* Open the debug viewlet (`Ctrl+Shift+D` or `Cmd+Shift+D` on Mac) and from the launch configuration dropdown pick `Extension Tests`.
85+
* Press `F5` to run the tests in a new window with your extension loaded.
86+
* See the output of the test result in the debug console.
87+
* Make changes to `src/test/suite/extension.test.ts` or create new test files inside the `test/suite` folder.
88+
* The provided test runner will only consider files matching the name pattern `**.test.ts`.
89+
* You can create folders inside the `test` folder to structure your tests any way you want.
90+
91+
## Go further
92+
93+
* [Follow UX guidelines](https://code.visualstudio.com/api/ux-guidelines/overview) to create extensions that seamlessly integrate with VS Code's native interface and patterns.
94+
* Reduce the extension size and improve the startup time by [bundling your extension](https://code.visualstudio.com/api/working-with-extensions/bundling-extension).
95+
* [Publish your extension](https://code.visualstudio.com/api/working-with-extensions/publishing-extension) on the VS Code extension marketplace.
96+
* Automate builds by setting up [Continuous Integration](https://code.visualstudio.com/api/working-with-extensions/continuous-integration).
97+
98+
5599
## Licensing
56100

57101
This project is distributed under the terms of both the MIT license and the Apache License (Version 2.0).

0 commit comments

Comments
 (0)