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

Pass relevant settings to checkdoc subprocess #937

Closed
wants to merge 1 commit into from

Conversation

cpitclaudel
Copy link
Member

‘flycheck-emacs-lisp-checkdoc-variables’ contains all variables that are
passed to the inferior Emacs process running checkdoc (but only if they
are already bound in the parent process).

The main use of this is allowing for file- and directory-local checkdoc
settings.

Closes GH-741.

Edit: Connects to #741.

@cpitclaudel
Copy link
Member Author

Quick note: I added (hack-local-variables) to the test setup. An alternative would be let-binding a few variables around the call to flycheck-should-syntax-check in the test that I added, but as written the test is more self-contained, and should better reflect the use that people will make of that feature.

@swsnr
Copy link
Contributor

swsnr commented Apr 3, 2016

@cpitclaudel Thank you very much. I'll take a look.

checkdoc-force-docstrings-flag
checkdoc-package-keywords-flag
checkdoc-spellcheck-documentation-flag
checkdoc-verb-check-experimental-flag)
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we discover all this options automatically? Perhaps by finding all options in the checkdoc custom group?

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure; I'll push the relevant code soon.

Copy link
Member Author

Choose a reason for hiding this comment

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

Actually, I'm not sure that will work :/ It is quite possible for checkdoc to not be loaded but for a given checkdoc variable to be set, and in that case we still want to propagate the variable, right?
I don't think we can find the list of checkdoc variables without loading the package. Do we want to do that in the parent process?

Copy link
Contributor

Choose a reason for hiding this comment

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

@cpitclaudel Oh yes, I didn't think of this.

However, I think we should try to make sure that we don't miss a variable here. Do you think that we can have a buttercup spec for this?

Copy link
Member Author

Choose a reason for hiding this comment

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

Done :)

@cpitclaudel cpitclaudel force-pushed the 741-checkdoc-inherit-configuration branch 2 times, most recently from b990842 to efa8aba Compare April 4, 2016 00:31
@cpitclaudel
Copy link
Member Author

Alright, pushed an updated version; thanks for the review!

@cpitclaudel cpitclaudel force-pushed the 741-checkdoc-inherit-configuration branch from efa8aba to e2936f2 Compare April 4, 2016 09:12
@cpitclaudel
Copy link
Member Author

I've added a buttercup spec checking that the list is up-to-date.

@cpitclaudel cpitclaudel force-pushed the 741-checkdoc-inherit-configuration branch 2 times, most recently from a9c581c to a86b814 Compare April 4, 2016 09:22
(checkdoc-custom-vars
(seq-map #'car checkdoc-custom-pairs))
(checkdoc-relevant-vars
(cl-set-difference checkdoc-custom-vars tel--excluded-checkdoc-vars)))
Copy link
Contributor

Choose a reason for hiding this comment

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

Please use seq-difference instead of cl-set-difference here. Just my personal preference for seq over cl-lib ☺️

Copy link
Member Author

Choose a reason for hiding this comment

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

Ooh, I didn't realize that was in seq as well.

@cpitclaudel cpitclaudel force-pushed the 741-checkdoc-inherit-configuration branch from a86b814 to a106679 Compare April 4, 2016 09:48
‘flycheck-emacs-lisp-checkdoc-variables’ contains all variables that are
passed to the inferior Emacs process running checkdoc (but only if they
are already bound in the parent process). This list is kept explicitly,
because generating it requires browsing the checkdoc customization
group, which is only populated after loading checkdoc. A new test
ensures that the list is up-to-date.

The main use of this is allowing for file- and directory-local checkdoc
settings.

Closes GH-741.
@cpitclaudel cpitclaudel force-pushed the 741-checkdoc-inherit-configuration branch from a106679 to b7c03b2 Compare April 4, 2016 09:56
@cpitclaudel
Copy link
Member Author

Ok, build fixed :)

@swsnr swsnr closed this in ead2b61 Apr 30, 2016
swsnr added a commit that referenced this pull request Apr 30, 2016
The tested setting doesn’t exist in that version.

See GH-937
swsnr added a commit that referenced this pull request Apr 30, 2016
The tested setting doesn’t exist in that version.

See GH-937
@swsnr swsnr deleted the 741-checkdoc-inherit-configuration branch April 30, 2016 13:38
@swsnr
Copy link
Contributor

swsnr commented Apr 30, 2016

@cpitclaudel Merged, with some little refinements. Specifically I noticed that we need to bind enable-local-variables to :safe around (hack-local-variables) to make sure that Emacs doesn't prompt for configuration when a resource file contains unsafe variables. That'd make the test suite stuck.

@cpitclaudel
Copy link
Member Author

Awesome; nice catch!

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

2 participants