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 checker #1125

Merged
merged 1 commit into from
Oct 17, 2016
Merged

Add protobuf checker #1125

merged 1 commit into from
Oct 17, 2016

Conversation

marsam
Copy link
Contributor

@marsam marsam commented Sep 29, 2016

Add protobuf checker. It's basically same as flycheck-protobuf.el with minor changes

Related: #790

@swsnr
Copy link
Contributor

swsnr commented Sep 30, 2016

@marsam Thanks. Will take a look soon :)

Copy link
Contributor

@swsnr swsnr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a note for the new syntax checker to CHANGES.rst.

(message "In file included from") " " (file-name) ":" line ":"
column ":" line-end))
:modes protobuf-mode
:predicate (lambda () (buffer-file-name)))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is a buffer-file-name required for this syntax checker?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that the --proto_path= option adds the path of the file, and (buffer-file-name) can be nil I think is better have this predicate.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, I see.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small thing: wouldn't #'buffer-file-name work just as well as (lambda () (buffer-file-name))?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think so, but I like the explicit lambda for the sake of syntactic consistency.


See URL `https://developers.google.com/protocol-buffers/'."
:command ("protoc" "--error_format" "gcc"
(eval (concat "--java_out=" (flycheck-temp-dir-system)))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I presume there is no option to entirely suppress the output?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is no option to supress the compiled output

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

See URL `https://developers.google.com/protocol-buffers/'."
:command ("protoc" "--error_format" "gcc"
(eval (concat "--java_out=" (flycheck-temp-dir-system)))
(eval (concat "--proto_path=" (file-name-directory (buffer-file-name))))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this option do?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It adds a directory to paths in which protobuf files will be searched to import. Is necessary, doesn't work otherwise.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, can you add a comment to explain that? Just so that we don't forget?

@marsam
Copy link
Contributor Author

marsam commented Oct 8, 2016

Hi, sorry for the delay. I've added the note to CHANGES.rst

The test pass in my machine:

make LANGUAGE=protobuf integ
cask exec emacs -Q --batch -L .  -l maint/flycheck-compile.el -f flycheck/batch-byte-compile flycheck-buttercup.el
cask exec emacs -Q --batch -L .  --load test/flycheck-test --load test/run.el -f flycheck-run-tests-main '(and (tag external-tool) (language protobuf))'
Running tests on Emacs 26.0.50.2, built at 2016-10-07
Running 1 tests (2016-10-07 20:51:39-0500)
   passed  1/1  flycheck-define-checker/protobuf-protoc/syntax-error

Ran 1 tests, 1 results as expected (2016-10-07 20:51:40-0500)


.. syntax-checker:: protobuf-protoc

Check syntax using the `protoc <https://developers.google.com/protocol-buffers/>`_ compiler.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line looks rather long. Can you wrap it to 80 characters?

See URL `https://developers.google.com/protocol-buffers/'."
:command ("protoc" "--error_format" "gcc"
(eval (concat "--java_out=" (flycheck-temp-dir-system)))
(eval (concat "--proto_path=" (file-name-directory (buffer-file-name))))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, can you add a comment to explain that? Just so that we don't forget?

@swsnr
Copy link
Contributor

swsnr commented Oct 8, 2016

LGTM, but some minor style issues left.

@marsam
Copy link
Contributor Author

marsam commented Oct 14, 2016

Sorry for the delay, I've updated the pull request

@swsnr
Copy link
Contributor

swsnr commented Oct 14, 2016

@marsam Thanks.

I'm sorry, but we had a release in between, so I need to ask you to rebase onto master and move the changelog entry.

@marsam
Copy link
Contributor Author

marsam commented Oct 14, 2016

Updated :)

@cpitclaudel
Copy link
Member

LGTM; thanks @marsam! I added a small comment regarding buffer-file-name.

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

Successfully merging this pull request may close these issues.

None yet

3 participants