Config values from `tool.flakeheaven.base` are not being overridden when configuring specific plugins
See original GitHub issueIssue
The changes introduced in #115 break overriding of config values when using the tool.flakeheaven.base
option.
For example, if a project’s pyproject.toml
previously disabled pylint from a base config like so:
[tool.flakeheaven]
base = "https://raw.githubusercontent.com/flakeheaven/flakeheaven/master/pyproject.toml"
...
[tool.flakeheaven.plugins]
...
pylint = ["-*"]
in 2.0.0 that override is ignored and the value from the base pyproject.toml is used, as below:
Fix
Instead of manually deep updating specific parts of the config dict, it might be better to add a deep update function and use that to build the dict. This resolves the issue and has the added benefit of not needing to be updated if more entries which require deep updating are added in the future.
def _deep_update(old_dict, new_dict) -> Dict[str, Any]:
for key, value in new_dict.items():
if isinstance(value, collections.abc.Mapping):
old_dict[key] = _deep_update(old_dict.get(key, {}), value)
else:
old_dict[key] = value
return old_dict
def _merge_configs(*configs) -> Dict[str, Any]:
config: Dict[str, Any] = defaultdict(dict)
for subconfig in configs:
_deep_update(config, subconfig)
return dict(config)
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:6
Top Results From Across the Web
flakeheaven plugins --config=myconfig.toml isn't honoured #65
When i run flakeheaven plugins --config=myconfig.toml and expect to see my settings picked up instead I see all my plugins as red with...
Read more >Configuring flake8 plugin when using flakeheaven
After changing the configuration file, clear the cache and then run flakeheaven again. Clearing the cache can be forced by setting the env ......
Read more >Config — FlakeHell 0.8.0 documentation
Here you can configure everything for FlakeHell. Use it. CLI options. Plugins¶. In pyproject.toml you can specify [tool.
Read more >flakeheaven - PyPI
flakeheaven is a python linter built around flake8 to enable inheritable and complex toml configuration. This project is a fork of FlakeHell. FlakeHell...
Read more >Configuring Flake8 — flake8 6.0.0 documentation
cfg , tox.ini , or .flake8 . Values set at the command line have highest priority, then those in the project configuration file ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@pwoolvett I’ve corrected the issue, this is specifically when using
tool.flakeheaven.base
You can reproduce this by slightly modifying the script you provided:
which produces this output: (EDITED for output when run outside of project context)
I think I"m able to replicate this - pylint runs always regardless of config on 2 but respects configuration on 1.0.2