errata-ai / vale

:pencil: A markup-aware linter for prose built with speed and extensibility in mind.
https://vale.sh
MIT License
4.3k stars 144 forks source link

Vale seems to switch mid file to consider code as markdown #838

Open kellertuer opened 1 month ago

kellertuer commented 1 month ago

Check for existing issues

Environment

Mac OS vale 3.4.2

Describe the bug / provide steps to reproduce it

I gave vale a new try on my Julia files, and it seems the last few versions resolved a few of myself issues. I now have one problem left, which I think is a bug.

I am running the config file from

https://github.com/JuliaManifolds/Manopt.jl/blob/7803ce3c69454c4d9f98ba2d6056f37d4f0bfe46/.vale.ini

on the file (linking to the line the first error occurs, since its a bit longer)

https://github.com/JuliaManifolds/Manopt.jl/blob/7803ce3c69454c4d9f98ba2d6056f37d4f0bfe46/src/plans/debug.jl#L1109

and get the errors


 src/plans/debug.jl
 1110:5   error    Did you really mean             Vale.Spelling   
                   'iter_entries'?                                 
 1118:9   error    Did you really mean 'iter'?     Vale.Spelling   
 1119:15  warning  In general, don't use an        Google.Ellipses 
                   ellipsis.                                       
 1119:46  warning  In general, don't use an        Google.Ellipses 
                   ellipsis.                                       
 1119:51  error    Did you really mean             Vale.Spelling   
                   'iter_entries'?                                 
 1119:63  warning  In general, don't use an        Google.Ellipses 
                   ellipsis.                                       
 1121:17  error    Did you really mean             Vale.Spelling   
                   'iter_entries'?                                 
 1121:46  warning  In general, don't use an        Google.Ellipses 
                   ellipsis.                                       
 1128:19  warning  In general, don't use an        Google.Ellipses 
                   ellipsis.                                       
 1128:45  warning  In general, don't use an        Google.Ellipses 
                   ellipsis.                                       
 1129:33  warning  Try to avoid using              Google.We       
                   first-person plural like 'we'.                  
 1130:19  warning  In general, don't use an        Google.Ellipses 
                   ellipsis.                                       
 1140:9   error    Did you really mean 'dbg'?      Vale.Spelling   
 1141:32  error    Did you really mean 'dbg'?      Vale.Spelling   
 1141:54  error    Did you really mean 'dbg'?      Vale.Spelling   
 1143:57  error    Did you really mean 'dbg'?      Vale.Spelling   
 1170:75  error    Did you really mean 'Ints'?     Vale.Spelling   
 1188:28  warning  In general, don't use an        Google.Ellipses 
                   ellipsis.                                       
 1188:64  warning  In general, don't use an        Google.Ellipses 
                   ellipsis.                                       

To me it seems that somehow after the doc string until 1109, vale for some reason decides to continue interpreting the code as Markdown, hence these errors. How could we best narrow down how that happens?

kellertuer commented 1 month ago

I tried a bit and removing the doc string removes the problem (not that I want to remove) and even having an empty doc string without the annotation, i.e. replacing lines 1066-1108 by

"""
"""

already causes the error. So somehow vale “get's confused” here, I am just not yet sure why.

Setting <!-- vale Google.Ellipses = NO --> as proposed in the docs does not have an effect either (renamed variables for the rest, though not. a fan of that)