Repository: uber/prototool
Pull request #322 (2019-01-31 21:02:08)

Rename uber lint group to uber1
In preparation for the V2 Style Guide, this renames the `uber` lint group to `uber1`, to signify that there are multiple versions. Lint groups were added in #254, which was done after the last 1.3.0 release, so lint groups are only exposed on dev, which means this is not a breaking change.

codecov-io: # [Codecov](https://codecov.io/gh/uber/prototool/pull/322?src=pr&el=h1) Report
> Merging [#322](https://codecov.io/gh/uber/prototool/pull/322?src=pr&el=desc) into [dev](https://codecov.io/gh/uber/prototool/commit/164e7ea54bef3e27dea0db94c1359723b5c52ef7?src=pr&el=desc) will **not change** coverage.
> The diff coverage is `50%`.

[![Impacted file tree graph](https://codecov.io/gh/uber/prototool/pull/322/graphs/tree.svg?width=650&token=A9V0DApqZg&height=150&src=pr)](https://codecov.io/gh/uber/prototool/pull/322?src=pr&el=tree)

```diff
@@           Coverage Diff           @@
##              dev     #322   +/-   ##
=======================================
  Coverage   73.56%   73.56%           
=======================================
  Files         144      144           
  Lines        6355     6355           
=======================================
  Hits         4675     4675           
  Misses       1256     1256           
  Partials      424      424
```


| [Impacted Files](https://codecov.io/gh/uber/prototool/pull/322?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [internal/lint/lint.go](https://codecov.io/gh/uber/prototool/pull/322/diff?src=pr&el=tree#diff-aW50ZXJuYWwvbGludC9saW50Lmdv) | `71.01% <ø> (ø)` | :arrow_up: |
| [internal/settings/settings.go](https://codecov.io/gh/uber/prototool/pull/322/diff?src=pr&el=tree#diff-aW50ZXJuYWwvc2V0dGluZ3Mvc2V0dGluZ3MuZ28=) | `61.9% <ø> (ø)` | :arrow_up: |
| [internal/cmd/templates.go](https://codecov.io/gh/uber/prototool/pull/322/diff?src=pr&el=tree#diff-aW50ZXJuYWwvY21kL3RlbXBsYXRlcy5nbw==) | `81.92% <ø> (ø)` | :arrow_up: |
| [internal/cfginit/cfginit.go](https://codecov.io/gh/uber/prototool/pull/322/diff?src=pr&el=tree#diff-aW50ZXJuYWwvY2ZnaW5pdC9jZmdpbml0Lmdv) | `77.77% <ø> (ø)` | :arrow_up: |
| [internal/exec/runner.go](https://codecov.io/gh/uber/prototool/pull/322/diff?src=pr&el=tree#diff-aW50ZXJuYWwvZXhlYy9ydW5uZXIuZ28=) | `45.87% <0%> (ø)` | :arrow_up: |
| [internal/cmd/flags.go](https://codecov.io/gh/uber/prototool/pull/322/diff?src=pr&el=tree#diff-aW50ZXJuYWwvY21kL2ZsYWdzLmdv) | `100% <100%> (ø)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/uber/prototool/pull/322?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/uber/prototool/pull/322?src=pr&el=footer). Last update [164e7ea...a580662](https://codecov.io/gh/uber/prototool/pull/322?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).


Patch:
diff --git a/.travis.yml b/.travis.yml
index 421d4d2..333c145 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -4,5 +4,5 @@ go:
 before_install:
   - bash -x etc/bin/travis-before-install.sh
 script:
-  - make all
+  - make lint cover
   - if [ "${TRAVIS_PULL_REQUEST}" = "false" ]; then make codecov; fi
diff --git a/Makefile b/Makefile
index c0b82ca..ad5352c 100644
--- a/Makefile
+++ b/Makefile
@@ -64,7 +64,7 @@ example: install
 	go build ./example/gen/go/uber/bar/v1
 	go build -o $(TMP_ETC)/excited ./example/cmd/excited/main.go
 	prototool lint etc/style/google
-	prototool lint etc/style/uber
+	prototool lint etc/style/uber1
 
 .PHONY: internalgen
 internalgen: install
@@ -103,10 +103,6 @@ golint:
 		fi; \
 	done
 
-.PHONY: vet
-vet:
-	go vet $(PKGS)
-
 .PHONY:
 errcheck:
 	@go install github.com/kisielk/errcheck
@@ -128,7 +124,7 @@ checklicense: install
 	fi
 
 .PHONY: lint
-lint: checknodiffgenerated golint vet errcheck staticcheck checklicense
+lint: checknodiffgenerated golint errcheck staticcheck checklicense
 
 .PHONY: test
 test:
diff --git a/README.md b/README.md
index 8da2483..2929f65 100644
--- a/README.md
+++ b/README.md
@@ -6,7 +6,7 @@ Prototool lets you:
 
 - Handle installation of `protoc` and the import of all of the Well-Known Types behind the scenes in a platform-independent manner without any work on the part of the user.
 - Standardize building of your Protobuf files with a common [configuration](#configuration), abstracting away all of the pain of protoc for you.
-- [Lint](#prototool-lint) your Protobuf files with common linting rules according to [Google' Style Guide](https://developers.google.com/protocol-buffers/docs/style), [Uber's Style Guide](https://github.com/uber/prototool/blob/master/etc/style/uber/uber.proto), or your own set of configured lint rules.
+- [Lint](#prototool-lint) your Protobuf files with common linting rules according to [Google' Style Guide](https://developers.google.com/protocol-buffers/docs/style), [Uber's V1 Style Guide](https://github.com/uber/prototool/blob/master/etc/style/uber1/uber1.proto), or your own set of configured lint rules.
 - [Format](#prototool-format) your Protobuf files in a consistent manner.
 - [Create](#prototool-create) Protobuf files from a template that passes lint, taking care of package naming for you.
 - [Generate](#prototool-generate) stubs using any plugin based on a simple configuration file, including handling imports of all the Well-Known Types.
@@ -173,14 +173,14 @@ Lint your Protobuf files.
 Lint rules can be set using the configuration file. See the configuration at [etc/config/example/prototool.yaml](etc/config/example/prototool.yaml) for all available options. There are two pre-configured groups of rules:
 
 - `google`: This lint group follows the Style Guide at https://developers.google.com/protocol-buffers/docs/style. This is a small group of rules meant to enforce basic naming, and is widely followed. The style guide is copied to [etc/style/google/google.proto](etc/style/google/google.proto).
-- `uber`: This lint group follows the Style Guide at [etc/style/uber/uber.proto](etc/style/uber/uber.proto). This is a very strict rule group and is meant to enforce consistent development patterns.
-- `uber2`: This lint group is the v2 of the `uber` lint group, and makes some modifcations to more closely follow the Google Cloud APIs file
+- `uber1`: This lint group follows the V1 Style Guide at [etc/style/uber1/uber1.proto](etc/style/uber1/uber1.proto). This is a very strict rule group and is meant to enforce consistent development patterns.
+- `uber2`: This lint group is the V2 Style Guide, and makes some modifcations to more closely follow the Google Cloud APIs file
   structure, as well as adding even more rules to enforce more consistent development patterns. This lint group is under development.
 
 To see the differences between lint groups, use the `--diff-lint-groups` flag:
 
 ```
-prototool lint --diff-lint-groups google,uber
+prototool lint --diff-lint-groups google,uber2
 ```
 
 Configuration of your group can be done by setting the `lint.group` option in your `prototool.yaml` file:
@@ -191,7 +191,7 @@ lint:
 ```
 
 See the `prototool.yaml` files at [etc/style/google/prototool.yaml](etc/style/google/prototool.yaml) and
-[etc/style/uber/prototool.yaml](etc/style/uber/prototool.yaml) for examples.
+[etc/style/uber1/prototool.yaml](etc/style/uber1/prototool.yaml) for examples.
 
 The `uber` lint group represents the default lint group, and will be used if no lint group is configured.
 
@@ -215,11 +215,11 @@ If `lint.file_header.path` is set, `prototool create`, `prototool format --fix`,
 See [internal/cmd/testdata/lint](internal/cmd/testdata/lint) for additional examples of configurations, and run `prototool lint internal/cmd/testdata/lint/DIR` from a checkout of this repository to see example failures.
 
 Files must be valid Protobuf that can be compiled with `protoc`, so prior to linting, `prototool lint` will compile your using `protoc`.
-Note, however, this is very fast - for the two files in [etc/uber/style](etc/uber/style), compiling and linting only takes approximately
+Note, however, this is very fast - for the two files in [etc/style/uber1](etc/style/uber1), compiling and linting only takes approximately
 3/100ths of a second:
 
 ```bash
-$ time prototool lint etc/style/uber
+$ time prototool lint etc/style/uber1
 
 real	0m0.037s
 user	0m0.026s
diff --git a/etc/config/example/prototool.yaml b/etc/config/example/prototool.yaml
index fe9cdc6..90e98b9 100644
--- a/etc/config/example/prototool.yaml
+++ b/etc/config/example/prototool.yaml
@@ -37,11 +37,11 @@ create:
 # Lint directives.
 lint:
   # The lint group to use.
-  # The default group is the "default" lint group, which is equal to the "uber" lint group.
+  # The default group is the "default" lint group, which is equal to the "uber1" lint group.
   # Run prototool lint --list-all-lint-groups to see all available lint groups.
   # Run prototool lint --list-lint-group GROUP to list the linters in the given lint group.
   # Setting this value will result in lint.rules.no_default being ignored.
-  group: uber
+  group: uber2
 
   # Linter files to ignore.
   ignores:
diff --git a/etc/style/uber/prototool.yaml b/etc/style/uber/prototool.yaml
deleted file mode 100644
index 22da473..0000000
--- a/etc/style/uber/prototool.yaml
+++ /dev/null
@@ -1,2 +0,0 @@
-lint:
-  group: uber
diff --git a/etc/style/uber/dep/dep.proto b/etc/style/uber1/dep/dep.proto
similarity index 100%
rename from etc/style/uber/dep/dep.proto
rename to etc/style/uber1/dep/dep.proto
diff --git a/etc/style/uber1/prototool.yaml b/etc/style/uber1/prototool.yaml
new file mode 100644
index 0000000..bfc399c
--- /dev/null
+++ b/etc/style/uber1/prototool.yaml
@@ -0,0 +1,2 @@
+lint:
+  group: uber1
diff --git a/etc/style/uber/uber.proto b/etc/style/uber1/uber1.proto
similarity index 99%
rename from etc/style/uber/uber.proto
rename to etc/style/uber1/uber1.proto
index bc813bd..efbb415 100644
--- a/etc/style/uber/uber.proto
+++ b/etc/style/uber1/uber1.proto
@@ -1,4 +1,4 @@
-// Protobuf Uber Style Guide
+// Protobuf Uber V1 Style Guide
 //
 // This is the default style enforced with lint.
 //
@@ -32,7 +32,7 @@ option go_package = "uberpb";
 // java_multiple_files is always true.
 option java_multiple_files = true;
 // java_outer_classname is the CamelCased file name without the extension, followed by Proto.
-option java_outer_classname = "UberProto";
+option java_outer_classname = "Uber1Proto";
 // The java package is always com.PACKAGE.
 option java_package = "com.style.uber";
 
diff --git a/internal/cfginit/cfginit.go b/internal/cfginit/cfginit.go
index 0631057..f79c11d 100644
--- a/internal/cfginit/cfginit.go
+++ b/internal/cfginit/cfginit.go
@@ -67,11 +67,11 @@ protoc:
 # Lint directives.
 {{.V}}lint:
   # The lint group to use.
-  # The default group is the "default" lint group, which is equal to the "uber" lint group.
+  # The default group is the "default" lint group, which is equal to the "uber1" lint group.
   # Run prototool lint --list-all-lint-groups to see all available lint groups.
   # Run prototool lint --list-lint-group GROUP to list the linters in the given lint group.
   # Setting this value will result in lint.rules.no_default being ignored.
-{{.V}}  group: uber
+{{.V}}  group: uber2
 
   # Linter files to ignore.
 {{.V}}  ignores:
diff --git a/internal/cmd/flags.go b/internal/cmd/flags.go
index b5572d8..2ae5176 100644
--- a/internal/cmd/flags.go
+++ b/internal/cmd/flags.go
@@ -95,7 +95,7 @@ func (f *flags) bindDebug(flagSet *pflag.FlagSet) {
 }
 
 func (f *flags) bindDiffLintGroups(flagSet *pflag.FlagSet) {
-	flagSet.StringVar(&f.diffLintGroups, "diff-lint-groups", "", "Diff the two lint groups separated by '.', for example google,uber.")
+	flagSet.StringVar(&f.diffLintGroups, "diff-lint-groups", "", "Diff the two lint groups separated by '.', for example google,uber2.")
 }
 
 func (f *flags) bindDiffMode(flagSet *pflag.FlagSet) {
diff --git a/internal/cmd/templates.go b/internal/cmd/templates.go
index 9f0ff42..6551dad 100644
--- a/internal/cmd/templates.go
+++ b/internal/cmd/templates.go
@@ -432,20 +432,20 @@ $ cat input.json | prototool grpc example \
 
 google: This lint group follows the Style Guide at https://developers.google.com/protocol-buffers/docs/style. This is a small group of rules meant to enforce basic naming, and is widely followed.
 
-uber: This lint group follows the Style Guide at https://github.com/uber/prototool/blob/master/etc/style/uber/uber.proto. This is a very strict rule group and is meant to enforce consistent development patterns.
+uber1: This lint group follows the Style Guide at https://github.com/uber/prototool/blob/master/etc/style/uber1/uber1.proto. This is a very strict rule group and is meant to enforce consistent development patterns.
 
 Configuration of your group can be done by setting the "lint.group" option in your "prototool.yaml" file:
 
 lint:
   group: google
 
-The "uber" lint group represents the default lint group, and will be used if no lint group is configured.
+The "uber1" lint group represents the default lint group, and will be used if no lint group is configured.
 
 Files must be valid Protobuf that can be compiled with protoc, so prior to linting, prototool lint will compile your using protoc.
 Note, however, this is very fast - for two files, compiling and linting only takes approximately
 3/100ths of a second:
 
-$ time prototool lint etc/style/uber
+$ time prototool lint etc/style/uber1
 
 real	0m0.037s
 user	0m0.026s
diff --git a/internal/exec/runner.go b/internal/exec/runner.go
index 5a846e6..2a1e7e7 100644
--- a/internal/exec/runner.go
+++ b/internal/exec/runner.go
@@ -361,7 +361,7 @@ func (r *runner) listAllLintGroups() error {
 func (r *runner) diffLintGroups(groups string) error {
 	split := strings.Split(groups, ",")
 	if len(split) != 2 {
-		return fmt.Errorf("argument to --diff-lint-groups must be two lint groups separated by '.', for example google,uber")
+		return fmt.Errorf("argument to --diff-lint-groups must be two lint groups separated by '.', for example google,uber2")
 	}
 	firstLinterIDs, err := getLinterIDs(split[0])
 	if err != nil {
diff --git a/internal/lint/lint.go b/internal/lint/lint.go
index 1c98dba..3d66b5f 100644
--- a/internal/lint/lint.go
+++ b/internal/lint/lint.go
@@ -128,7 +128,7 @@ var (
 	}
 
 	// DefaultLinters is the slice of default Linters.
-	DefaultLinters = UberLinters
+	DefaultLinters = Uber1Linters
 
 	// GoogleLinters is the slice of linters for the google lint group.
 	GoogleLinters = []Linter{
@@ -145,8 +145,8 @@ var (
 		serviceNamesCapitalizedLinter,
 	}
 
-	// UberLinters is the slice of linters for the uber lint group.
-	UberLinters = []Linter{
+	// Uber1Linters is the slice of linters for the uber1 lint group.
+	Uber1Linters = []Linter{
 		commentsNoCStyleLinter,
 		enumFieldNamesUpperSnakeCaseLinter,
 		enumFieldPrefixesLinter,
@@ -266,7 +266,7 @@ var (
 	// GroupToLinters is the map from linter group to the corresponding slice of linters.
 	GroupToLinters = map[string][]Linter{
 		"google": GoogleLinters,
-		"uber":   UberLinters,
+		"uber1":  Uber1Linters,
 		"uber2":  Uber2Linters,
 	}
 
diff --git a/internal/settings/settings.go b/internal/settings/settings.go
index 694957f..323e1bb 100644
--- a/internal/settings/settings.go
+++ b/internal/settings/settings.go
@@ -171,7 +171,7 @@ type CreateConfig struct {
 type LintConfig struct {
 	// Group is the specific group of linters to use.
 	// The default group is the "default" lint group, which is equal
-	// to the "uber" lint group.
+	// to the "uber1" lint group.
 	// Setting this value will result in NoDefault being ignored.
 	Group string
 	// NoDefault is set to exclude the default set of linters.


Test patch:
diff --git a/internal/cmd/cmd_test.go b/internal/cmd/cmd_test.go
index 5b0a1a1..f2aa0a6 100644
--- a/internal/cmd/cmd_test.go
+++ b/internal/cmd/cmd_test.go
@@ -156,7 +156,7 @@ func TestLint(t *testing.T) {
 		t,
 		true,
 		"",
-		"../../etc/style/uber",
+		"../../etc/style/uber1",
 	)
 	assertDoLintFile(
 		t,
@@ -1194,7 +1194,7 @@ func TestInspectPackageImporters(t *testing.T) {
 
 func TestListLinters(t *testing.T) {
 	assertLinters(t, lint.DefaultLinters, "lint", "--list-linters", "testdata/lint/base")
-	assertLinters(t, lint.UberLinters, "lint", "--list-linters", "testdata/lint/base")
+	assertLinters(t, lint.Uber1Linters, "lint", "--list-linters", "testdata/lint/base")
 }
 
 func TestListAllLinters(t *testing.T) {
@@ -1202,12 +1202,12 @@ func TestListAllLinters(t *testing.T) {
 }
 
 func TestListAllLintGroups(t *testing.T) {
-	assertExact(t, true, 0, "google\nuber\nuber2", "lint", "--list-all-lint-groups")
+	assertExact(t, true, 0, "google\nuber1\nuber2", "lint", "--list-all-lint-groups")
 }
 
 func TestListLintGroup(t *testing.T) {
 	assertLinters(t, lint.GoogleLinters, "lint", "--list-lint-group", "google", "testdata/lint/base")
-	assertLinters(t, lint.UberLinters, "lint", "--list-lint-group", "uber", "testdata/lint/base")
+	assertLinters(t, lint.Uber1Linters, "lint", "--list-lint-group", "uber1", "testdata/lint/base")
 	assertLinters(t, lint.Uber2Linters, "lint", "--list-lint-group", "uber2", "testdata/lint/base")
 }
 
@@ -1240,7 +1240,7 @@ func TestDiffLintGroups(t *testing.T) {
 > REQUEST_RESPONSE_TYPES_UNIQUE
 > SYNTAX_PROTO3
 > WKT_DIRECTLY_IMPORTED`,
-		"lint", "--diff-lint-groups", "google,uber",
+		"lint", "--diff-lint-groups", "google,uber1",
 	)
 }