protoc-gen-lint icon indicating copy to clipboard operation
protoc-gen-lint copied to clipboard

Inline comment to skip linting

Open blimmer opened this issue 6 years ago • 1 comments

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

https://github.com/bbatsov/rubocop/blob/master/manual/configuration.md#disabling-cops-within-source-code

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

blimmer avatar May 09 '18 16:05 blimmer

+1

lchenn avatar Jun 03 '18 15:06 lchenn