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 protobuf linter #776

Draft
wants to merge 16 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .github/workflows/protobuf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,18 @@ on:
branches: [ master ]

jobs:
lint-protobuf:
name: Protobuf Linter
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: yoheimuta/action-protolint@v1
with:
github_token: ${{ secrets.github_token }}
# Change reviewdog reporter if you need [github-pr-check,github-check,github-pr-review].
reporter: github-pr-check
filter_mode: nofilter

build-proto2-linux64:
name: Build Proto2 Linux 64

Expand Down
48 changes: 48 additions & 0 deletions .protolint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
# Lint directives.
lint:
# Linter rules.
# Run `protolint list` to see all available rules.
rules:
# Determines whether or not to include the default set of linters.
all_default: true

remove:
- REPEATED_FIELD_NAMES_PLURALIZED
- FIELD_NAMES_EXCLUDE_PREPOSITIONS
- MESSAGE_NAMES_EXCLUDE_PREPOSITIONS
- FILE_HAS_COMMENT
- ORDER
- IMPORTS_SORTED
- ENUM_FIELD_NAMES_ZERO_VALUE_END_WITH

# Linter rules option.
rules_option:
# MAX_LINE_LENGTH rule option.
max_line_length:
# Enforces a maximum line length
max_chars: 400
# Specifies the character count for tab characters
tab_chars: 4

# INDENT rule option.
indent:
# Available styles are 4(4-spaces), 2(2-spaces) or tab.
style: 4
# Specifies if it should stop considering and inserting new lines at the appropriate positions
# when the inner elements are on the same line. Default is false.
not_insert_newline: false

# QUOTE_CONSISTENT rule option.
quote_consistent:
# Available quote are "double" or "single".
quote: double

# ENUM_FIELD_NAMES_ZERO_VALUE_END_WITH rule option.
#enum_field_names_zero_value_end_with:
# suffix: UNKNOWN

# SYNTAX_CONSISTENT rule option.
syntax_consistent:
# Default is proto3.
version: proto2
10 changes: 10 additions & 0 deletions osi_object.proto
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,16 @@ message StationaryObject
// in the environment, like street lights.
//
TYPE_EMITTING_STRUCTURE = 18;

// Test enum case
//
TYPE_test = 19;

// Test missing prefix
//
TEST = 20;

TYPE_MISSING_COMMENT= 21;
}

// Definition of material types.
Expand Down