Wemake-python-styleguide: Restrict names with underscored numbers

Created on 4 Oct 2018  路  4Comments  路  Source: wemake-services/wemake-python-styleguide

Rule request

Thesis

There are two possible ways how one can write "Star Wars Episode 2" in snake case: star_wars_episode2 and star_wars_episode_2.

The same goes for numbers in the middle of the name: come2_me vs come_2_me.

We need to enforce the first version and restrict the former.

Reasoning

This is done for consistency in naming.

Hacktoberfest help wanted starter rule request

All 4 comments

This should be allowed: ISO-123-456 should become: iso_123_456.
So, having this pattern is allowed: r'\d_\d'.

@sobolevn, Two questions:

  1. This restriction has to be implemented for both variable names and file names, right?
  2. star_wars_episode_2_2 is this allowed ?

@riyasyash

Yes for both of your questions 馃檪
We can even use the same violation for variables and modules.

Are you willing to take this over?

@sobolevn Yes I am. :)
What about come_2me. is this allowed ?

Was this page helpful?
0 / 5 - 0 ratings