pylint-bot / pylint-unofficial

UNOFFICIAL playground for pylint github migration
0 stars 0 forks source link

C0103 invalid variable name xxx : false positives and no explanation #662

Closed pylint-bot closed 8 years ago

pylint-bot commented 9 years ago

Originally reported by: Sorin Sbarnea (BitBucket: sorin, GitHub: @sorin?)


Do you think that this line is supposed to not to be correct?

    with open(local_filename, 'wb') as fh:
       pass

This is complaining about fh, also tried f, ... what else should we try to get this passed?


pylint-bot commented 9 years ago

Original comment by Claudiu Popa (BitBucket: PCManticore, GitHub: @PCManticore):


Use a better name, stream or something else. fh is not intuitive.

pylint-bot commented 9 years ago

Original comment by Sylvain Thénault (BitBucket: sthenault, GitHub: @sthenault?):


By default, pylint will flag about variable name shorter than 3 chars

pylint-bot commented 9 years ago

Original comment by Sorin Sbarnea (BitBucket: sorin, GitHub: @sorin?):


Since when using variable names like i, j, x, y, z for numbers become a problem?

Sorry but to ask for a min length of 3 for something that has a life-span of 2-3 lines of code seems like not a good idea to me.

For the moment I disabled the entire rule in .pylintrc with disable=C0103, which may not be the best thing as some names may really be problematic as they would overlap with modules or buildins.

Is there a way to disable only the length check?

pylint-bot commented 9 years ago

Original comment by Florian Bruhin (BitBucket: The-Compiler, GitHub: @The-Compiler?):


You can do something like variable-rgx=[a-z_][a-z0-9_]{0,30}$ under [BASIC] in your .pylintrc.

I think shadowing things won't raise bad-name but something else.

pylint-bot commented 9 years ago

Original comment by Sylvain Thénault (BitBucket: sthenault, GitHub: @sthenault?):


Indeed shadowing is another message.

Also :