-
Notifications
You must be signed in to change notification settings - Fork 11
Expand CLI functionality in main, make available on earlier Julia versions, and add .pre-commit-config.yaml
#86
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
Expand CLI functionality in main, make available on earlier Julia versions, and add .pre-commit-config.yaml
#86
Conversation
Yeah, we should merge these! However currently I am using the if @isdefined(var"@main")
@main
endat the end of the file. My understanding is |
|
The other thing is the CLI needs to be expanded to add the
This is on purpose :). I want to have bits that deliberately fail to have examples for the readme. Also, ExplicitImports is under development (although I've been busy), rather than in a "maintenance" point of its lifecycle, so I don't think at this point its lifecycle it's necessarily worth the tradeoff to use explicit imports everywhere. |
|
Great. I'll start merging the scripts and update the hook. The docs on the The tests seem to be broken from something else, by the way. Looks like some change in DataFrames. |
Hm, I think we could move that section to the README, it's really a CLI rather than API. Then I think they could go together, usage from command line or usage as precommit hook. |
c1cb579 to
69ee353
Compare
Update the CLI at src/main.jl to allow running the checks. The checks can be defined based on parsed arguments. Create scripts/explicit-imports.jl to pass ARGS to the CLI when running pre-commit. Create a pre-commit hook that runs the script. Move the documentation of CLI from docs/api.md to the README. Expands the CLI documentation with information on how to run the pre-commit hooks. Closes JuliaTesting#85
69ee353 to
ffaf9bd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've made the corrections and update to merge the CLI. I squashed and rebased the commits, updating the commit and PR description.
I haven't done any extensive testing, just copy-pasted the -m Module things for the other direct functionality.
Let me know your thoughts.
| # suppress warning about Base.parse collision, even though parse is never used | ||
| # this avoids a warning when loading the package while creating an unused explicit import | ||
| # the former occurs for all users, the latter only for developers of this package |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this happened because of auto-running the formatter.
src/main.jl
Outdated
| str, | ||
| " See the output of `--help` for usage details.") | ||
| return 1 | ||
| return exit(1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apparently -m Module automatically translates the returned value to exit code, but for the Julia -e CLI execution, I had to use exit(1) instead.
This reverts commit d1ef007.
|
Thanks, this looks great. I took the liberty of pushing up some changes as my form of review, since I wanted to play around with it and try out the CLI changes.
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #86 +/- ##
==========================================
- Coverage 96.84% 93.36% -3.49%
==========================================
Files 9 10 +1
Lines 1015 1175 +160
==========================================
+ Hits 983 1097 +114
- Misses 32 78 +46 ☔ View full report in Codecov by Sentry. |
main, make available on earlier Julia versions, and add .pre-commit-config.yaml
|
Thanks for the changes and thanks for the detailed explanation. I'm really happy with the result. |
Update the CLI at src/main.jl to allow running the checks.
The checks can be defined based on parsed arguments.
Create scripts/explicit-imports.jl to pass ARGS to the CLI when running pre-commit.
Create a pre-commit hook that runs the script.
Move the documentation of CLI from docs/api.md to the README.
Expands the CLI documentation with information on how to run the pre-commit hooks.
Closes #85
As I was finishing, I noticed that there is a
src/main.jlfile that is intended to be use as CLI.The new script is intended to be used as a check tool, so the functionalities are mostly orthogonal.
If you prefer, I can try to merge the two.
As a second note, I haven't seen any place where you run ExplicitImports itself through ExplicitImports.
Let me know if that's on purpose, or if you'd like me to add a check using the script in the CI.
I believe ExplicitImports only pass 2 of the 7 checks, so I would exclude the others.