Yeah ... I wrote a small script which runs pylint and captures the output, then looks at the errors and applies a few simple heuristics to get a list of the changes I want, then does a replace() on that list.
It's a bit crude but gives me most of what I want. I am reminded why I prefer camelCase though, too many extra keystrokes and hand movements, for little to no extra readability IMO. Oh well... Thanks, J^n On Thursday, September 15, 2022 at 8:02:50 AM UTC+1 jkn wrote: > Hi Thomas > that was pretty much the approach I was thinking of adopting myself, > thanks. I was just a bit surprised that something like that didn't already > exist. > > Anyway, in the absence of anything else I'll see what that gives me. > > Cheers, J^n > > > On Wednesday, September 14, 2022 at 11:16:25 PM UTC+1 [email protected] > wrote: > >> pylint by default will issue message C0103 for functions and methods that >> should be snake_case but aren't (Leo's configuration doesn't seem to pick >> that up). Since the pylint message will include line and position of the >> name, it shouldn't be hard to write a program to convert these instances. >> If you did a string.replace() for each of them, the names would get fixed >> in docstrings and comments too. >> >> Pylint by default issues the same warning for short variable names >> without an underscore like "x", too. I don't know if that can be turned >> off or not, but I imagine it could be checked for easily. >> >> On Wednesday, September 14, 2022 at 4:11:17 PM UTC-4 jkn wrote: >> >>> Hi all >>> slightly OT but I think this is a good place to ask: >>> >>> I tend to write my personal python using camelCase for variables and >>> method names; >>> I prefer this to the PEP8 standard for various reasons. >>> >>> I now have a need to convert some such scripts to snake_case, to meet >>> a linting requirement. I thought that there would be plenty of tools to >>> do this, >>> but rather to my surprise the various checkers and formatters I have >>> found >>> (in a fairly cursory search, admittedly) don't cater for this. They all >>> do plenty >>> of other things, and I will definitely be using them in the future, but >>> I could >>> do with this as a staring point. >>> >>> Any pointers to a tool which can do this job, probably with some >>> flexible configuration? >>> >>> Thanks & Regards >>> J^n >>> >>> -- You received this message because you are subscribed to the Google Groups "leo-editor" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/leo-editor/4da6017c-a676-46c6-b935-4b95aae50388n%40googlegroups.com.
