(analyse ns {:keys [output sorted] :as params} lookup project)seed analyse function for the hara.code/analyse task
(->> (project/in-context (analyse 'hara.code.framework-test)) (common/display-entry)) => (contains-in {:test {'hara.code.framework (contains '[analyse analyse-file analyse-source-code])}})
(->> (project/in-context (analyse 'hara.code.framework)) (common/display-entry)) => (contains-in {:source {'hara.code.framework (contains '[analyse analyse-file analyse-source-code])}})
seed analyse function for the `hara.code/analyse` task
(->> (project/in-context (analyse 'hara.code.framework-test))
(common/display-entry))
=> (contains-in {:test {'hara.code.framework
(contains '[analyse
analyse-file
analyse-source-code])}})
(->> (project/in-context (analyse 'hara.code.framework))
(common/display-entry))
=> (contains-in {:source {'hara.code.framework
(contains '[analyse
analyse-file
analyse-source-code])}})(analyse-file path)(analyse-file type path)helper function for analyse, taking a file as input
helper function for analyse, taking a file as input
(analyse-file-fn type path time)(analyse-source-code s)analyses a source file for namespace and function definitions
(-> (analyse-source-code (slurp "dev/test/hara.code/src/example/core.clj")) (get-in '[example.core -foo-])) => '{:ns example.core, :var -foo-, :source {:code "(defn -foo-\n [x]\n (println x "Hello, World!"))", :line {:row 3, :col 1, :end-row 6, :end-col 31}, :path nil}}
analyses a source file for namespace and function definitions
(-> (analyse-source-code (slurp "dev/test/hara.code/src/example/core.clj"))
(get-in '[example.core -foo-]))
=> '{:ns example.core,
:var -foo-,
:source {:code "(defn -foo-\n [x]\n (println x \"Hello, World!\"))",
:line {:row 3, :col 1, :end-row 6, :end-col 31},
:path nil}}(analyse-source-function nsp nav)helper function for analyse-source-code
helper function for `analyse-source-code`
(analyse-test-code s)analyses a test file for docstring forms
(-> (analyse-test-code (slurp "dev/test/hara.code/test/example/core_test.clj")) (get-in '[example.core -foo-]) (update-in [:test :code] docstring/->docstring)) => (contains '{:ns example.core :var -foo- :test {:code "1\n => 1" :line {:row 6 :col 1 :end-row 7 :end-col 16} :path nil} :meta {:added "3.0"} :intro ""})
analyses a test file for docstring forms
(-> (analyse-test-code (slurp "dev/test/hara.code/test/example/core_test.clj"))
(get-in '[example.core -foo-])
(update-in [:test :code] docstring/->docstring))
=> (contains '{:ns example.core
:var -foo-
:test {:code "1\n => 1"
:line {:row 6 :col 1 :end-row 7 :end-col 16}
:path nil}
:meta {:added "3.0"}
:intro ""})(docstrings ns {:keys [full sorted]} lookup project)returns all docstrings in a given namespace with given keys
(->> (project/in-context (docstrings)) (map first) sort) => (project/in-context (vars {:sorted true}))
returns all docstrings in a given namespace with given keys
(->> (project/in-context (docstrings))
(map first)
sort)
=> (project/in-context (vars {:sorted true}))(find-test-frameworks ns-form)find test frameworks given a namespace form (find-test-frameworks '(ns ... (:use hara.test))) => #{:fact}
(find-test-frameworks '(ns ... (:use clojure.test))) => #{:clojure}
find test frameworks given a namespace form
(find-test-frameworks '(ns ...
(:use hara.test)))
=> #{:fact}
(find-test-frameworks '(ns ...
(:use clojure.test)))
=> #{:clojure}(import-selector)(import-selector var)creates an import selector
(import-selector '-hello-) ;;[(#{<options>} | -hello- string? map? & _)] => vector?
creates an import selector
(import-selector '-hello-)
;;[(#{<options>} | -hello- string? map? & _)]
=> vector?(locate-code ns
{:keys [print query process] :as params}
lookup
{:keys [root] :as project})finds code base upon a query
(project/in-context (locate-code {:query '[docstrings] :print {:function true}}))
finds code base upon a query
(project/in-context (locate-code {:query '[docstrings]
:print {:function true}}))(refactor-code ns {:keys [edits] :as params} lookup project)takes in a series of edits and performs them on the code
(project/in-context (refactor-code {:edits []})) => {:changed [], :updated false, :path "test/hara/code/framework_test.clj"}
takes in a series of edits and performs them on the code
(project/in-context (refactor-code {:edits []}))
=> {:changed [], :updated false, :path "test/hara/code/framework_test.clj"}(toplevel-selector)(toplevel-selector var)creates a selector for querying toplevel forms
(toplevel-selector '-hello-) ;;[(#{<def forms>} | -hello- & _)] => vector?
creates a selector for querying toplevel forms
(toplevel-selector '-hello-)
;;[(#{<def forms>} | -hello- & _)]
=> vector?(transform-code ns
{:keys [write print skip transform full] :as params}
lookup
{:keys [root] :as project})transforms the code and performs a diff to see what has changed
;; options include :skip, :full and :write (project/in-context (transform-code 'hara.code.framework {:transform identity})) => (contains {:changed [] :updated false :path any})
transforms the code and performs a diff to see what has changed
;; options include :skip, :full and :write
(project/in-context (transform-code 'hara.code.framework {:transform identity}))
=> (contains {:changed []
:updated false
:path any})(var-function full)constructs a var, with or without namespace
((var-function true) {:ns 'hello :var 'world}) => 'hello/world
((var-function false) {:ns 'hello :var 'world}) => 'world
constructs a var, with or without namespace
((var-function true) {:ns 'hello :var 'world})
=> 'hello/world
((var-function false) {:ns 'hello :var 'world})
=> 'world(vars ns {:keys [full sorted] :as params} lookup project)returns all vars in a given namespace (project/in-context (vars {:sorted true})) => (contains '[analyse analyse-file analyse-source-code analyse-source-function ])
returns all vars in a given namespace
(project/in-context (vars {:sorted true}))
=> (contains '[analyse
analyse-file
analyse-source-code
analyse-source-function
])cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |