-
Notifications
You must be signed in to change notification settings - Fork 128
Documents usage with deps.tools #164
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
Conversation
When using `cljfmt` action, we ended up downloading all the dependencies of the project, as it would be integrated as a `lein` plugin. This was cumbersome, as it required exposing extra configuration to access the project's dependencies as well. Ideally, to reduce the adoption, it would be better to use `cljfmt` as a globally accessible tool, without the need to access the project's dependencies from GitHub Actions' execution environment. There is a [previously undocumented feature](weavejester/cljfmt#164) on `cljfmt` which exposes it as a `deps-tools` executable. This commit refactors the execution to run the formatter from a global execution path. This means we don't need extra access to the project dependencies. The configuration to use the formatter don't live anymore inside `lein`'s `project.clj`, and now is expected to live on their own file inside the project, as it is documented. We are also taking a chance to refactor a couple of things on the `zprint` action, which is somewhat complementary to `cljfmt`.
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.
Thanks for the patch! I have a few changes which need to be addressed before I can merge this.
Please also ensure the commit message follows the contributing guidelines, and uses plain text rather than markdown.
README.md
Outdated
|
|
||
| lein cljfmt fix src/foo/core.clj | ||
|
|
||
| ### deps-tools usage |
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.
Should be deps.tools.
README.md
Outdated
|
|
||
| ### deps-tools usage | ||
|
|
||
| It is possible to execute `cljfmt` using the [clojure](https://clojure.org/guides/deps_and_cli) CLI, without integrating with `lein`. |
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.
Line should be wrapped at. 72 characters. Use reference link format, e.g.
using the [clojure CLI][],, without Leiningen.
[clojure cli]: https://clojure.org/guides/deps_and_cli
README.md
Outdated
| It is possible to execute `cljfmt` using the [clojure](https://clojure.org/guides/deps_and_cli) CLI, without integrating with `lein`. | ||
|
|
||
| ```bash | ||
| clojure -Sdeps '{:deps {lein-cljfmt {:mvn/version "0.6.4"}}}' -m cljfmt.main [check|fix] |
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.
Use cljfmt, not lein-cljfmt.
README.md
Outdated
| clojure -Sdeps '{:deps {lein-cljfmt {:mvn/version "0.6.4"}}}' -m cljfmt.main [check|fix] | ||
| ``` | ||
|
|
||
| Customizing the rules is possible passing `edn` formated files, using the same content used on lein profiles. |
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.
Wrap line.
README.md
Outdated
|
|
||
| Customizing the rules is possible passing `edn` formated files, using the same content used on lein profiles. | ||
|
|
||
| As example, with the following content to the `indentation.edn` file, it is possible to customize the rules. |
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.
Wrap line.
README.md
Outdated
| ``` | ||
|
|
||
| ```bash | ||
| clojure -Sdeps '{:deps {lein-cljfmt {:mvn/version "0.6.4"}}}' -m cljfmt.main check --indents indentation.edn |
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.
Use cljfmt instead of lein-cljfmt.
|
@weavejester I've updated the document according to the feedback. Let me know if there are still anything else :) |
|
Sorry for leaving this PR hanging. It got a little lost in my inbox! There's still a few formatting changes that are missed out, and the commit message has a bunch of backticks in it. Do you want me to list the changes, or shall I edit your commit with the changes directly? |
|
Sorry for taking longer to check back as well. I've removed backticks from the commit message, as I was not sure if they should be replaced by simple quotes, but let me know if it would be better to quote any word. I've made sure both readme and commit message have short lines as well. |
|
Thanks! Can you change the commit message to: I'm using standard formatting here: imperative mood, wrap subject at 50, body at 72. Can you also change line 68 onward, as per my earlier comment: It is possible to execute cljfmt using the [clojure CLI][], without
integrating with Leiningen.
[clojure cli]: https://clojure.org/guides/deps_and_cliI'm happy to make the changes to the commit and merge if you don't have the time. |
Since weavejester#123 it is now possible to use cljfmt without integrating it with Leiningen. This commit adds documentation to the README on how to achieve that. Closes weavejester#93.
|
This is useful info, much thanks! |
Since #123 it is now possible to use
cljfmtwithout integrating it with lein.This is very useful for CI scripts, where you might want to check for indentation, but would rather not download all the projects dependencies.
This commit documents the usage with
deps-tools, using theclojurecommand line to executecljfmtwithout using the pluging interface. It includes how to configure the tool without using the lein profile setup.Closes #93