From 26aa0cf7f2f2001cffe99a6c7664811b407bb317 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= Date: Thu, 28 Dec 2023 16:15:22 +0100 Subject: [PATCH] rule: rename GetAttrComments -> AttrComments (#1703) Change the name to be more consistent with the rest of the codebase as request in https://github.com/bazelbuild/bazel-gazelle/pull/1700#issuecomment-1871246393 --- rule/rule.go | 4 ++-- rule/rule_test.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/rule/rule.go b/rule/rule.go index 85afb1adb..de92c0119 100644 --- a/rule/rule.go +++ b/rule/rule.go @@ -957,9 +957,9 @@ func (r *Rule) SetAttr(key string, value interface{}) { r.updated = true } -// GetAttrComments returns the comments for an attribute. +// AttrComments returns the comments for an attribute. // It can be used to attach comments like "do not sort". -func (r *Rule) GetAttrComments(key string) *bzl.Comments { +func (r *Rule) AttrComments(key string) *bzl.Comments { attr, ok := r.attrs[key] if !ok { return nil diff --git a/rule/rule_test.go b/rule/rule_test.go index 685386793..9d706ea04 100644 --- a/rule/rule_test.go +++ b/rule/rule_test.go @@ -609,7 +609,7 @@ func TestAttributeComment(t *testing.T) { r := NewRule("a_rule", "name1") r.SetAttr("deps", []string{"foo", "bar", "baz"}) r.SetAttr("hdrs", []string{"foo", "bar", "baz"}) - hdrComments := r.GetAttrComments("hdrs") + hdrComments := r.AttrComments("hdrs") hdrComments.Before = append(hdrComments.Before, bzl.Comment{ Token: "# do not sort", })