Liking cljdoc? Tell your friends :D

code.framework


*nav*clj


*toplevel-forms*clj


+analyse-fileclj


+read-ns-formclj


analyseclj

(analyse ns {:keys [output sorted] :as params} lookup project)

seed analyse function for the code.manage/analyse task

(->> (project/in-context (analyse 'code.framework-test)) (common/display-entry)) => (contains-in {:test {'code.framework (contains '[analyse analyse-file analyse-source-code])}})

(->> (project/in-context (analyse 'code.framework)) (common/display-entry)) => (contains-in {:source {'code.framework (contains '[analyse analyse-file analyse-source-code])}})

seed analyse function for the `code.manage/analyse` task

(->> (project/in-context (analyse 'code.framework-test))
     (common/display-entry))
=> (contains-in {:test {'code.framework
                        (contains '[analyse
                                    analyse-file
                                    analyse-source-code])}})

(->> (project/in-context (analyse 'code.framework))
     (common/display-entry))
=> (contains-in {:source {'code.framework
                          (contains '[analyse
                                      analyse-file
                                      analyse-source-code])}})
raw docstring

analyse-fileclj

(analyse-file [type path])

helper function for analyse, taking a file as input

(analyse-file [:source "src/code/framework.clj"])

helper function for analyse, taking a file as input

(analyse-file [:source "src/code/framework.clj"])
raw docstring

analyse-file-rawclj

(analyse-file-raw [type path])

helper function for code.framework/analyse-file

helper function for code.framework/analyse-file
raw docstring

analyse-source-codeclj

(analyse-source-code s)

analyses a source file for namespace and function definitions

(-> (analyse-source-code (slurp "test-data/code.manage/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 "test-data/code.manage/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 "test-data/code.manage/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 "test-data/code.manage/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

compile-regexclj

(compile-regex obj)

compiles a regex string from an input string

(compile-regex "(:require") => "\(:require"

compiles a regex string from an input string

(compile-regex "(:require")
=> "\\(:require"
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 code.test))) => #{:fact}

(find-test-frameworks '(ns ... (:use clojure.test))) => #{:clojure}

find test frameworks given a namespace form
(find-test-frameworks '(ns ...
                         (:use code.test)))
=> #{:fact}

(find-test-frameworks '(ns ...
                         (:use clojure.test)))
=> #{:clojure}
raw docstring

grep-replaceclj

(grep-replace ns
              {:keys [print query replace] :as params}
              lookup
              {:keys [root] :as project})

replaces code based on string query

(project/in-context (grep-replace {:query "docstrings" :replace "[DOCSTRINGS]" :print {:function true}}))

replaces code based on string query

(project/in-context (grep-replace {:query "docstrings"
                                   :replace "[DOCSTRINGS]"
                                  :print {:function true}}))
raw docstring

(grep-search ns
             {:keys [print query] :as params}
             lookup
             {:keys [root] :as project})

finds code based on string query

(project/in-context (grep-search {:query '[docstrings] :print {:function true}}))

finds code based on string query

(project/in-context (grep-search {:query '[docstrings]
                                  :print {:function true}}))
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] :as params}
             lookup
             {:keys [root] :as project})

finds code base upon a query

finds code base upon a query
raw docstring

no-testclj

(no-test ns params lookup project)

checks that a namespace does not require test

checks that a namespace does not require test
raw docstring

read-ns-formclj

(read-ns-form path)

memoised version of fs/read-ns

memoised version of fs/read-ns
raw docstring

read-ns-form-rawclj

(read-ns-form-raw path)

helper function for code.framework/read-ns-form

helper function for code.framework/read-ns-form
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/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/code/framework_test.clj"}
raw docstring

search-regexclj

(search-regex obj)

constructs a search regex (for line numbers)

(search-regex "hello") => #"^(.*?)(hello)"

constructs a search regex (for line numbers)

(search-regex "hello")
=> #"^(.*?)(hello)"
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 '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 '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