-
Notifications
You must be signed in to change notification settings - Fork 394
Problem with formatting Hash #1219
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Thanks, I can repro. This seems to be a bug from day 1 as the rule has not changed since 2017. The problem happens on this line where |
Great! Thank you. I can wait for a fix. Temporary I've disabled that rule. I only use comments/whitespace stripping for publishing modules (leaving only comments that are "help"). Rest of the comments/whitespace is stripped. So not really a big deal for me. |
Ok, there is no need for whitespace trimming if you publish to the PSGallery or NuGet based feed like Azure Artifacts because a module gets downloaded/uploaded as a NuGet package, i.e. it gets compressed, therefore the trimming does not have much of an impact on the size anyway. |
I do it for a bit different purpose. I actually clean up all my dev comments, old commented out code, new commented out code that is not yet ready and some other stuff that shouldn't be in code when publishing. You can see the diff here:
Or here:
Functionality is the same, output much smaller, less junk. So I apply my code that strips down comments but while it does it strips down any formatting (including whitespaces). And then I bring back formatting/whitespaces that make code readable using your formatter. If one wants to have original data all code is available on GitHub https://github.com/EvotecIT/PSWriteHTML with each function having a separate file. So this process is only used for publishing (merging into 1 file, cleaning up and so on). I believe it makes my modules a bit faster to load (in case of just merging it can take 12-15 seconds to load unmerged module vs 250ms for merged. I'm not applying the same approach to PSD1, but I was able to reproduce it on PSD1 in an easier way, then trying to pinpoint the problem in psm1 file (as I got similar crashes in there). |
Bug is boiled down. It is due to the hashtable opening character |
Thank you! |
Uh oh!
There was an error while loading. Please reload this page.
Steps to reproduce
I hvae simple .psd1 like this.
I've run a command that strips white chars and comments and this gives me this:
And during runtime of formater:
If an unexpected error was thrown then please report the full error details using e.g.
$error[0] | Select-Object *
Environment data
The text was updated successfully, but these errors were encountered: