-
Notifications
You must be signed in to change notification settings - Fork 67
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
Conditionally add flag to solium invocation & tweak output parsing for newer solium #35
Conditionally add flag to solium invocation & tweak output parsing for newer solium #35
Conversation
Hello @rowanthorpe, thank you for the PR. I don't mind waiting for proper handling of previous versions. I don't have the time to test it and add it on my own (mostly because I don't use solium lately so can't test it). Whenever you can do it we can merge the PR so that I don't break backwards compatibility. |
* remove the commented original macro, move its comment down * delete the unneeded (progn) * word the explanatory comment more concisely * reformat the expanded macro for readability
This is just a reordering, no content-change, separated out to make upcoming commits more readable
This involves expanding two (when)s to wrap more code, but otherwise only whitespace changes for formatting adjustment. It improves efficiency and sets up for upcoming "feature/version"-handling commits.
This involves expanding two (if)s to wrap more code, but otherwise only whitespace changes for formatting adjustment. It improves efficiency and sets up for upcoming "feature/version"-handling commits.
1b2be6f
to
25dd66a
Compare
I found that trying to version-match against solium was too brittle, so chose to match against the presence (or not) of the
to:
The main reason for the restructure was the need to reuse the result of the
to:
for the same reason (needing to eval part of some args rather than passing verbatim text to the underlying functions). Happily, the restructure makes it more efficient as well, avoiding unnecessary definitions if the tool is set inactive or the executable doesn't exist. Although I didn't find any "coding convention" docs, I am aware you may not agree with some of the edits I did, even if just for style reasons. If so, let me know what you want changed. |
* pre-expand macro * move checker-definition inside (if (funcall *-find solidity-*-path)) * add handling for --reporter
25dd66a
to
6efe814
Compare
I revised the last commit to use clearer naming of a var ( |
Hey Rowan. Thank you very much for your work. First off some questions. Does this commit, moving checker-definitions inside the Then you have another commit which moves them inside the call checking for existence of the relevant tool. Why have both commits? I guess the second alone is enough? I guess when you refer to efficiency you mean this?
Now for the styling, I looked at the code and it seems fine. Seems you even removed some rogue tabs. I have no idea how they ended up in there. My style in elisp is rather simple and I am not anal about it, so as long as the emacs elisp linter is not complaining I am fine. I tested your patch in my local machine and it seems to work fine and the logic for supporting older versions of solium also looks good. |
In this case, by "efficiency" I mean "solidity-mode-hook load-time efficiency" as opposed to "runtime efficiency once editing is under way", i.e. for each checker - if it is not set to be active then no load-time will be spent defining that checker (which wouldn't be used anyway). There is also the runtime memory-efficiency of having fewer symbols defined, but that is obviously way less important than the saved load-time aspect.
I kept those two changes separate purely in an attempt to make the commits as readable and quickly auditable as possible for you. Seeing you have now grokked them, if you prefer I squash the two commits together just let me know and I will do it (on the other hand our future selves and other future contributors might prefer easier readability versus fewer git-refs, but whether separate or squashed commits are more readable is a style-choice which I will leave to you).
Aside from the small reduction of load-time and tiny reduction of runtime-memory already mentioned above, the primary and much bigger "efficiency" reason for the restructuring is - as you correctly observe - being able to cache the result of the commandline call for reuse.
The majority of the rogue tabs were in the
I decided to make this change based on flag-presence in solium rather than solium version number (i.e. "use |
Oh no worries about that. I really don't think that the package needs to cater for really old versions of solium. Probably the easiest fix is to always tell them to upgrade solium or ... if they really want support for a specific version to open a PR here.
Yeah I should do that.
I normally favour squashed commits, but here it's fine as is. Thank you. I will merge this patch now. Thank you for your work and for your detailed commenting and answers to my questions. |
I have labeled this "WIP" for now because it is presently only a "works for me" patch for working with my version of solium (1.1.8), and I am sure there needs to be some version-handling added to make this still handle output from older versions too, rather than only the newer one. When I find time I will try to add version-handling backward-compatibility, but that might take a while, so please add a commit of your own to do that if you don't want to wait.
Aside from updating the parsing for the new output format, I also needed to add the reporter flag because the default output reporter is now "pretty".