2012-03-04 16:41:53 +00:00
|
|
|
# kibit
|
|
|
|
|
|
|
|
*There's a function for that!*
|
|
|
|
|
|
|
|
`kibit` is a static code analyzer for Clojure which uses the
|
|
|
|
[`core.logic`](https://github.com/clojure/core.logic) unifier to
|
|
|
|
search for patterns of code for which there might exist a more
|
|
|
|
idiomatic function or macro. For example if kibit finds the code
|
|
|
|
|
|
|
|
(if (some test)
|
|
|
|
(some action)
|
|
|
|
nil)
|
|
|
|
|
2012-03-05 08:54:31 +00:00
|
|
|
it will make the suggestion to use the `when` macro instead of `if`.
|
2012-03-04 16:41:53 +00:00
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
2012-03-04 22:09:59 +00:00
|
|
|
Add `[jonase/kibit "0.0.1"]` to your `:plugins` vector in your `:user`
|
|
|
|
profile (Leiningen 2) or if you are using Leiningen 1:
|
2012-03-04 16:41:53 +00:00
|
|
|
|
2012-03-04 22:09:59 +00:00
|
|
|
$ lein plugin install jonase/kibit 0.0.1
|
2012-03-04 16:41:53 +00:00
|
|
|
|
2012-03-04 22:09:59 +00:00
|
|
|
Then you can run
|
2012-03-04 16:41:53 +00:00
|
|
|
|
2012-03-04 22:09:59 +00:00
|
|
|
$ lein kibit
|
2012-03-04 16:41:53 +00:00
|
|
|
|
|
|
|
to analyze your namespaces.
|
|
|
|
|
|
|
|
## Contributing
|
|
|
|
|
2012-03-04 18:42:20 +00:00
|
|
|
It is very easy to write new patterns for `kibit`. Take a look at
|
2012-03-05 08:54:31 +00:00
|
|
|
[`control-structures.clj`](https://github.com/jonase/kibit/blob/master/src/jonase/kibit/control_structures.clj)
|
2012-03-04 19:01:33 +00:00
|
|
|
to see how new patterns are created. If you know of a recurring
|
2012-03-04 18:42:20 +00:00
|
|
|
pattern of code that can be simplified, please consider sending me a
|
|
|
|
pull request.
|
2012-03-04 16:41:53 +00:00
|
|
|
|
|
|
|
Bugs can be reported using the github bug tracker.
|
|
|
|
|
|
|
|
## TODO
|
|
|
|
|
|
|
|
* Figure out how to report line numbers.
|
|
|
|
* More rules
|
2012-03-04 16:43:23 +00:00
|
|
|
* Remove reflection warnings (how?)
|
2012-03-04 17:05:37 +00:00
|
|
|
* Can core.logic be used to its full potential?
|
2012-03-04 18:42:20 +00:00
|
|
|
* Analyse ClojureScript files?
|
2012-03-04 16:41:53 +00:00
|
|
|
|
|
|
|
## License
|
|
|
|
|
2012-03-04 22:09:59 +00:00
|
|
|
Copyright © 2012 Jonas Enlund
|
2012-03-04 16:41:53 +00:00
|
|
|
|
|
|
|
Distributed under the Eclipse Public License, the same as Clojure.
|