Fork me on GitHub
#cider
<
2018-03-09
>
bozhidar03:03:24

@mathpunk I’ve meant to look into this bug for a while, but unfortunately lately I’ve had very little time for OSS projects. As this works in clients like reply (lein repl) I assume the fix should be simply, but someone should do the debugging first.

xiongtx05:03:14

Just a placeholder account for registering CI?

gonewest81805:03:07

It’s a Github account from which I generated an API token that only has enough permissions to commit and push changes to the repo (the document generation). That way, if the token gets compromised somehow (it’s theoretically possible) the attacker doesn’t get any more privileges than are absolutely necessary. Compare to just encrypting my GitHub password which would theoretically give the attacker admin access to the repo if the token were compromised.

xiongtx06:03:12

Maybe the ☝️ description could be added to the :robot_face:'s profile?

gonewest81807:03:03

Done. There’s a limited character count but I got the gist.

bozhidar12:03:49

Well, I guess we can add some notes about the CI in the readme or something. But maybe after the proposed migration to CircleCI.

benedek15:03:27

I have a weird thing on a project where I can run test at point and tests for ns with cider but test loaded nses or all project tests return "no assertions or no tests were run" I will debug it further but does this ring a bell for anybody?

benedek15:03:48

my nses are loaded ofc

dpsutton15:03:30

i've seen that before, @bendek

dpsutton15:03:50

i think it was that the test paths aren't on the classpath for the profile you are using

dpsutton15:03:57

but when you eval them manually they are "seen"

dpsutton15:03:04

happens in cider-nrepl

dpsutton15:03:36

might be something else but i've seen it with that before i think

benedek15:03:06

so if I C-c C-k the test file it should be run by loaded or project?

benedek15:03:44

yeah I am looking at the middleware code and I can see the filter checking the meta data on ns-interns...

dpsutton15:03:05

yeah i was rooting around in cider-nrepl and realized i need to fork and clone orchard ot see

benedek15:03:09

so C-c C-k does not fix for me

benedek15:03:45

will dig further

dpsutton15:03:50

(defn project-namespaces
  "Find all namespaces defined in source paths within the current project."
  []
  (->> (filter (memfn isDirectory) (cp/classpath (class-loader)))
       (filter #(.startsWith (str %) project-root))
       (mapcat ns-find/find-namespaces-in-dir)))
so i don't think it matters that you've loaded it manually. it's what i thinks "should" be loaded

benedek15:03:50

thanks for the hint

dpsutton16:03:53

also could be a bug. i orginally wrote that code to look for a common namespace prefix. but i didn't use project-root because there are examples where the namespace root is different from the project root. cider-nrepl itself was an example

benedek16:03:54

I am on windows (don't ask :/) and paths are absolute on my classpath

benedek16:03:36

could that be the problem b/c of starts-with?

benedek16:03:18

could we do contains instead?

dpsutton16:03:36

ah nevermind. it's looking at the file paths. are you sure your test dirs are on your classpath?

benedek17:03:54

I added the test dir to the source dirs in dev (talking leiningen here)

benedek17:03:32

and yeah I run both cp/classpath from the repl and cider classpath

benedek17:03:44

essentially the same I guess...

benedek17:03:29

off from the office now and no win machines at home so back on this on Monday. thx @dpsutton again for looking at it

bozhidar17:03:12

@benedek Btw, it’d be nice to check what exactly the middleware calls are returning for loaded and project namespaces.

benedek17:03:01

will do Bug

dcj17:03:21

I haven't been able to jack-in for awhile....

Error loading refactor-nrepl.middleware: clojure.lang.ExceptionInfo: Alembic can not manipulate specified ClassLoader. {:classloader #object[jdk.internal.loader.ClassLoaders$AppClassLoader 0x4f8e5cde "[email protected]"], :reason :not-addable-with-dynapath}, compiling:(mranderson047/alembic/v0v3v3/alembic/still.clj:65:1)
Exception in thread "main" java.lang.RuntimeException: Unable to resolve var: refactor-nrepl.middleware/wrap-refactor in this context, compiling:(/private/var/folders/nr/8vbdczz90ps9zfrklvm8jfwm0001yl/T/form-init5367904295233548109.clj:1:7964)
	at clojure.lang.Compiler.analyzeSeq(Compiler.java:7010)
	at clojure.lang.Compiler.analyze(Compiler.java:6773)
lein version
Leiningen 2.8.1 on Java 9.0.1 Java HotSpot(TM) 64-Bit Server VM

find . -name user.clj -print
./dev/user.clj

cat dev/user.clj
(ns user
  (:require [ :as io]
            [clojure.string :as str]
            [clojure.pprint :refer (pprint)]
            [clojure.repl :refer :all]
            [com.walmartlabs.system-viz :refer [visualize-system]]
            [com.walmartlabs.datascope :as ds])
            [reloaded.repl :refer [system init start stop go reset]]
            [clojure.tools.namespace.repl :refer (refresh refresh-all)]
            ))

bozhidar17:03:31

@dcj What happens on jack-in for you?

dcj17:03:06

please see edited message above with more details

bozhidar17:03:03

@dcj Remove the injection of refactor-nrepl (or delete clj-refactor) and everything will work.

bozhidar17:03:28

Seems the last stable release is no longer compatible with CIDER.

dcj17:03:27

where am I injecting that?

dcj17:03:51

OIC: .emacs

dcj17:03:22

@bozhidar removing clj-refactor from my .emacs did not help. Looking for other places where this might be injected...

bozhidar17:03:52

Did you restart Emacs afterwards?

bozhidar17:03:04

Also - it might be in your profiles.clj.

dcj18:03:27

@bozhidar It is clearly being injected, but I haven't yet found where/why. Still searching

dpsutton18:03:37

There's an elisp variable that gets set to remember to inject refactor that doesn't get reset when you uninstall refactor

dpsutton18:03:48

It's bitten me in the past but I can't remember what it's called

dpsutton18:03:02

Jack in dependencies or something like that

dcj18:03:36

@dpsutton do elisp variables persist after exit/restarting emacs? Where are they persisted?

dpsutton18:03:12

It's sounding weird to me too but I'm almost positive I've dealt with this before

dpsutton18:03:45

I'm on the road but I can look it up after lunch

dcj18:03:15

@bozhidar here is the complete story of Messages https://pastebin.com/aWUG9h9T

dcj18:03:52

@bozhidar @dpsutton Problem solved! Removing all mention of clj-refactor from .emacs NOT GOOD ENOUGH. Had to actually delete the file from .emacs.d

dcj18:03:11

@bozhidar @dpsutton thanks for your help!

dcj18:03:36

OK, now I am going to ask a very embarrassing question: From a buffer of clojure code, I jack-in, eventually another window opens, with the user> prompt. How can I automatically or simply be in the namespace of the file I was editing? Basically get Cider to do the (use 'foo) and (ns foo) for me?

dpsutton19:03:00

Here's the code that breaks it for you from cljr

dpsutton19:03:11

defun cljr--inject-jack-in-dependencies () "Inject the REPL dependencies of clj-refactor at `cider-jack-in'. If injecting the dependencies is not preferred set `cljr-inject-dependencies-at-jack-in' to nil." (when (and cljr-inject-dependencies-at-jack-in (boundp 'cider-jack-in-lein-plugins) (boundp 'cider-jack-in-nrepl-middlewares)) (add-to-list 'cider-jack-in-lein-plugins `("refactor-nrepl" ,(cljr--version t))) (add-to-lis

gganley19:03:58

@dcj My fingers do things without me thinking, I think “switch to buffer while loading file and switching to namespace” might be something like C-u C-c M-z but now I’m doubting myself

dcj19:03:48

@gganley reading now, thx

gganley19:03:04

@dcj np, btw if you’re like me and prefer route memorization to documentation I constantly create Quizlet sets for this sort of thing https://quizlet.com/270049605/cider-repl-flash-cards/

gganley19:03:24

is that how you use route? I’ve only heard it spoken, never written

gganley19:03:27

It is actually rote not route

dcj19:03:40

@gganley C-u C-c M-z is correct, thanks! That is going to make life much better 🙂

gganley19:03:10

@dcj Throwing the book at you wasn’t meant to be dismissive, http://cider.readthedocs.io is ESSENTIAL

dcj19:03:01

@gganley I haven't gone through it in several years. Doing so now, and editing .emacs as I go...

dcj19:03:48

@gganley This also looks interesting:

Normally the CIDER REPL will start with the user namespace. You can supply a default value for REPL sessions via the repl-options section of your Leiningen project's configuration.

:repl-options {:init-ns 'my-ns}