How to Replace .pylintrc with Home-Manager
How to Replace .pylintrc
with Home-Manager
Managing Pylint configurations across systems can be cumbersome, especially when relying on a .pylintrc
file. With Home-Manager, you can skip the .pylintrc
altogether and configure Pylint declaratively. Here’s how.
Replacing .pylintrc
Using Home-Manager
In your Home-Manager configuration, use the programs.pylint
section to set up Pylint. For example:
programs.pylint = {
enable = true;
settings."MESSAGES CONTROL".disable = "all";
settings."MESSAGES CONTROL".enable = "E,unused-import";
};
What This Does:
- Enable Pylint: The
enable = true;
line activates Pylint in your environment. - Disable All Warnings and Errors:
settings."MESSAGES CONTROL".disable = "all";
turns off all default messages. - Enable Specific Checks: The
settings."MESSAGES CONTROL".enable = "E,unused-import";
line selectively re-enables critical errors (E
) and warnings for unused imports.
Why Use Home-Manager Instead of .pylintrc
?
- Declarative Setup: Configure Pylint directly in your Nix-based Home-Manager configuration.
- Cross-System Consistency: Easily synchronize settings across machines by syncing your Home-Manager configuration.
- Simplified Management: No need to manually create or edit
.pylintrc
files.