如何在PyCharm单个文件中全局配置PyPep8Naming忽略规则并同步给团队?
Got it, I get exactly what you need here—you want to suppress the PyPep8Naming inspection for an auto-generated file without turning off the check entirely in your PyCharm instance, and you need this rule to stick with the file so your whole team can benefit from it too. Here's the straightforward solution:
Use a file-level
# noinspectioncomment
At the very top of your auto-generated Python file (right after the shebang line if you have one), add this single line:# noinspection PyPep8NamingThis tells PyCharm to skip the PyPep8Naming inspection for the entire file. Since this comment is embedded directly in the file, every team member who opens it in PyCharm will automatically have this inspection suppressed for that specific file—no local IDE configuration tweaks needed from anyone.
Why this beats IDE-level settings
Unlike modifying your local PyCharm inspection profiles (which are stored on your machine and don't sync with the file), this comment travels with the code itself. It's ideal for auto-generated files where you don't want to battle PEP8 naming rules, but still want to keep the inspection enabled for all your hand-written code.
Just make sure your auto-generation tool inserts this comment at the start of the file, and you're all set!
内容的提问来源于stack exchange,提问作者Gilad Naaman

