mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-05-03 08:20:30 +02:00
Merge pull request #8314 from mohamedawnallah/add-auto-protolinter
[CI]: Install protolint to enforce the protobuf style guide rules in the CI
This commit is contained in:
commit
7d03b43ddf
3
.github/workflows/main.yml
vendored
3
.github/workflows/main.yml
vendored
@ -134,6 +134,9 @@ jobs:
|
|||||||
- name: check go modules tidiness
|
- name: check go modules tidiness
|
||||||
run: make tidy-module-check
|
run: make tidy-module-check
|
||||||
|
|
||||||
|
- name: lint proto files
|
||||||
|
run: make protolint
|
||||||
|
|
||||||
- name: lint
|
- name: lint
|
||||||
run: GOGC=50 make lint
|
run: GOGC=50 make lint
|
||||||
|
|
||||||
|
70
.protolint.yaml
Normal file
70
.protolint.yaml
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
# The example configuration file for the protolint is located here:
|
||||||
|
# https://github.com/yoheimuta/protolint/blob/master/_example/config/.protolint.yaml
|
||||||
|
---
|
||||||
|
# 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.
|
||||||
|
no_default: true
|
||||||
|
|
||||||
|
# Set the default to all linters. This option works the other way around as no_default does.
|
||||||
|
# If you want to enable this option, delete the comment out below and no_default.
|
||||||
|
# all_default: true.
|
||||||
|
|
||||||
|
# The specific linters to add.
|
||||||
|
add:
|
||||||
|
- MESSAGE_NAMES_UPPER_CAMEL_CASE
|
||||||
|
- MAX_LINE_LENGTH
|
||||||
|
- INDENT
|
||||||
|
- FILE_NAMES_LOWER_SNAKE_CASE
|
||||||
|
- IMPORTS_SORTED
|
||||||
|
- PACKAGE_NAME_LOWER_CASE
|
||||||
|
- ORDER
|
||||||
|
- SERVICES_HAVE_COMMENT
|
||||||
|
- RPCS_HAVE_COMMENT
|
||||||
|
- PROTO3_FIELDS_AVOID_REQUIRED
|
||||||
|
- PROTO3_GROUPS_AVOID
|
||||||
|
- SYNTAX_CONSISTENT
|
||||||
|
- RPC_NAMES_CASE
|
||||||
|
- QUOTE_CONSISTENT
|
||||||
|
|
||||||
|
# Linter rules option.
|
||||||
|
rules_option:
|
||||||
|
# MAX_LINE_LENGTH rule option.
|
||||||
|
max_line_length:
|
||||||
|
# Enforces a maximum line length.
|
||||||
|
max_chars: 80
|
||||||
|
# Specifies the character count for tab characters.
|
||||||
|
tab_chars: 2
|
||||||
|
|
||||||
|
# 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: true
|
||||||
|
|
||||||
|
# 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: INVALID
|
||||||
|
|
||||||
|
# SERVICE_NAMES_END_WITH rule option.
|
||||||
|
service_names_end_with:
|
||||||
|
text: Service
|
||||||
|
|
||||||
|
# REPEATED_FIELD_NAMES_PLURALIZED rule option.
|
||||||
|
## The spec for each rules follows the implementation of https://github.com/gertd/go-pluralize.
|
||||||
|
## Plus, you can refer to this rule's test code.
|
||||||
|
repeated_field_names_pluralized:
|
||||||
|
uncountable_rules:
|
||||||
|
- paper
|
||||||
|
irregular_rules:
|
||||||
|
Irregular: Regular
|
5
Makefile
5
Makefile
@ -280,6 +280,11 @@ lint: docker-tools
|
|||||||
@$(call print, "Linting source.")
|
@$(call print, "Linting source.")
|
||||||
$(DOCKER_TOOLS) golangci-lint run -v $(LINT_WORKERS)
|
$(DOCKER_TOOLS) golangci-lint run -v $(LINT_WORKERS)
|
||||||
|
|
||||||
|
#? protolint: Lint proto files using protolint
|
||||||
|
protolint:
|
||||||
|
@$(call print, "Linting proto files.")
|
||||||
|
docker run --rm --volume "$$(pwd):/workspace" --workdir /workspace yoheimuta/protolint lint lnrpc/
|
||||||
|
|
||||||
#? tidy-module: Run `go mod` tidy for all modules
|
#? tidy-module: Run `go mod` tidy for all modules
|
||||||
tidy-module:
|
tidy-module:
|
||||||
echo "Running 'go mod tidy' for all modules"
|
echo "Running 'go mod tidy' for all modules"
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
|
|
||||||
import "lightning.proto";
|
|
||||||
|
|
||||||
package devrpc;
|
package devrpc;
|
||||||
|
|
||||||
|
import "lightning.proto";
|
||||||
|
|
||||||
option go_package = "github.com/lightningnetwork/lnd/lnrpc/devrpc";
|
option go_package = "github.com/lightningnetwork/lnd/lnrpc/devrpc";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
|
|
||||||
import "lightning.proto";
|
|
||||||
|
|
||||||
package invoicesrpc;
|
package invoicesrpc;
|
||||||
|
|
||||||
|
import "lightning.proto";
|
||||||
|
|
||||||
option go_package = "github.com/lightningnetwork/lnd/lnrpc/invoicesrpc";
|
option go_package = "github.com/lightningnetwork/lnd/lnrpc/invoicesrpc";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
|
|
||||||
import "verrpc/verrpc.proto";
|
|
||||||
|
|
||||||
package lnclipb;
|
package lnclipb;
|
||||||
|
|
||||||
|
import "verrpc/verrpc.proto";
|
||||||
|
|
||||||
option go_package = "github.com/lightningnetwork/lnd/lnrpc/lnclipb";
|
option go_package = "github.com/lightningnetwork/lnd/lnrpc/lnclipb";
|
||||||
|
|
||||||
message VersionResponse {
|
message VersionResponse {
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
|
|
||||||
import "lightning.proto";
|
|
||||||
|
|
||||||
package peersrpc;
|
package peersrpc;
|
||||||
|
|
||||||
|
import "lightning.proto";
|
||||||
|
|
||||||
option go_package = "github.com/lightningnetwork/lnd/lnrpc/peersrpc";
|
option go_package = "github.com/lightningnetwork/lnd/lnrpc/peersrpc";
|
||||||
|
|
||||||
// Peers is a service that can be used to get information and interact
|
// Peers is a service that can be used to get information and interact
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
|
|
||||||
import "lightning.proto";
|
|
||||||
|
|
||||||
package routerrpc;
|
package routerrpc;
|
||||||
|
|
||||||
|
import "lightning.proto";
|
||||||
|
|
||||||
option go_package = "github.com/lightningnetwork/lnd/lnrpc/routerrpc";
|
option go_package = "github.com/lightningnetwork/lnd/lnrpc/routerrpc";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
|
|
||||||
|
package walletrpc;
|
||||||
|
|
||||||
import "lightning.proto";
|
import "lightning.proto";
|
||||||
import "signrpc/signer.proto";
|
import "signrpc/signer.proto";
|
||||||
|
|
||||||
package walletrpc;
|
|
||||||
|
|
||||||
option go_package = "github.com/lightningnetwork/lnd/lnrpc/walletrpc";
|
option go_package = "github.com/lightningnetwork/lnd/lnrpc/walletrpc";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
|
|
||||||
import "lightning.proto";
|
|
||||||
|
|
||||||
package lnrpc;
|
package lnrpc;
|
||||||
|
|
||||||
|
import "lightning.proto";
|
||||||
|
|
||||||
option go_package = "github.com/lightningnetwork/lnd/lnrpc";
|
option go_package = "github.com/lightningnetwork/lnd/lnrpc";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user