Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filename checks? #132

Open
adamchainz opened this issue Jan 13, 2020 · 8 comments
Open

Filename checks? #132

adamchainz opened this issue Jan 13, 2020 · 8 comments

Comments

@adamchainz
Copy link

PEP 8 states:

Modules should have short, all-lowercase names.

pycodestyle could check the passed filenames are lowercase to help enforce this.

@adamchainz
Copy link
Author

(Apologies if this isn't new, I couldn't find any existing issue but there are quite a few terms to search/filter so might have missed one)

@sigmavirus24
Copy link
Member

Except that sometimes things are passed on standard in and many modules use _ these days which sounds like it's against the PEP. So I'd say the de facto standard is quite different from the written standard.

@asottile
Copy link
Member

this may be something better accomplished through pep8-naming?

@adamchainz
Copy link
Author

@sigmavirus24 _ is not against the PEP, sorry the full text is:

Modules should have short, all-lowercase names. Underscores can be used in the module name if it improves readability. Python packages should also have short, all-lowercase names, although the use of underscores is discouraged.

pycodestyle could only check for uppercase characters. These cause problems porting code from a case insensitive to case sensitive filesystem, and the main reason I opened this issue.

I appreciate the name can't be checked from stdin.

@asottile Yes it could be in that project instead.

@sigmavirus24 sigmavirus24 transferred this issue from PyCQA/pycodestyle Jan 14, 2020
@sigmavirus24
Copy link
Member

sigmavirus24 commented Jan 14, 2020

I transferred this over to pep8-naming since we were all in agreement about where it belonged.

@sobolevn
Copy link
Member

sobolevn commented Mar 8, 2020

JFYI: a lot of module-level checks are covered in wemake-python-styleguide that uses pep8-naming as a dependency.

@fpuga
Copy link

fpuga commented Aug 15, 2020

There are also two flake8 plugins that are related to this feature, but it will be nice to have it in pep8-naming:

  • flake8-module-name. A flake8 plugin for testing PEP-8 conform package and module names.
  • flake8-filename. A flake8 linter plug-in for validating that certain files comply with a user defined pattern.

@sigmavirus24
Copy link
Member

flake8-filename says

This project is currently not actively maintained

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants