0

One of my methods has an attribute named ai (as in, artificial intelligence), which is tripping up pylint:

C0103: Attribute name "ai" doesn't conform to snake_case naming style (invalid-name)

I would like to avoid having to disable pylint if at all possible, but I'm not sure what the actual issue is here, though changing the name to a_i solves the issue, but I think that's just disgusting as a variable name.

Knaapje
  • 165
  • 1
  • 1
  • 10
  • 1
    You may also wish to change the regular expression `attr-rgx` in your `pylintrc` file so that `ai` is an accepted attribute name. Alternatively you can call pylint with the `--attr-rgx` option. – qouify Oct 03 '21 at 16:14
  • @python_user I'm aware of the functionality of ignoring errors in specific blocks, but I would like to avoid disabling the linter if possible to not clutter the code with cruft. – Knaapje Oct 03 '21 at 16:14
  • @qouify That looks promising, I'd prefer to change settings of `pylint` itself, though the `--attr-rgx` option seems a bit daunting to use. I'll have a look at it though. – Knaapje Oct 03 '21 at 16:18
  • Your suggestion prompted me to dive into `pylint`s configurable properties, I've opted to set `good-names=ai` in a `.pylintrc` file in my project. – Knaapje Oct 03 '21 at 18:20
  • Sounds like a good choice, better than using modifying `attr-rgx` if you have very few such cases. – qouify Oct 04 '21 at 11:53

1 Answers1

2

Solved by adding a .pylintrc file in the root of my project, containing:

[HEADER]

good-names=ai
Knaapje
  • 165
  • 1
  • 1
  • 10