ckaznocha / protoc-gen-lint Goto Github PK
View Code? Open in Web Editor NEWA plug-in for Google's Protocol Buffers (protobufs) compiler to lint .proto files for style violations.
License: MIT License
A plug-in for Google's Protocol Buffers (protobufs) compiler to lint .proto files for style violations.
License: MIT License
Similar to eslint
and others, could we have a comment to skip linting of specific blocks of code?
For instance, in eslint I could do this:
/* eslint-disable */
alert('foo');
/* eslint-enable */
https://eslint.org/docs/user-guide/configuring#disabling-rules-with-inline-comments
Rubocop also has something similar
# rubocop:disable all
[...]
# rubocop:enable all
Especially with protocol buffers, changing messages that are already out there is not recommended. Could we expose a way to disable linting via comments? For instance:
// NOTE: the properties start wtih capital letters in order to flawlessly map to an AWS SQSMessage object
// protoc-gen-lint:disable
message SqsMessage {
string Type = 1;
string MessageId = 2;
string TopicArn = 3;
}
// protoc-gen-lint:enable
I do have some errors listed but final file is not generated for some reason?
Is it possible to support these edge cases when validating message names?
I tried using your lint on my Proto3 file however it failed. Not sure what the issue could be
C:\main\dlmu\cadaemon-0339.1\include\cagrpc>protoc --lint_out=. CAService.proto
--lint_out: protoc-gen-lint: Plugin failed with status code 2.
I am using the latest x64 protoc using the master branch. My protoc files are used for gRPC. It would be really useful if there was some descriptive text indicating what Status code 2 means
Hello @ckaznocha,
I am locally testing my protobuf file using this linter and it's throwing below errors. Can you help me to resolve the issue?
My protobuf file is in the protoc-gen-lint-master
folder.
C:\Repo\protoc-gen-lint-master>protoc --lint_out=. *.proto
'protoc-gen-lint' is not recognized as an internal or external command,
operable program or batch file.
--lint_out: protoc-gen-lint: Plugin failed with status code 1.
I have also tested my proto file with the google style guide rules. I didn't see any of the naming convention rules are executed by this linter. which is not giving any expected errors or suggestions. Can you share more information on it?
Thank you!
Would be great if the tool could also check if imports are ordered in a consistent way. (Maybe simply alphabetical?)
Since [email protected], it started to support optional
field. It would be nice if the protoc-gen-ts
plugin supports it. Could you please work on it? Thanks.
Here is the reference about how to implement.
copy/pasted, credit improbable-eng/ts-protoc-gen#263
This is a blocker for my project wechaty/grpc#109
/usr/local/bin/protoc-gen-lint: /usr/local/bin/protoc-gen-lint: cannot execute binary file
--lint_out: protoc-gen-lint: Plugin failed with status code 126.
I am trying to lint one protobuf file and it gives this error every time. I am using this command:
protoc --lint_out=. FILENAME.proto
I have a project which generates PHP classes from protobuf files and it uses php_namespace option to generate correct class names.
But when I lint it I get this error:
xxx.proto:3:8: Option "php_namespace" unknown.
Line 8 contains
option php_namespace = "Project";
In vim, using https://github.com/w0rp/ale, import errors have no line and column which causes the error to be skipped over.
I am not very experienced with linters so IDK if this is normal behavior for that sort of error, what do you think? Is it possible to add a line number of where the import happened?
I noticed that the latest release for arm64 includes an x86_64 binary instead.
mkdir protoc-gen-lint_linux_arm64 && cd protoc-gen-lint_linux_arm64
curl -sSLO https://github.com/ckaznocha/protoc-gen-lint/releases/download/v0.2.3/protoc-gen-lint_linux_arm64.zip
unzip protoc-gen-lint_linux_arm64.zip
file protoc-gen-lint
Output:
protoc-gen-lint_linux_arm64/protoc-gen-lint: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, Go BuildID=l37vOoxRha7swXFWPRRu/RTrBCXi-FRWdI_7V03qf/u_DHaiAND98rAROCMkO6/kRU43_m-13vDU_iYkN3Z, not stripped
Building the file manually with GOOS=linux GOARCH=arm64 go build -v .
yields:
protoc-gen-lint: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), statically linked, Go BuildID=w6lhE3eaT2E8M26vW0h9/_p18eAbACZ60qZfyfJ8z/XyBF0tnrYva2bnSbqlQd/lQM-vldy2JbQwkDa63Dy, not stripped
How can we use protoc-gen-lint as a maven plugin ?
When there is a missing {}
at the end of the rpc definition, the linter gives the error that ;
is missing when that is not really the problem.
service Foo {
rpc SomeFunc(SomeReq) returns (SomeResp) {}
rpc GetFoo(BarReq) returns (BarResp)
}
The GetFoo
rpc definition will give the missing ;
error
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.