Skip to content

Add prototool for linting, precommit, Circle, Prow.#685

Merged
istio-testing merged 1 commit intoistio:masterfrom
jeffmendoza:prototool-lint
Nov 1, 2018
Merged

Add prototool for linting, precommit, Circle, Prow.#685
istio-testing merged 1 commit intoistio:masterfrom
jeffmendoza:prototool-lint

Conversation

@jeffmendoza
Copy link
Copy Markdown
Contributor

Note: I want to add FIXMES and Github issues for the files in the ignores: section of prototool.yaml. If this looks good I'll add those before submitting

@googlebot googlebot added the cla: yes Set by the Google CLA bot to indicate the author of a PR has signed the Google CLA. label Oct 31, 2018
@jeffmendoza
Copy link
Copy Markdown
Contributor Author

@ozevren PTAL

@ozevren
Copy link
Copy Markdown
Contributor

ozevren commented Oct 31, 2018

How many issues in total? Is there a linter output that shows all issues?
We may have to live with some of the issues as some of these APIs are already "shipped", but we can fix the others. It would be helpful to see the full list to decide.

@jeffmendoza
Copy link
Copy Markdown
Contributor Author

  ignores:
    - id: MESSAGE_FIELD_NAMES_LOWER_SNAKE_CASE
      files:
        - rbac/v1alpha1/rbac.proto
    - id: REQUEST_RESPONSE_TYPES_IN_SAME_FILE
      files:
        - mixer/v1/service.proto
    - id: ENUM_FIELD_NAMES_UPPER_SNAKE_CASE
      files:
        - networking/v1alpha3/gateway.proto

The above ignores are for these issues:

rbac/v1alpha1/rbac.proto:162:3:Field name "roleRef" must be lower_snake_case.
mixer/v1/service.proto:46:3:Request type "CheckRequest" should be defined in the same file as the corresponding service.
mixer/v1/service.proto:46:3:Response type "CheckResponse" should be defined in the same file as the corresponding service.
mixer/v1/service.proto:51:3:Request type "ReportRequest" should be defined in the same file as the corresponding service.
mixer/v1/service.proto:51:3:Response type "ReportResponse" should be defined in the same file as the corresponding service.
networking/v1alpha3/gateway.proto:306:7:Field name "TLSv1_0" must be UPPER_SNAKE_CASE.
networking/v1alpha3/gateway.proto:309:7:Field name "TLSv1_1" must be UPPER_SNAKE_CASE.
networking/v1alpha3/gateway.proto:312:7:Field name "TLSv1_2" must be UPPER_SNAKE_CASE.
networking/v1alpha3/gateway.proto:315:7:Field name "TLSv1_3" must be UPPER_SNAKE_CASE.

Those are the ones that stood out from the crowd, so I added the special cases for them.

The other linter rules that were disabled seemed to be consistent across all our protos:

    remove:
      - FILE_OPTIONS_REQUIRE_JAVA_MULTIPLE_FILES
      - FILE_OPTIONS_REQUIRE_JAVA_OUTER_CLASSNAME
      - FILE_OPTIONS_REQUIRE_JAVA_PACKAGE
      - FILE_OPTIONS_EQUAL_GO_PACKAGE_PB_SUFFIX
      - ENUM_FIELD_PREFIXES
      - ENUM_ZERO_VALUES_INVALID

Description of those:

FILE_OPTIONS_REQUIRE_JAVA_MULTIPLE_FILES              Verifies that the file option "java_multiple_files" is set.
FILE_OPTIONS_REQUIRE_JAVA_OUTER_CLASSNAME             Verifies that the file option "java_outer_classname" is set.
FILE_OPTIONS_REQUIRE_JAVA_PACKAGE                     Verifies that the file option "java_package" is set.
FILE_OPTIONS_EQUAL_GO_PACKAGE_PB_SUFFIX               Verifies that the file option "go_package" is equal to $(basename PACKAGE)pb.
ENUM_FIELD_PREFIXES                                   Verifies that all enum fields are prefixed with [NESTED_MESSAGE_NAME_]ENUM_NAME_.
ENUM_ZERO_VALUES_INVALID                              Verifies that all enum zero value names are [NESTED_MESSAGE_NAME_]ENUM_NAME_INVALID.

@ozevren
Copy link
Copy Markdown
Contributor

ozevren commented Nov 1, 2018 via email

@ozevren
Copy link
Copy Markdown
Contributor

ozevren commented Nov 1, 2018

/lgtm
/approve

@istio-testing
Copy link
Copy Markdown
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ozevren

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@istio-testing istio-testing merged commit d2dcf00 into istio:master Nov 1, 2018
@jeffmendoza
Copy link
Copy Markdown
Contributor Author

Would it be possible to restrict the
ignore scope even further? These files are generally pretty big and I want
to make sure that only the relevant things are ignored.

Doesn't look like it, You can just disable rules globally or per-file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yes Set by the Google CLA bot to indicate the author of a PR has signed the Google CLA.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants