https://github.com/borkdude/qualify-methods
Rewrite your instance calls to use fully qualified methods
https://github.com/borkdude/qualify-methods
clojure
Last synced: 10 months ago
JSON representation
Rewrite your instance calls to use fully qualified methods
- Host: GitHub
- URL: https://github.com/borkdude/qualify-methods
- Owner: borkdude
- License: mit
- Created: 2024-10-12T17:48:47.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-10-14T10:08:46.000Z (over 1 year ago)
- Last Synced: 2025-04-05T23:58:55.764Z (10 months ago)
- Topics: clojure
- Language: Clojure
- Homepage:
- Size: 6.84 KB
- Stars: 9
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# qualify-methods
Rewrite your instance calls to use fully qualified methods

## What does this tool do?
It rewrites instance method calls in the form `(.length x)` to Clojure 1.12's
fully qualified `(String/.length x)` form, whenever the class of the method can
be inferred using `clojure.tools.analyzer.jvm`. Reasons to do this may include
better IDE support (auto-completions), e.g. when you're using `clj-kondo` via
`clojure-lsp`.
## Status
Scrappy fiddle. Use at own risk. Improvements welcome via issue and PRs.
## Usage
In `deps.edn` add this library in `:aliases`. You will need to use `:extra-deps`
since this tool runs in the context of your application dependencies.
``` clojure
:aliases {:qualify-methods
{:extra-deps {io.github.borkdude/qualify-methods
{:git/sha ""}}
:exec-fn borkdude.qualify-methods/qualify-methods}}
```
Then run with `clj -X:qualify-methods :paths '["src"]'`
## TODO
- [ ] Add tests via cognitect test runner
- [ ] Take into account default imports like `String` vs. `java.lang.String` and
namespace specific imports
## License
MIT