Reformat a few files (#1503)
## Buildtools PR checklist
- [ ] The code in this PR is covered by unit/integration tests.
- [ ] I have tested these changes and provide testing instructions
below.
- [x] I have either responded to, or resolved all Gemini comments on the
PR.
- [x] I have read Google Eng Practices on [Small
Changes](https://google.github.io/eng-practices/review/developer/small-cls.html),
this PR either follows these guidelines or the description provides
reasoning for why they can not be followed.
## Description
As fallout from https://github.com/bazel-contrib/buildtools/pull/1502 a
few files got reformatted. This PR splits out the reformatting from
https://github.com/bazel-contrib/buildtools/pull/1502.
diff --git a/edit/buildozer.go b/edit/buildozer.go
index d55b07e..9320e6a 100644
--- a/edit/buildozer.go
+++ b/edit/buildozer.go
@@ -122,13 +122,13 @@
}
for _, val := range env.Args[1:] {
if attrType == rawAttr {
- AddValueToListAttribute(env.Rule, attr, env.Pkg, &build.Ident{Name: val}, &env.Vars)
- continue
- }
- if attrType == notProvidedTypeAttr && IsIntList(attr) {
- AddValueToListAttribute(env.Rule, attr, env.Pkg, &build.LiteralExpr{Token: val}, &env.Vars)
- continue
- }
+ AddValueToListAttribute(env.Rule, attr, env.Pkg, &build.Ident{Name: val}, &env.Vars)
+ continue
+ }
+ if attrType == notProvidedTypeAttr && IsIntList(attr) {
+ AddValueToListAttribute(env.Rule, attr, env.Pkg, &build.LiteralExpr{Token: val}, &env.Vars)
+ continue
+ }
var strVal build.Expr
strVal = getLabelStringExpr(val, env.Pkg)
AddValueToListAttribute(env.Rule, attr, env.Pkg, strVal, &env.Vars)
diff --git a/edit/default_buildifier.go b/edit/default_buildifier.go
index 7b015a5..2a0f66a 100644
--- a/edit/default_buildifier.go
+++ b/edit/default_buildifier.go
@@ -35,8 +35,8 @@
cmd.Stdout = stdout
cmd.Stderr = stderr
cmd.Env = append(
- os.Environ(),
- // Custom environment variables
+ os.Environ(),
+ // Custom environment variables
)
err := cmd.Run()
if stderr.Len() > 0 {
diff --git a/generatetables/generate_tables.go b/generatetables/generate_tables.go
index 99dc625..2ad7d89 100644
--- a/generatetables/generate_tables.go
+++ b/generatetables/generate_tables.go
@@ -103,7 +103,7 @@
types["python_version"] = buildpb.Attribute_STRING
types["srcs_version"] = buildpb.Attribute_STRING
types["stub_shebang"] = buildpb.Attribute_STRING
-
+
// The following attributes used to exist in the native CC rules but were removed
// during Starlarkification. Add them here for backwards compatibility, at least for now.
types["copts"] = buildpb.Attribute_STRING_LIST
diff --git a/warn/types.go b/warn/types.go
index 91113e9..9776838 100644
--- a/warn/types.go
+++ b/warn/types.go
@@ -179,7 +179,8 @@
// If the right hand side is not a string, the left hand side can still be a string
return
}
- ident, ok := node.LHSIdent(); if !ok {
+ ident, ok := node.LHSIdent()
+ if !ok {
return
}
binding := env.Get(ident.Name)
diff --git a/warn/warn_visibility.go b/warn/warn_visibility.go
index 513ef92..45070f8 100644
--- a/warn/warn_visibility.go
+++ b/warn/warn_visibility.go
@@ -48,9 +48,9 @@
}
// We don't try to be exhaustive here, but rather only catch the most
// common cases of visibility declarations.
- if ident, ok := call.X.(*build.Ident); ok && ident.Name == "visibility" {
- return true
- }
+ if ident, ok := call.X.(*build.Ident); ok && ident.Name == "visibility" {
+ return true
+ }
}
return false
}