rewrite-clj

lread 2023-03-25T12:58:02.603069Z

Ok, taking my first sips of coffee... Good question on read-string-data ... I'll start by playing in the REPL with your snippets above.

borkdude 2023-03-25T13:07:36.141929Z

Optimally I think we would skip the whole read-string-data, but for compatibility with the old situation I just re-parsed the string that was coerced into a node

lread 2023-03-25T13:09:41.625669Z

Right. Rebooting my brain. We https://github.com/clj-commons/rewrite-clj/issues/214#issuecomment-1430357842 to TokenNode. But if I understand this is causing issues with: > In clj-kondo I have a predicate string-from-token which just does :lines since normally, the string is inside of :lines but not for coerced string -> node Because a TokenNode is not a StringNode as does not have :lines.

borkdude 2023-03-25T13:12:14.465739Z

This is the rewrite-clj of olden days that I once vendored: https://github.com/clj-commons/rewrite-clj/tree/f515767e4f07f27389ee2885cb459bd87d903887

borkdude 2023-03-25T13:14:21.182189Z

my "fix" in clj-kondo is to get equality between string node from parse-string and coerce, by re-parsing the pr-str-ed string (which feels clunky)

borkdude 2023-03-25T13:14:35.085539Z

I could also just do a more broad check for a string inside a general token node

lread 2023-03-25T13:15:09.769569Z

Yeah, I do feel it is awkward.

borkdude 2023-03-25T13:15:24.674689Z

but maybe on the way through parse-string I might as well rip out the whole read-string-data. why does rewrite-clj do this? to get multiple lines. but why does it need that?

borkdude 2023-03-25T13:16:48.367369Z

something with edit-multiline: https://github.com/search?q=repo%3Aclj-commons%2Frewrite-clj%20%3Alines&type=code

lread 2023-03-25T13:18:58.617039Z

So your question about why read-string-data I think its intent is to preserve multi-line strings when writing out the nodes (to distinguish \n from an actual newline, for example). But I'd have to test my assumption that it is needed for that.

lread 2023-03-25T13:20:35.535409Z

The fact that :lines is used internally and externally means whatever we do we'd have to preserve that aspect of a string node.

borkdude 2023-03-25T13:21:33.718179Z

yes

borkdude 2023-03-25T13:21:38.935509Z

ok, then my PR is what we need to do probably

borkdude 2023-03-25T13:21:41.802459Z

I'm fine with that

borkdude 2023-03-25T13:21:55.305529Z

shall I also prepare this for rewrite-clj?

lread 2023-03-25T13:22:18.827409Z

I haven't taken a peek at your PR yet, would you like me to?

borkdude 2023-03-25T13:22:29.561509Z

it involves moving read-string-data to utils, so we don't get a cyclic dependency and wrapping the string in a string-reader so we can read it with read-string-data

borkdude 2023-03-25T13:22:35.462509Z

yes, take a peek

👍 1
lread 2023-03-25T13:27:35.708539Z

Ok, I think your PR is option 2 from our https://github.com/clj-commons/rewrite-clj/issues/214#issuecomment-1430357842? But instead of mimicking the parser, just reuse the appropriate parts of the parser, which is a better way to go.

borkdude 2023-03-25T13:28:29.702219Z

yes, but using the same implementation as parse-string so you don't use one implementation for the other, and a different one for the other

lread 2023-03-25T13:30:05.271589Z

Ya, much better way to go. Also, good news: I forgot to release our previous fix, so this change to it should not annoy any rewrite-clj users.

borkdude 2023-03-25T13:32:38.161279Z

lol ok

lread 2023-03-25T13:32:40.402829Z

I can transcribe this to rewrite-clj if you like. Unless you have an itch for commits to rewrite-clj, that's fine too.

borkdude 2023-03-25T13:33:07.895079Z

I've got to keep my co-maintainer-ship street credit up, maybe? ;)

lread 2023-03-25T13:33:24.769479Z

Sure, go for it!

lread 2023-03-25T13:34:30.952779Z

Also coding is just one small part of it, right. There's the thought, discovery, support, design, etc. You are a great co-maintainer already.

borkdude 2023-03-25T13:57:02.409599Z

@lee https://github.com/clj-commons/rewrite-clj/pull/231

borkdude 2023-03-25T14:03:28.408219Z

@lee speaking of duplicate builds and climate change, don't you think this is a bit overkill?

19 in progress, 15 successful, and 68 queued checks

borkdude 2023-03-25T14:04:29.560619Z

maybe there's a good reason for this high number of builds ;-)

lread 2023-03-25T14:49:16.598879Z

Ha! Yeah, thorough, eh?

👍 1
lread 2023-03-25T15:01:51.531279Z

Just had a peek at workflows. The Libs Tests seem good (one job per lib we test against means 20 jobs), Native Image Tests seems ok (12 jobs to cover variants), but maybe the granularity of Unit Tests could be coarser (currently 68 jobs). In the general: I'm still kinda looking into de-duping unnecessary job runs on GHA. I want to evaluate this next: https://github.com/marketplace/actions/skip-duplicate-actions. For example, if I've just successfully run job X on source Y in a PR there is no need to rerun this job when merging the PR in source Y is unchanged by the merge.

borkdude 2023-03-25T15:04:04.729599Z

@lee I'm testing libs in just one 1 job for babashka, it's even in the same runner as the rest of the tests

lread 2023-03-25T15:14:08.754359Z

Rewrite-clj runs the full test suites of current releases of libs that use rewrite-clj. Some of these take a while to run, so parallelization helped here. Some of libs tests have historically been a bit flakey, so being able to rerun a single one after failure is nice.

borkdude 2023-03-25T15:14:51.205959Z

agreed

borkdude 2023-03-25T15:18:46.650919Z

everytime I dig into rewrite-clj's implementation I'm like: what a brilliant library it still is

lread 2023-03-25T15:20:53.220409Z

And it was originally just written to update dependencies in lein project files! The original author never imagined it would be used for what is it used for today. Quite cool, yes.

borkdude 2023-03-25T15:22:14.893279Z

@yannick.scherer gratitude

3
xsc 2023-03-25T15:22:19.374989Z

@yannick.scherer has joined the channel

lread 2023-03-25T15:23:36.370419Z

And @rundis for rewrite-cljs work, which was pretty awesome too!

2
lread 2023-03-25T15:24:40.373279Z

And https://github.com/clj-commons/rewrite-clj/blob/main/README.adoc#contributors over the years!

2
lread 2023-03-25T15:27:44.165289Z

I'll do a maint pass on rewrite-clj (make sure canaries are up to date) and then cut a release, ya?

1
borkdude 2023-03-25T15:28:01.111949Z

sure!

lread 2023-03-25T18:22:01.778359Z

Ok. Back at keyboard. Will attempt publish. First publish since moving from GUI-triggered to git version-tag-triggered, so might be a thing or two to iron out.

✅ 1
lread 2023-03-25T19:23:10.554609Z

Ok, good. Only had to remove a branch protection rule from GitHub settings for publish environment I setup for GUI-triggered build.

lread 2023-03-25T03:45:45.409589Z

I'll take a peek my-tomorrow.