Skip to main content
Glama

protolint-mcp

by yoheimuta
fileHasCommentRule_test.go1.79 kB
package rules_test import ( "reflect" "testing" "github.com/yoheimuta/go-protoparser/v4/parser" "github.com/yoheimuta/go-protoparser/v4/parser/meta" "github.com/yoheimuta/protolint/internal/addon/rules" "github.com/yoheimuta/protolint/linter/report" "github.com/yoheimuta/protolint/linter/rule" ) func TestFileHasCommentRule_Apply(t *testing.T) { tests := []struct { name string inputProto *parser.Proto wantFailures []report.Failure }{ { name: "no failures for proto starting with a doc comment", inputProto: &parser.Proto{ ProtoBody: []parser.Visitee{ &parser.Syntax{ Comments: []*parser.Comment{ { Raw: "// this file defines something-something.", }, }, }, }, }, }, { name: "a failure for proto without any doc comments", inputProto: &parser.Proto{ ProtoBody: []parser.Visitee{ &parser.Syntax{ Meta: meta.Meta{ Pos: meta.Position{ Filename: "example.proto", Offset: 150, Line: 7, Column: 15, }, }, }, }, }, wantFailures: []report.Failure{ report.Failuref( meta.Position{ Filename: "example.proto", Offset: 150, Line: 7, Column: 15, }, "FILE_HAS_COMMENT", string(rule.SeverityError), `File should start with a doc comment`, ), }, }, } for _, test := range tests { test := test t.Run(test.name, func(t *testing.T) { rule := rules.NewFileHasCommentRule(rule.SeverityError) got, err := rule.Apply(test.inputProto) if err != nil { t.Errorf("got err %v, but want nil", err) return } if !reflect.DeepEqual(got, test.wantFailures) { t.Errorf("got %v, but want %v", got, test.wantFailures) } }) } }

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/yoheimuta/protolint'

If you have feedback or need assistance with the MCP directory API, please join our Discord server