priv-kweihmann / oelint-adv

Advanced oelint
BSD 2-Clause "Simplified" License
53 stars 27 forks source link

Support Request for using and overriding multiple rule files for downstream project #579

Closed muhammedryavuz closed 1 month ago

muhammedryavuz commented 1 month ago

Description I am working on a project that involves two sets of rules: one for the upstream project and another for the downstream project. The downstream project uses the upstream project as a default but requires modifications to some rules.

Request I would like to ask if it is possible for Oelint to accept multiple rule files when running the tool, with the downstream rules taking precedence and overwriting the upstream rules where necessary. e.g. In upstream project this is default as warning "oelint.var.order.SRCREV": "warning", this will stay as default on upstream but downstream project will have it as an error such as: "oelint.var.order.SRCREV": "error",

Questions Does the latest version of oelint support a feature that allows specific rules to be overwritten by downstream rule files? If this feature is not currently supported, would it be possible to contribute towards implementing this functionality?

Thank you for considering this request. Your guidance on how to proceed would be greatly appreciated.

priv-kweihmann commented 1 month ago

Currently that's not supported, but you could of course wrap everything up with a custom python script

I think that's a good way forward here, as your request is very custom in my opinion.

Merging things, in terms of rule files, in an automated fashion creates much more complexity then I'm eager to support. I mean how would you merge the results? In order of the files passed? What about if users start to use *.rule-file from bash, then the order would become potentially nondeterministic... - that said, I think a custom python wrapper should be your immediate way forward to solve this issue.

Btw what I do not understand is, why having two files is needed anyway. Why not have one file per repository (upstream ad downstream) and exclude that one from syncing between the repositories?

priv-kweihmann commented 1 month ago

lib-mode example: https://github.com/priv-kweihmann/oelint-adv/blob/master/tests/test_libmode.py

muhammedryavuz commented 1 month ago

The reason behind that my upstream has a JSON file that contains multiple lines of rules (which I don't want to copy to downstream). Also, we have a parent project that is going to be forked by several child projects, which holds the default configuration files and we only want to disable and enable some specific rules on the child projects. Also, we don't want to edit files that come from the parent to avoid conflicts in future pulls.

The current way is that we duplicate the configuration files and just tweak them in this way.

We appreciate feedback, We are considering as you mentioned to continue customizing specific scripts to do that.