Liking cljdoc? Tell your friends :D

hara.code.framework


*toplevel-forms*clj


analyseclj

(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])}})
raw docstring

analyse-fileclj

(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
raw docstring

analyse-file-fnclj

(analyse-file-fn type path time)

analyse-source-codeclj

(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}}
raw docstring

analyse-source-functionclj

(analyse-source-function nsp nav)

helper function for analyse-source-code

helper function for `analyse-source-code`
raw docstring

analyse-test-codeclj

(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 ""})
raw docstring

docstringsclj

(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}))
raw docstring

find-test-frameworksclj

(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}
raw docstring

import-selectorclj

(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?
raw docstring

locate-codeclj

(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}}))
raw docstring

refactor-codeclj

(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"}
raw docstring

toplevel-selectorclj

(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?
raw docstring

transform-codeclj

(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})
raw docstring

var-functionclj

(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
raw docstring

varsclj

(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
               ])
raw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close