Bug 233368

Summary: ports-mgmt/portlint: Provide users with some explanation for warnings/errors
Product: Ports & Packages Reporter: Tobias Kortkamp <tobik>
Component: Individual Port(s)Assignee: Joe Marcus Clarke <marcus>
Status: In Progress ---    
Severity: Affects Only Me CC: marcus
Priority: --- Keywords: dogfood, feature
Version: LatestFlags: tobik: maintainer-feedback? (marcus)
Hardware: Any   
OS: Any   

Description Tobias Kortkamp freebsd_committer 2018-11-21 09:36:47 UTC
There are many commits where people are trying to appease portlint
without actually trying to understand what the problem was or why
it raises them.  Mostly things are shuffled around until portlint
no longer complains (or so it appears) and it causes lots of churn
in the repository with little improvement in ports.  Can portlint be more
descriptive/verbose?

For example, when portlint says

WARN: Makefile: "USES" has to appear earlier.

it should point people to
https://www.freebsd.org/doc/en/books/porters-handbook/porting-order.html

Maybe there could be error codes and a --explain flag like what
rustc has to give a more verbose description of the problem.
Comment 1 Tobias Kortkamp freebsd_committer 2018-11-21 09:43:12 UTC
> Maybe there could be error codes and a --explain flag like what
> rustc has to give a more verbose description of the problem.

E.g. `rustc --explain E0001` will print the text from
https://doc.rust-lang.org/error-index.html#E0001
to stdout etc.
Comment 2 Kubilay Kocak freebsd_committer freebsd_triage 2018-11-21 09:47:23 UTC
+1 on per rule error codes. Have thought about this many times when thinking about ways to improve portlint (like a proper lexer/parser for bmake/Makefiles implementation)

I think a decent place for this would be the wiki, where we could then refer onto the handbook for specific cases or further information, if necessary.
Comment 3 Kubilay Kocak freebsd_committer freebsd_triage 2018-11-21 09:49:19 UTC
Alternatively a data file that comes with portlint, to keep the explanations/prose away from the rule detection code, and make updating that content easier for contributors
Comment 4 Joe Marcus Clarke freebsd_committer 2019-04-05 12:20:38 UTC
Pointing back to the Porter's Handbook makes a lot of sense.  Having another level of mapping may get cumbersome (but I understand the ask/outcome).  In the meantime, if there are obvious outstanding instances of this (like USES) can you please submit patches, and I'll fold them in.  Go ahead and use this PR.