Skip to content

Improve linting #293

@pitag-ha

Description

@pitag-ha

Description of what we have

The linting process consists of the following two batches:

  • std-files: checks if the following files are present
    • README
    • LICENSE
    • CHANGES
    • opam
  • opam: does the following
    • runs opam lint: returns OK if and only if opam lint returns Passed (i.e. returns FAIL already if there's a warning)
    • checks if "opam field description is present"
    • checks if "opam fields homepage and dev-repo can be parsed by dune-release". It doesn't check if those are on github.
    • checks if Only returns OK, if it's on github

At the moment, you can run dune-release lint either with option std-files/opam or as a whole. Furthermore, when running dune-release distrib, all lints get run for the branch of the distrib tag. For other commands, the lints don't get run.

A couple of minor comments:

  • in "opam fields homepage and dev-repo can be parsed by dune-release": what we actually check for is "... homepage OR dev-repo ...". Furthermore, if I remember correctly, those URI's are needed to publish the distribution on github (without delegates). So probably that check should only pass if they/one of them are on github.
  • the check "opam field doc can be parsed by dune-release" doesn't contribute to the lint summary: if there are more failures, it doesn't sum to the number of failures; if there's no other failure, the lint returns success.

More importantly, as discussed with @NathanReb and @gpetiot:

Proposal for improvement

Instead of associating to a lint if it's a std-files-check or opam-check, it would be better to associate to the lint the commands it is relevant for. For example, the opam-file presence and the opam lint check would (probably) get all commands associated, while "opam field doc can be parsed by dune-release" would only get publish doc associated. That way, when running a dune-release command, dune-release could automatically run the relevant lints (and only those).

Furthermore, the command dune-release lint could have as optional arguments the various dune-release commands, e.g. distrib or publish, and dune-release lint X would only run the lints needed for dune-release X.

We'd have to think about in which way to deliver the result of the general dune-release lint (without optional argument). Two possible options:

  1. @gpetiot had the idea of a matrix representation:
[OK] aaa                  [distrib:OK][publish:OK][opam pkg:OK][opam submit:OK]
[WARN] bbb                [distrib:OK][publish:OK][opam pkg:KO][opam submit:KO]
[KO] ccc                  [distrib:KO][publish:KO][opam pkg:KO][opam submit:KO]

where xxx are different lint checks (I've written a first command on the issue about that).

  1. We could keep it quite simple:
[OK] aaa                 
[WARN] bbb (needed for command X and command Y)
[KO] ccc (needed for command X)

And of course, we could combine both things by having one as default and activate the other one through a --verbose or --silent flag, respectively.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions