[0/1] Add linting checks to 'make check'

Message ID 20230519121354.704395-1-carlos@redhat.com
Headers
Series Add linting checks to 'make check' |

Message

Carlos O'Donell May 19, 2023, 12:13 p.m. UTC
  We have some existing linting checks in scripts/ around the specifics of
the installed headers, but nothing specifically about the sources for
glibc. Since this is the first time I see myself plumbing $(srcdir) down
into a test, and then using it in that test,  I think we should have a
discussion around this patch to see if we as developers consider it
acceptable to lint the Makefile format in 'make check' itself. The check
needs to run the python interpreter about 200 times, but it's fairly
fast and on a slow system takes ~3s. My gut feeling is that basic
linting checks could go into 'make check', but anything more complicated
would have to live in pre-commit CI. Deciding what is "basic" is going
to have to be evaluated on an ongoing basis and with input from what
developers consider too slow or onerous for 'make check'.

I want to make the case here for basic linting because it provides
immediate and positive feedback to new contributors of the project that
they have made a mistake in writing their Makefile. This is even better
than pre-commit CI linting; which you often want to run locally anyway.

I don't think we should stop here. I think we should take Noah's
.clang-format and hammer it into a lint for 'make check' that covers all
source files that we know we want formatted a particularly way and keep
expanding that. This would likely have to run in pre-commit CI, but we
would keep all the test infrastructure in scripts/ or the project tree
itself with a special make target.

On that note, we could add a special target for this e.g. make lint,
and run that in pre-commit CI. For now I'm suggesting we adopt a small
Makefile linting pass in 'make check', but the options to change this in
the future are open.

Carlos O'Donell (1):
  Add lint-makefiles Makefile linting test.

 Makefile                  |  6 +++++
 scripts/lint-makefiles.sh | 47 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 53 insertions(+)
 create mode 100644 scripts/lint-makefiles.sh
  

Comments

Joseph Myers May 19, 2023, 4:55 p.m. UTC | #1
On Fri, 19 May 2023, Carlos O'Donell via Libc-alpha wrote:

> acceptable to lint the Makefile format in 'make check' itself. The check
> needs to run the python interpreter about 200 times, but it's fairly
> fast and on a slow system takes ~3s. My gut feeling is that basic

If something is significantly slower, I'd suggest parallelizing at the 
makefile level (not relevant for a 3s test, but certainly helps for e.g. 
the conform/ tests which take quite a lot of time if run in serial but are 
extremely parallel).
  
Carlos O'Donell May 23, 2023, 12:54 p.m. UTC | #2
On 5/19/23 12:55, Joseph Myers wrote:
> On Fri, 19 May 2023, Carlos O'Donell via Libc-alpha wrote:
> 
>> acceptable to lint the Makefile format in 'make check' itself. The check
>> needs to run the python interpreter about 200 times, but it's fairly
>> fast and on a slow system takes ~3s. My gut feeling is that basic
> 
> If something is significantly slower, I'd suggest parallelizing at the 
> makefile level (not relevant for a 3s test, but certainly helps for e.g. 
> the conform/ tests which take quite a lot of time if run in serial but are 
> extremely parallel).
 
Agreed.

Source linting is in that category.