Closed iperdomo closed 6 years ago
When using +site +api +example the Duct template generates a wrong example handler
+site +api +example
$ cd /tmp $ lein new duct myproject +api +site +example Generating a new Duct project named myproject... Run 'lein duct setup' in the project directory to create local config files. $ $ cat myproject/src/myproject/handler/example.clj (ns myproject.handler.example (:require [compojure.core :refer :all] [clojure.java.io :as io] [integrant.core :as ig])) (defmethod ig/init-key :myproject.handler/example [_ options] (context "/example" [] (GET "/" [] {:body {:example "data"}}(io/resource "myproject/handler/example/example.html"))))
See that the GET request has 2 return values {:body {:example "data"}} and (io/resource) call
GET
{:body {:example "data"}}
(io/resource)
Example of eastwood complaining about the code
eastwood
$ echo "{:user {:plugins [[jonase/eastwood "0.2.5"]] }}" > $HOME/.lein/profiles.clj $ cd /tmp/myproject $ lein eastwood '{:namespaces [myproject.handler.example]}' == Eastwood 0.2.5 Clojure 1.9.0 JVM 1.8.0_144 == Linting myproject.handler.example == Entering directory `/tmp/myproject' src/myproject/handler/example.clj:9:7: unused-ret-vals: Constant value is discarded: :body src/myproject/handler/example.clj:9:14: unused-ret-vals: Constant value is discarded: :example src/myproject/handler/example.clj:9:14: unused-ret-vals: Constant value is discarded: "data" == Warnings: 3 (not including reflection warnings) Exceptions thrown: 0 Subprocess failed
Thanks for the report. This is a duplicate of #68 so I'm closing it. The +site and +api profile hints aren't currently designed to work together.
+site
+api
When using
+site +api +example
the Duct template generates a wrong example handlerSee that the
GET
request has 2 return values{:body {:example "data"}}
and(io/resource)
callExample of
eastwood
complaining about the code