-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
118 additions
and
116 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 |
---|---|---|
@@ -1,35 +1,37 @@ | ||
# vscode-protolint [![License](https://img.shields.io/:license-mit-blue.svg)](https://github.com/plexsystems/vscode-protolint/blob/master/LICENSE) [![GitHub release](https://img.shields.io/github/release/plexsystems/vscode-protolint.svg)](https://github.com/plexsystems/vscode-protolint/releases) | ||
|
||
vscode-protolint is a protocol buffer linter for [Visual Studio Code](https://code.visualstudio.com/) that uses [protolint](https://github.com/yoheimuta/protolint) to validate linting rules. | ||
|
||
## Example | ||
|
||
Using the following `.protolint.yaml` configuration file | ||
|
||
```yaml | ||
lint: | ||
rules: | ||
no_default: true | ||
|
||
add: | ||
- MESSAGE_NAMES_UPPER_CAMEL_CASE | ||
- SERVICE_NAMES_UPPER_CAMEL_CASE | ||
``` | ||
![protobuflintexample](img/protolint_demo.gif) | ||
## Installation | ||
This extension can be installed through the Visual Studio [marketplace](https://marketplace.visualstudio.com/items?itemName=Plex.vscode-protolint). Alternatively, a VSIX installer is available on the [releases](https://github.com/plexsystems/vscode-protolint/releases) page. | ||
``` | ||
NOTE: protolint must be installed and available in your PATH | ||
``` | ||
## Local Development | ||
To compile the solution locally run `npm run compile` | ||
|
||
To run the unit tests run `npm run test` | ||
|
||
To run the extension in a Visual Studio Code development environment press `F5` in Visual Studio Code | ||
# vscode-protolint [![License](https://img.shields.io/:license-mit-blue.svg)](https://github.com/plexsystems/vscode-protolint/blob/master/LICENSE) [![GitHub release](https://img.shields.io/github/release/plexsystems/vscode-protolint.svg)](https://github.com/plexsystems/vscode-protolint/releases) | ||
|
||
vscode-protolint is a protocol buffer linter for [Visual Studio Code](https://code.visualstudio.com/) that uses [protolint](https://github.com/yoheimuta/protolint) to validate linting rules. | ||
|
||
## Example | ||
|
||
Using the following `.protolint.yaml` configuration file | ||
|
||
```yaml | ||
lint: | ||
rules: | ||
no_default: true | ||
|
||
add: | ||
- MESSAGE_NAMES_UPPER_CAMEL_CASE | ||
- SERVICE_NAMES_UPPER_CAMEL_CASE | ||
``` | ||
![protobuflintexample](img/protolint_demo.gif) | ||
## Installation | ||
This extension can be installed through the Visual Studio [marketplace](https://marketplace.visualstudio.com/items?itemName=Plex.vscode-protolint). Alternatively, a VSIX installer is available on the [releases](https://github.com/plexsystems/vscode-protolint/releases) page. | ||
``` | ||
NOTE: protolint must be installed and available in your PATH | ||
``` | ||
## Local Development | ||
Before running any of the below commands, make sure you have installed the required dependencies with `npm install` | ||
|
||
- To compile the solution locally run `npm run compile` | ||
|
||
- To run the unit tests run `npm run test` | ||
|
||
- To run the extension in a Visual Studio Code development environment press `F5` in Visual Studio Code |
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 |
---|---|---|
@@ -1,52 +1,52 @@ | ||
{ | ||
"name": "vscode-protolint", | ||
"displayName": "Proto Lint", | ||
"description": "Lint your protobufs using protolint", | ||
"license": "MIT", | ||
"homepage": "https://github.com/plexsystems/vscode-protolint", | ||
"version": "0.3.0", | ||
"publisher": "plex", | ||
"icon": "icon/protolint_logo128.png", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/plexsystems/vscode-protolint.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/plexsystems/vscode-protolint/issues" | ||
}, | ||
"engines": { | ||
"vscode": "^1.14.0" | ||
}, | ||
"categories": [ | ||
"Linters" | ||
], | ||
"keywords": [ | ||
"proto", | ||
"protocol buffer", | ||
"protobuf", | ||
"lint" | ||
], | ||
"activationEvents": [ | ||
"onLanguage:proto3", | ||
"onLanguage:proto" | ||
], | ||
"main": "./out/src/extension", | ||
"scripts": { | ||
"vscode:prepublish": "npm run compile", | ||
"compile": "tsc", | ||
"lint": "tslint --project tsconfig.json", | ||
"precompile": "rimraf ./out && npm run lint", | ||
"watch": "tsc -watch -p ./", | ||
"test": "npm run compile && mocha out/test/*.test.js" | ||
}, | ||
"devDependencies": { | ||
"@types/mocha": "^5.2.7", | ||
"@types/node": "^12.0.8", | ||
"@types/vscode": "^1.14.0", | ||
"mocha": "^7.1.1", | ||
"rimraf": "^2.6.3", | ||
"tslint": "^5.8.0", | ||
"typescript": "^3.5.1", | ||
"vscode-test": "^1.3.0" | ||
} | ||
} | ||
{ | ||
"name": "vscode-protolint", | ||
"displayName": "Proto Lint", | ||
"description": "Lint your protobufs using protolint", | ||
"license": "MIT", | ||
"homepage": "https://github.com/plexsystems/vscode-protolint", | ||
"version": "0.4.0", | ||
"publisher": "plex", | ||
"icon": "icon/protolint_logo128.png", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/plexsystems/vscode-protolint.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/plexsystems/vscode-protolint/issues" | ||
}, | ||
"engines": { | ||
"vscode": "^1.14.0" | ||
}, | ||
"categories": [ | ||
"Linters" | ||
], | ||
"keywords": [ | ||
"proto", | ||
"protocol buffer", | ||
"protobuf", | ||
"lint" | ||
], | ||
"activationEvents": [ | ||
"onLanguage:proto3", | ||
"onLanguage:proto" | ||
], | ||
"main": "./out/src/extension", | ||
"scripts": { | ||
"vscode:prepublish": "npm run compile", | ||
"compile": "tsc", | ||
"lint": "tslint --project tsconfig.json", | ||
"precompile": "rimraf ./out && npm run lint", | ||
"watch": "tsc -watch -p ./", | ||
"test": "npm run compile && mocha out/test/*.test.js" | ||
}, | ||
"devDependencies": { | ||
"@types/mocha": "^5.2.7", | ||
"@types/node": "^12.0.8", | ||
"@types/vscode": "^1.14.0", | ||
"mocha": "^7.1.1", | ||
"rimraf": "^2.6.3", | ||
"tslint": "^5.8.0", | ||
"typescript": "^3.5.1", | ||
"vscode-test": "^1.3.0" | ||
} | ||
} |
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 |
---|---|---|
@@ -1,29 +1,29 @@ | ||
export interface ProtoError { | ||
line: number; | ||
reason: string; | ||
} | ||
|
||
export function parseProtoError(error: string): ProtoError { | ||
if (!error) { | ||
return getEmptyProtoError(); | ||
} | ||
|
||
const errorLine = parseInt(error.split(":")[1], 10); | ||
const errorReason = error.split("] ")[1]; | ||
|
||
const protoError: ProtoError = { | ||
line: errorLine, | ||
reason: errorReason | ||
}; | ||
|
||
return protoError; | ||
} | ||
|
||
export function getEmptyProtoError(): ProtoError { | ||
const emptyProtoError: ProtoError = { | ||
line: 0, | ||
reason: "" | ||
}; | ||
|
||
return emptyProtoError; | ||
} | ||
export interface ProtoError { | ||
line: number; | ||
reason: string; | ||
} | ||
|
||
export function parseProtoError(error: string): ProtoError { | ||
if (!error) { | ||
return getEmptyProtoError(); | ||
} | ||
|
||
const errorLine = parseInt(error.split(".proto:")[1], 10); | ||
const errorReason = error.split("] ")[1]; | ||
|
||
const protoError: ProtoError = { | ||
line: errorLine, | ||
reason: errorReason | ||
}; | ||
|
||
return protoError; | ||
} | ||
|
||
export function getEmptyProtoError(): ProtoError { | ||
const emptyProtoError: ProtoError = { | ||
line: 0, | ||
reason: "" | ||
}; | ||
|
||
return emptyProtoError; | ||
} |