Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add prototool linter to build process #302

Closed
alpe opened this issue Feb 6, 2019 · 0 comments · Fixed by #314
Closed

Add prototool linter to build process #302

alpe opened this issue Feb 6, 2019 · 0 comments · Fixed by #314
Assignees

Comments

@alpe
Copy link
Contributor

alpe commented Feb 6, 2019

Note: please add to makefile, not just CI. eg.make lint and add needed tools to make tools

We can enforce protobuf best practices like snake_case by using prototool:

  • How to use it:
prototool lint
cmd/bnsd/app/codec.proto:58:3:Enum field "USERNAME" is expected to have the prefix "NFT_TYPE_".
cmd/bnsd/app/codec.proto:58:3:Zero value enum field "USERNAME" is expected to have the name "NFT_TYPE_INVALID".
cmd/bnsd/app/codec.proto:59:3:Enum field "TICKER" is expected to have the prefix "NFT_TYPE_".
cmd/bnsd/app/codec.proto:60:3:Enum field "BLOCKCHAIN" is expected to have the prefix "NFT_TYPE_".
cmd/bnsd/app/codec.proto:61:3:Enum field "BOOTSTRAP_NODE" is expected to have the prefix "NFT_TYPE_".
  • Config prototool.yaml
excludes:
  - ./vendor

protoc:
  # The Protobuf version to use from https://github.com/protocolbuffers/protobuf/releases.
  # By default use 3.6.1.
  # You probably want to set this to make your builds completely reproducible.
  version: 3.6.1

  # Additional paths to include with -I to protoc.
  # By default, the directory of the config file is included,
  # or the current directory if there is no config file.
  includes:
    - ./vendor
    - ../../..


  # If not set, compile will fail if there are unused imports.
  # Setting this will ignore unused imports.
  allow_unused_imports: false

lint:
  rules:
    remove:
      - FILE_OPTIONS_REQUIRE_JAVA_MULTIPLE_FILES
      - FILE_OPTIONS_REQUIRE_JAVA_OUTER_CLASSNAME
      - FILE_OPTIONS_REQUIRE_JAVA_PACKAGE
      - FILE_OPTIONS_REQUIRE_GO_PACKAGE
husio added a commit that referenced this issue Feb 12, 2019
Add `make lint` that will run protobuf linter on our codebase.

After finishing #262 all linter
errors should be gone and we can add `make lint` to our CI.

resolve #302
@alpe alpe closed this as completed in #314 Feb 15, 2019
alpe pushed a commit that referenced this issue Feb 15, 2019
Add `make lint` that will run protobuf linter on our codebase.

After finishing #262 all linter
errors should be gone and we can add `make lint` to our CI.

resolve #302
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants