diff --git a/internal/core/format.go b/internal/core/format.go index 4470cfb2..dc89782d 100755 --- a/internal/core/format.go +++ b/internal/core/format.go @@ -105,6 +105,7 @@ var FormatByExtension = map[string][]string{ `\.(?:dita)$`: {".dita", "markup"}, `\.(?:org)$`: {".org", "markup"}, `\.(?:jl)$`: {".jl", "code"}, + `\.(?:proto)$`: {".c", "code"}, } // FormatFromExt takes a file extension and returns its [normExt, format] diff --git a/testdata/features/lint.feature b/testdata/features/lint.feature index 1aa8a022..a89e9477 100755 --- a/testdata/features/lint.feature +++ b/testdata/features/lint.feature @@ -22,6 +22,15 @@ Feature: Lint test.jl:47:3:vale.Annotations:'XXX' left in text """ + Scenario: Lint a proto file + When I lint "test.proto" + Then the output should contain exactly: + """ + test.proto:13:6:vale.Annotations:'NOTE' left in text + test.proto:22:4:vale.Annotations:'XXX' left in text + test.proto:31:1:vale.Annotations:'NOTE' left in text + """ + Scenario: Lint an Org file When I lint "test.org" Then the output should contain exactly: diff --git a/testdata/fixtures/formats/test.proto b/testdata/fixtures/formats/test.proto new file mode 100755 index 00000000..8fe105f4 --- /dev/null +++ b/testdata/fixtures/formats/test.proto @@ -0,0 +1,41 @@ +syntax = "proto3"; + +package foo.bar.v1; + +import "google/api/annotations.proto"; + +option java_package = "com.company.foo.bar.v1"; +option java_outer_classname = "ApiProtoXXX"; + + +// The foo service +service FooService { + // NOTE: this is a RPC comment + rpc GetBar(GetBarRequest) returns (GetBarResponse) { + option (google.api.http) = { + get: "/v1/{name=bars/*}" + }; + option (google.api.method_signature) = "name"; + } +} + +/* XXX: this is also a comment */ +message GetBarRequest { + // Note: Field comment inside a message. + string name = 1; +} + +/* +Comment. + +NOTE: I am a multilinek comment, so I span +over multiple lines +*/ +message GetBarResponse { + string todo = 1; +} + +// The following should not get matched +message XXX { + +}