Current pattern for multiple files formatting #313
-
Hi zprint community I was wondering if we are doing the right thing on multiple file path formatting:
Where the files are white-space separated by a bash scripts ( Now, we think something changed with My question is - is this the right approach? Is there a better way? |
Beta Was this translation helpful? Give feedback.
Replies: 16 comments 3 replies
-
Depending on what version you are coming from, you may be seeing things formatting differently because of the "smart wrap" change for comments in If you were moving from In any case, if you can give me a file or two that changed where you wouldn't expect it, and the version you were using, I'll see what I can figure out. I don't know of anything interesting about the way you are doing files that should be a problem. zprint doesn't know the difference between |
Beta Was this translation helpful? Give feedback.
-
Yes the funny thing is that I committed the differences and then launched a check against those in CI that failed (but succeeded locally). This was not easily reproducible.
So are you also passing multiple files as white-space separated to |
Beta Was this translation helpful? Give feedback.
-
I'm not entirely sure we are communicating here. When I said "I keep entire files in a single string with no issues", I mean that the source for every file zprint formats spends plenty of time as a single Clojure string. The point of that comment is that there is unlikely to be a size limit on the size of the information coming in from the shell for file specifications that is being hit that wouldn't already be hit by the size of the raw files themselves. To answer your question directly, not really. I don't typically place multiple filespecs on the same line. But when I say I'm sure you've checked, but is there a possible difference in the zprint config in CI from your local version? Or even a version difference in zprint? Or, (please no), you are doing CI on a different platform than your local work? |
Beta Was this translation helpful? Give feedback.
-
Yeah I
If the Now that we are on this I should try and run |
Beta Was this translation helpful? Give feedback.
-
In discussing this with someone, it occurred to me that I have seen situations where there were limitations on the length of a single filespec. This would be not so much in zprint, but in some of the tools that were generating filespecs, perhaps. I'm sure that the lengths of the filespecs produced by |
Beta Was this translation helpful? Give feedback.
-
Yes I think the problem lies there. This brings me to another idea then - would it make sense to add some sort of better support for formatting inside nested dirs? It would remove the need of external scripts at the cost of of course more logic (and code to maintain) in |
Beta Was this translation helpful? Give feedback.
-
Hmmm. I'm not sure just what "better support for formatting inside of nested directories" would look like. I did discover something responding to an issue or discussion question (that I can't actually find right now), which I didn't know. If you do something like this:
you will see all of the I'm not sure this would solve the problem -- but then again it just might. Anyway, I'm not likely to re-implement |
Beta Was this translation helpful? Give feedback.
-
Well yeah I think there are various ways to get a list of files in shells but the problem you will face sooner or later given a sufficiently large repo, is that ARG or filespec limit. I am sure it is solvable in bash (which we use) but moving the resposibility of finding all the clojure files to format starting from a dir within zprint is very enticing. Again just food for thought not saying it should be implemented ah ah. |
Beta Was this translation helpful? Give feedback.
-
Thanks. It wasn't clear to me just what problem you were trying to solve, but I have a bit of a better idea now. I'll see if I can figure out how to do that in a reasonable way -- with a reasonable UI as well. |
Beta Was this translation helpful? Give feedback.
-
Would something that did essentially this solve your problem? I don't mean actually using the shell, but getting this effect inside of zprint?
where you get to pick the extensions? That is, start in the current directory, and work down recursively doing all of a specified set of extensions? Where you tell zprint the extensions you want. That looks pretty easy to implement, though I'd have to switch file system libraries, which is far from easy. There are a lot of quirks in the ways that file systems work that I have fixed up over time using the current file system library that would come undone. But it might be worth doing. |
Beta Was this translation helpful? Give feedback.
-
It looks great for sure, would That definitely looks good to me and it is nice because I also usually format the It reminds me of the gitignore patterns, I like it. |
Beta Was this translation helpful? Give feedback.
-
I think the Presently, I'm looking into reworking the meta output to get you what you want (Issue #312). Making some small architectural changes to see if I can generate exactly what you want instead of the "close" I did before. We'll see how that comes out. |
Beta Was this translation helpful? Give feedback.
-
Thank you! We finally got to update the formatter and these two plus the namespace sorting are really going to be killer features in terms of time savings and (less) cognitive burden. Do you want me to close the discussion and open an issue instead? |
Beta Was this translation helpful? Give feedback.
-
No, this has a number that I can use. Don't need an issue. Since it has been a long time since |
Beta Was this translation helpful? Give feedback.
-
I've been playing around with the code for this. I have to release The actual format for the Opinions? |
Beta Was this translation helpful? Give feedback.
-
I am starting on the next release. If I do this "multiple files formatting" that we have discussed, it will be So I have two questions for you:
It would look like this to do what I think you want -- format every
Does that seem workable to you? It will be an error to do this (which you might think would do the same thing as the command above):
You can't have command line files and Anyway, does this still look interesting? I've done what I think is the hard work on it, so it isn't a big deal to finish it off if it would be useful to you (and/or you think it would be useful to others as well). Thanks! |
Beta Was this translation helpful? Give feedback.
Would something that did essentially this solve your problem? I don't mean actually using the shell, but getting this effect inside of zprint?
where you get to pick the extensions? That is, start in the current directory, and work down recursively doing all of a specified set of extensions? Where you tell zprint the extensions you want.
That looks pretty easy to implement, though I'd have to switch file system libraries, which is far from easy. There are a lot of quirks in the ways that file systems work that I have fixed up over time using the current file system library that would come undone. But it might be worth doing.