pkgcore / pkgcheck

pkgcore-based QA utility for ebuild repos
https://pkgcore.github.io/pkgcheck
BSD 3-Clause "New" or "Revised" License
34 stars 29 forks source link

[New Check]: Detect misplacement of `distutils_enable_sphinx` and `distutils_enable_tests` #660

Open mgorny opened 5 months ago

mgorny commented 5 months ago

Is there an existing such new check request for this?

Explain

We should detect that the distutils_enable_sphinx and distutils_enable_tests are called in the correct location, that is:

  1. That BDEPEND, IUSE, RESTRICT aren't overrode after the call (but it's fine to += them).
  2. That they are called prior to declaring phase functions (possibly any functions?).

Examples

gentoo/gentoo@94f4934e4e1aa7acac42c5d20a52059238188b5c is a typical case of fixing the wrong order.

gentoo/gentoo@9bc48944ad202091517bb578b8f03447087bd302 has distutils_enable_tests after phase function, along with EPYTEST_DESELECT that's so huge that I didn't even notice src_prepare() there at all.

Output message

should be called after declaring // should be called prior to declaring ebuild functions ### Documentation `distutils_enable_sphinx` and `distutils_enable_tests` variables modify ebuild metadata and declare sub-phase functions. They should be called after assigning metadata variables (such as `BDEPEND`) to prevent their results from being overwritten; it is valid to append to these variables after the call, though. They should be called before defining ebuild functions (such as `python_test`), as otherwise they could overwrite them. ### Result level warning