rapid-bird-79300
02/18/2022, 4:58 PMskip_pylint
default to False
for a project needing incremental adoption? I'd like to avoid having to create custom plugin overriding the skip default. I thought maybe macros can help but it seems a bit complicated for what we're trying to achieve.hundreds-father-404
02/18/2022, 5:01 PM[tailor.defaults]
python_source = { skip_pylint = True }
python_sources = { skip_pylint = True }
rapid-bird-79300
02/18/2022, 5:29 PM2.7.0
(hoping to upgrade soon) what would the best way to move forward. In the past, we have just made our custom plugins and override the skip flag but curious if there's something else we can do.
For example, I suspect it would be a mapping of target type to field to values?I like that syntax a lot! One common thing that comes up in a large monolith project is some addresses would like to opt-in by default and other addresses would like to remain opt-out. For example:
proj
mod_x -> We want opt in!
mod_y -> We want opt out!
how would we define that behavior in pants without having to do the manual work of setting skip_pylint = False
in the module that wants opt-in?hundreds-father-404
02/18/2022, 8:38 PMwhat would the best way to move forward.The most helpful to the Pants community would be if you're able to contribute #12913, then we could probably cherry-pick into 2.10 as a low-risk new feature. Otherwise, I think probably implementing a custom
tailor
implementation would be the fastest way to do this. On 2.7, you would basically copy and paste this code: https://github.com/pantsbuild/pants/blob/83d147d511369f85b8fa6e9345e10cd36a2729a4/src/python/pants/backend/python/goals/tailor.py#L79-L98, but change kwargs
to include skip_pylint=True
. Although it looks like we don't have an option to turn off the built-in tailor
implementation....so hm. Maybe not.
Would this be one-time or recurring?
I like that syntax a lot! One common thing that comes up in a large monolith project is some addresses would like to opt-in by default and other addresses would like to remain opt-out.One limitation to be aware of is that this limitation doesn't let you set per-directory defaults. It's only per-repo defaults, based on each target. It sounds like you might want more complex?
rapid-bird-79300
02/18/2022, 10:46 PMtailor
).
So we moved forward with a custom plugin for pylint
and that works well.
Would this be one-time or recurring?
This is 4th time we're overriding default logic so we can adjust the skip field default. We also have custom
black
, isort
, flake8
plugins for the same work around.
It's only per-repo defaults, based on each target. It sounds like you might want more complex?
Yeah more ways to toggle how tailor operates could be helpful for incremental adoption. Maybe some type of regex pattern for addresses or it could also support syntax like:
[tailor.SrcRoot1]
python_source = { skip_pylint = True }
python_sources = { skip_pylint = True }
[tailor.SrcRoot2]
python_source = { skip_pylint = False }
python_sources = { skip_pylint = False }
but perhaps the complexity we're looking for we can achieve with a custom plugin we can maintain ourselves.hundreds-father-404
02/18/2022, 10:51 PMskip_x
tools.
Otherwise, you have to explicitly set the value. And what we're talking about thus far is either using tailor
or a macro to facilitate setting that value
The final angle we could take is https://github.com/pantsbuild/pants/issues/13767, to make it less painful to explicitly set metadata for multiple directories