eastwood

All things realted to eastwood - the Clojure linter
2020-01-10T11:47:10.000900Z

Hi everyone eastwood gives me a weird error when I run it on my project. Can you help me figure out what it is about ?

slipset 2020-01-10T11:48:53.001800Z

Could you try to create github repo with a minimal repro?

slipset 2020-01-10T11:49:02.002100Z

I can’t say I’ve seen this before…

2020-01-10T13:33:53.002200Z

Here you are @slipset https://github.com/clov0/sample Thanks a lot

slipset 2020-01-10T13:56:21.002500Z

Would be great if you could strip it down a bit. Can’t do anything now because the stellar libs are not available to me.

2020-01-10T13:57:49.002900Z

Oh sorry

slipset 2020-01-10T13:57:59.003100Z

np

2020-01-10T14:13:29.004100Z

I removed all stellar libs

slipset 2020-01-10T14:13:59.004300Z

and the deps in the source as well?

2020-01-10T14:14:05.004600Z

Yup

slipset 2020-01-10T14:42:49.004800Z

Can’t really understand what’s going on, but it seems connected to core.async

slipset 2020-01-10T14:42:59.005Z

A workaround would be something like this:

slipset 2020-01-10T14:43:02.005200Z

(ns stellar.single-runner.components.om.test-op

  (:require [com.stuartsierra.component :as component]
            [clojure.core.async :as async]
            [taoensso.timbre :as timbre]
            [stellar.single-runner.components.om.protocol :as p]))

(def client-id "cid")

(defn send-orders* [orders]
  (let [access {}]
    (async/go
      (doseq [ord orders]
        (-> (:i-req access)
            (async/>! ord))))))

(defrecord test-om [om-config access]
  ;;---------------------------------;;

  component/Lifecycle

  (start [component]
    (timbre/spy :info ["Starting Test OM " om-config])
    (let [i-req (async/chan)
          o-resp (async/chan)
          o-data (async/chan)]
      (-> component
          (assoc :access
                 {:i-req i-req :o-resp o-resp :o-data o-data}))))

  (stop [component]
    (timbre/spy :info ["Stopping Test OM " om-config])
    (-> component
        (assoc :access nil)))

  ;;---------------------------------;;
  p/Ops

  (send-orders [om orders]
    (send-orders* orders))

  (stop-client! [om]
    (timbre/spy "Stop Om Client"))

  (<-client-id [om]
    (->> client-id))

  (<-req-ch [om]
    (:i-req access))

  (<-data-ch [om]
    (:o-data access))

  (<-resp-ch [om]
    (:o-resp access)))

(defn ->test-om [m]
  (map->test-om m))

2020-01-10T14:56:33.005400Z

Sorry, but I didn't quite get what got changed here ?

slipset 2020-01-10T14:57:13.005600Z

I extracted the meat of the send-orders implementation into its own function send-orders*

slipset 2020-01-10T14:58:09.005800Z

(which had an error btw 🙂

2020-01-10T15:13:34.006Z

Thanks a lot @slipset

slipset 2020-01-10T15:14:04.006200Z

No worries. Still have no clue why eastwood can’t analyze/lint it though…

2020-01-10T15:14:33.006400Z

Thanks. Will file an issue on their github

2020-01-10T20:59:27.006600Z

I recall having one or two case statements inside of Eastwood where I saw several cases of the tools.analyzer.jvm AST node types, but not all of them, and rather than silently doing nothing when an unknown node type was seen, I threw an exception.

2020-01-10T21:00:07.006800Z

When running on the crucible, or adding new projects, it is a good way to make it obvious when a new case appears that has not been seen by the Eastwood devs before (at the time, only me)

2020-01-10T21:01:13.007Z

It is not the most polite thing to put in the hands of users, I know, but it does tend to get the new cases reported with actual production code, rather than me making a wild guess how that node type ought to be handled.

👍 1