Skip to content
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

fixed broken function beautify if there are any non alphanumeric char… #72

Open
wants to merge 69 commits into
base: master
Choose a base branch
from

Conversation

hltdev8642
Copy link

@hltdev8642 hltdev8642 commented Nov 29, 2020

First off thank you for this program, I use it all the time and love it!

I just happened to notice that when you have functions with any non alphanumeric characters in them, it breaks those functions upon beautifying (and happens with all function styles).

A few examples would be:

function do-something-test (){}' 
do-something-test () {}` 

etc...

(and they end up looking (something) like this: do () -function test ()

I was able to fix this by a small regex change (replace \w with .) and it seems to resolve this bug. I didn't extensively test it, but things seem to work well with all the test cases I could come up with.

I hope this solution helps, or at least brings the issue to light so it can be resolved! (you may have a better way of fixing it...who knows :-) )

best, Jared

…achters in the function name (fns with dashes in them for instance, will be broken on beautifying). This very small regex change seems to fix the issue, and from my testing seems to work in all test cases I could come up with (all function styles, etc).
@lovesegfault
Copy link
Owner

Thanks for the fix!

Would you mind taking a look at the failing tests? It seems like it has changed the behavior of some formatting around functions

@hltdev8642
Copy link
Author

Thanks for the fix!

Would you mind taking a look at the failing tests? It seems like it has changed the behavior of some formatting around functions

Sure, ill take a look asap! I was going to come up with a better regex then just a . anyways, ill look into it a little more as there is probably a better way then being lazy and using (.*) Lol...

  • Jared

@lovesegfault
Copy link
Owner

I reworked the test infrastructure a bit. If you want to rebase, you might have an easier time working in the codebase :)

@hltdev8642
Copy link
Author

I reworked the test infrastructure a bit. If you want to rebase, you might have an easier time working in the codebase :)

Nice! I will give it a try again sometime soon :-]

I am not a regular python user (although of course every programmer knows at least some python ), thus it is taking me forever to just fix a simple regex replacement 🤣

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants