locheck icon indicating copy to clipboard operation
locheck copied to clipboard

Locheck hangs on some // comments

Open alex-hunsley-nl opened this issue 3 years ago • 2 comments

Locheck was hanging for me. I found out the problem was a line like this:

////////////////////////

I also found out that a line with a comment and no characters after the slashes has the same effect:

//

alex-hunsley-nl avatar Sep 12 '22 18:09 alex-hunsley-nl

I wrote a unit test for this but wasn't able to reproduce the issue. I also tried adding the lines to the demo .strings files and didn't see a hang. Can you provide a minimal example .strings file that has the problem?

The way this works under the hood is a simple regex match on each line. All I can think of is that the regex is taking a really long time, but I would think I'd be able to easily reproduce that.

stevelandeyasana avatar Sep 12 '22 19:09 stevelandeyasana

Hi Steve, thanks. Yes I think it's the regular expression matching then.

If one of my Localizable.strings files contains just this (with newline at the end) we start to get slow performance:

//////////////////////////////////////

If you add a few more /, it's slow enough to seem like it's hanged.

alex-hunsley-nl avatar Sep 13 '22 07:09 alex-hunsley-nl