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

Integrate proto linter #6376

Closed
connorjclark opened this issue Oct 24, 2018 · 4 comments
Closed

Integrate proto linter #6376

connorjclark opened this issue Oct 24, 2018 · 4 comments

Comments

@connorjclark
Copy link
Collaborator

See #6374 (comment).

@exterkamp
Copy link
Member

Yes please! Make sure you find one that enforces proto linting rules + a max line width + indention checking!

@connorjclark
Copy link
Collaborator Author

prototool

prototool format -w lighthouse-result.proto

image

I don't like how it removes newlines between fields. Don't see a way to disable that.

@yoheimuta
Copy link

yoheimuta commented Jan 11, 2019

Make sure you find one that enforces proto linting rules + a max line width + indention checking!

I found this issue while making https://github.com/yoheimuta/protolint. This linter enforces proto linting official style guide, a max line length and a consistent indentation style.

I was interested about whether it could works for this project, I tried protolint under #6374 situation.

/y/C/lighthouse ❯❯❯ git diff
diff --git a/proto/lighthouse-result.proto b/proto/lighthouse-result.proto
index e4468277..14138da8 100644
--- a/proto/lighthouse-result.proto
+++ b/proto/lighthouse-result.proto
@@ -163,10 +163,10 @@ message LighthouseResult {

     // Corresponds to: https://www.w3.org/TR/performance-timeline-2/#idl-def-performanceentrylist
     repeated PerformanceEntry entries = 2;
-  }
+ }

-  // The performance timing data for the Lighthouse run
-  Timing timing = 14;
+ // The performance timing data for the Lighthouse run
+ Timing timing = 14;
 }

 // Message containing a category
/y/C/lighthouse ❯❯❯ pl -fix .; echo $?
[proto/lighthouse-result.proto:166:2] Found an incorrect indentation style " ". "  " is correct.
[proto/lighthouse-result.proto:169:2] Found an incorrect indentation style " ". "  " is correct.
[proto/lighthouse-result.proto:168:2] Found an incorrect indentation style " ". "  " is correct.
1
/y/C/lighthouse ❯❯❯ git diff
/y/C/lighthouse ❯❯❯ pl .; echo $?
0
/y/C/lighthouse ❯❯❯         

This project needs the config file named .protolint.yaml. The linter ignores a ENUM_FIELD_NAMES_UPPER_SNAKE_CASE rule because the file already violates it.

# Lint directives.
lint:
  # Linter rules.
  # Run `pl list` to see all available rules.
  rules:
    # The specific linters to remove.
    remove:
      - ENUM_FIELD_NAMES_UPPER_SNAKE_CASE

  # Linter rules option.
  rules_option:
    # INDENT rule option.
    indent:
      # Available styles are 4(4-spaces), 2(2-spaces) or tab.
      style: 2

If it's fine, how about integrating the protolint?

@paulirish
Copy link
Member

Thanks very much for the heads up @yoheimuta

Looks like we don't need to try this out anymore. Cheers

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

No branches or pull requests

4 participants