feat!(checkpatch): implement stdin handling#917
Conversation
This change updates the checkpatch linter to support evaluating unsaved buffers so that it can run and provide updated results as soon as user exits insert mode. Unfortunately kernel maintainer is against fixing checkpatch.pl's full file mode to properly handle stdin [1] so we have to work around this generating a diff against /dev/null and passing it to checkpatch instead. The linter dynamically detects if the checkpatch script supports the '--ignore' flag and applies common ignores if available (some of them are too expensive for an online linter and are not changing often: "obsolete" and "SPDX check", while others do not make sense for our use case). Unfortunately because now command is a "diff ... | checkpatch ..." it is hard to override it. The suggestion therefore is to make sure custom checkpatch (if needed) is first in $PATH. Because linter code now returns function and not a table this change marked as breaking. [1] https://lore.kernel.org/r/acTPXMJfkHLeItrK@google.com/
|
Hi, While I can replace vim.fs.joinpath() with a custom implementation maybe it would make sense to bump up minium configuration to 0.10.0 if not 0.11.0? Also, what do you think about allowing extending lint.Linter class with linter-specific options? For example I would like to be able to adjust ignored checks list, depending on where in the kernel tree I am and with stdin handling it is not easy to reach "into" args building code. It would be straightforward to have them as an additional field. Thanks! |
What a bummer. The changes here seem a bit too complex for my taste. I'd instead be inclined to add a That way the logic could be used for any |
This change updates the checkpatch linter to support evaluating unsaved buffers so that it can run and provide updated results as soon as user exits insert mode.
Unfortunately kernel maintainer is against fixing checkpatch.pl's full file mode to properly handle stdin [1] so we have to work around this generating a diff against /dev/null and passing it to checkpatch instead.
The linter dynamically detects if the checkpatch script supports the '--ignore' flag and applies common ignores if available (some of them are too expensive for an online linter and are not changing often: "obsolete" and "SPDX check", while others do not make sense for our use case).
Unfortunately because now command is a "diff ... | checkpatch ..." it is hard to override it. The suggestion therefore is to make sure custom checkpatch (if needed) is first in $PATH.
Because linter code now returns function and not a table this change marked as breaking.
[1] https://lore.kernel.org/r/acTPXMJfkHLeItrK@google.com/