Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

address clj-kondo warnings about type hints #55

Merged
merged 1 commit into from
Sep 24, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions src/clojure/clj_yaml/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@
:block DumperOptions$FlowStyle/BLOCK
:flow DumperOptions$FlowStyle/FLOW})

(defn ^DumperOptions default-dumper-options
(defn default-dumper-options
"clj-yaml 0.5.6 used SnakeYAML 1.13 which by default did *not* split long
lines. clj-yaml 0.6.0 upgraded to SnakeYAML 1.23 which by default *did* split
long lines. This ensures that generate-string uses the older behavior by
default, for the sake of stability, i.e. backwards compatibility."
[]
^DumperOptions []
(doto (DumperOptions.)
(.setSplitLines false)))

(defn ^DumperOptions make-dumper-options
[{:keys [flow-style indent indicator-indent]}]
(defn make-dumper-options
^DumperOptions [{:keys [flow-style indent indicator-indent]}]
(let [dumper (default-dumper-options)]
(when flow-style
(.setDefaultFlowStyle dumper (flow-styles flow-style)))
Expand All @@ -36,12 +36,12 @@
(.setIndicatorIndent dumper indicator-indent))
dumper))

(defn ^LoaderOptions default-loader-options
[]
(defn default-loader-options
^LoaderOptions []
(LoaderOptions.))

(defn ^LoaderOptions make-loader-options
[& {:keys [max-aliases-for-collections allow-recursive-keys allow-duplicate-keys]}]
(defn make-loader-options
^LoaderOptions [& {:keys [max-aliases-for-collections allow-recursive-keys allow-duplicate-keys]}]
(let [loader (default-loader-options)]
(when max-aliases-for-collections
(.setMaxAliasesForCollections loader max-aliases-for-collections))
Expand All @@ -51,9 +51,9 @@
(.setAllowDuplicateKeys loader allow-duplicate-keys))
loader))

(defn ^Yaml make-yaml
(defn make-yaml
"Make a yaml encoder/decoder with some given options."
[& {:keys [unknown-tag-fn dumper-options unsafe mark max-aliases-for-collections allow-recursive-keys allow-duplicate-keys]}]
^Yaml [& {:keys [unknown-tag-fn dumper-options unsafe mark max-aliases-for-collections allow-recursive-keys allow-duplicate-keys]}]
(let [loader (make-loader-options :max-aliases-for-collections max-aliases-for-collections
:allow-recursive-keys allow-recursive-keys
:allow-duplicate-keys allow-duplicate-keys)
Expand Down