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-10 05:49:44 +00:00
|
|
|
Add `[jonase/kibit "0.0.2"]` to your `:plugins` vector in your `:user`
|
2012-03-04 22:09:59 +00:00
|
|
|
profile (Leiningen 2) or if you are using Leiningen 1:
|
2012-03-04 16:41:53 +00:00
|
|
|
|
2012-03-10 05:49:44 +00:00
|
|
|
$ lein plugin install jonase/kibit 0.0.2
|
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-15 22:30:20 +00:00
|
|
|
[`control-structures.clj`](https://github.com/jonase/kibit/blob/master/src/jonase/kibit/rules/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.
|
|
|
|
|
2012-03-05 17:46:03 +00:00
|
|
|
## Contributors
|
|
|
|
|
|
|
|
* Jonas Enlund
|
|
|
|
* Phil Hagelberg
|
|
|
|
* Alan Malloy
|
|
|
|
* Paul deGrandis
|
|
|
|
|
2012-03-04 16:41:53 +00:00
|
|
|
## TODO
|
|
|
|
|
2012-03-05 17:46:03 +00:00
|
|
|
* Rules for function definitions (make this more of a lint tool)
|
|
|
|
* Rules for collection lookup; "2 is a bad smell" [see this blog post](http://tech.puredanger.com/2011/10/12/2-is-a-smell/)
|
|
|
|
* Extract the "when to use" rules from [Joy of Clojure](http://joyofclojure.com/)
|
|
|
|
* Leiningen project.clj setting for rule exclusion
|
|
|
|
* Leiningen project.clj setting for a directory of rules to include
|
2012-03-22 01:32:34 +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.
|
2012-03-05 17:46:03 +00:00
|
|
|
|