liquidz / build.edn

Make your Clojure library build process easy.
Other
83 stars 3 forks source link

lint missed something that errored later #37

Open didibus opened 5 months ago

didibus commented 5 months ago

I ran clojure -T:build lint and got OK.

But when I ran clojure -T:build java-compile I got:

Execution error (ExceptionInfo) at build-edn.core/validate-config! (core.clj:40).
Invalid config: {:java-paths ["missing required key"]}

Full report:

{:clojure.main/message
 "Execution error (ExceptionInfo) at build-edn.core/validate-config! (core.clj:40).\nInvalid config: {:java-paths [\"missing required key\"]}\n",
 :clojure.main/triage
 {:clojure.error/class clojure.lang.ExceptionInfo,
  :clojure.error/line 40,
  :clojure.error/cause
  "Invalid config: {:java-paths [\"missing required key\"]}",
  :clojure.error/symbol build-edn.core/validate-config!,
  :clojure.error/source "core.clj",
  :clojure.error/phase :execution},
 :clojure.main/trace
 {:via
  [{:type clojure.lang.ExceptionInfo,
    :message
    "Invalid config: {:java-paths [\"missing required key\"]}",
    :data {:java-paths ["missing required key"]},
    :at
    [build_edn.core$validate_config_BANG_
     invokeStatic
     "core.clj"
     40]}],
  :trace
  [[build_edn.core$validate_config_BANG_ invokeStatic "core.clj" 40]
   [build_edn.core$validate_config_BANG_ invoke "core.clj" 34]
   [build_edn.core$java_compile invokeStatic "core.clj" 136]
   [build_edn.core$java_compile invoke "core.clj" 131]
   [build_edn.main$java_compile invokeStatic "main.clj" 36]
   [build_edn.main$java_compile invoke "main.clj" 31]
   [clojure.lang.Var invoke "Var.java" 384]
   [clojure.run.exec$exec invokeStatic "exec.clj" 89]
   [clojure.run.exec$exec invoke "exec.clj" 78]
   [clojure.run.exec$_main$fn__220 invoke "exec.clj" 228]
   [clojure.run.exec$_main invokeStatic "exec.clj" 224]
   [clojure.run.exec$_main doInvoke "exec.clj" 192]
   [clojure.lang.RestFn applyTo "RestFn.java" 137]
   [clojure.lang.Var applyTo "Var.java" 705]
   [clojure.core$apply invokeStatic "core.clj" 667]
   [clojure.main$main_opt invokeStatic "main.clj" 514]
   [clojure.main$main_opt invoke "main.clj" 510]
   [clojure.main$main invokeStatic "main.clj" 664]
   [clojure.main$main doInvoke "main.clj" 616]
   [clojure.lang.RestFn applyTo "RestFn.java" 137]
   [clojure.lang.Var applyTo "Var.java" 705]
   [clojure.main main "main.java" 40]],
  :cause "Invalid config: {:java-paths [\"missing required key\"]}",
  :data {:java-paths ["missing required key"]}}}
liquidz commented 4 months ago

@didibus Thanks for your report!

In the build.edn, the required configurations are different for each task, and in the lint task, it checks for required settings that can be identified from the configuration file.

java-paths is only required in the java-compile task, so currently it is not checked in the lint task because it would cause errors for users who do not use the java-compile task.

However, I understand the inconvenience, so I would like to consider making adjustments to issue warnings like "There are no required settings for this task" in the future.

didibus commented 4 months ago

Ah, that makes sense. You can't tell if that's a task the user will run or not, so you can't fail the lint, because if they are not going to use the task it makes sense for them not to have the required fields for it.

I'm thinking here as well, maybe the build.edn can take options of the list of tasks to lint for ? That way I know I'm using java-compile and want to make sure it gets linted?