When the Python Analyzer reports [C0103 invalid-name], the pattern in the feedback (‘([^\W\da-z][^\Wa-z]|__.__)$’) is basically incomprehensible.
Using backticks would help: ([^\\W\\da-z][^\\Wa-z]*|__.*__)$, but it still mostly just makes the message more confusing. Could it be removed? I don’t see much value in it being there, but maybe I’m just not familiar enough with regexes to understand it?
Also, for any enum-based approach for the Resistor Color exercises, the Analyzer generates an excessive amount of feedback (all C0103 reports):
Analyzer Feedback
Recommended
Line 8 [C0103 invalid-name] was reported by Pylint:
Class constant name “black” doesn’t conform to UPPER_CASE naming style (‘([^\W\da-z][^\Wa-z]|__.__)$’ pattern).
This code doesn’t follow general Python code style conventions. While this type of issue generally doesn’t affect the way code executes, it can hurt readability or the performance of automated tools such as documentation generators or test runners.
Instead of:
class cat: # [invalid-name]
def Meow(self, NUMBER_OF_MEOW): # [invalid-name, invalid-name]
print("Meow" * NUMBER_OF_MEOW)
return NUMBER_OF_MEOW
Cat = cat().Meow(42) # [invalid-name]
Try:
class Cat:
def meow(self, number_of_meow):
print("Meow" * number_of_meow)
return number_of_meow
CAT = Cat().meow(42)
By default, Pylint will enforce PEP8-suggested names.
The following naming suggestions are used for Exercism exercises:
- modules (code files): snake_case
- constants: UPPER_CASE
- variables: snake_case (minimum of 3 letters)
- functions: snake_case
- arguments: snake_case
- attributes: snake_case
- classes: PascalCase
- class attributes: any (no specific format)
- class constants: UPPER_CASE
- class methods: snake_case
- inline variables and loop variables: snake_case
This is only the first one, there is nine more of basically the same exact message. I can’t even post it all here because it exceeds the 10000 character limit.