akirak / elinter

Nix-based CI and local testing framework for Emacs Lisp projects
GNU General Public License v3.0
18 stars 2 forks source link

Alpha testing against existing projects #28

Open akirak opened 4 years ago

akirak commented 4 years ago

Now that elinter provides a GitHub action, I will start experimenting with it against existing projects developed by others. This will let me learn how people structure their projects and identify missing features and/or design flaws.

I consider this process a kind of acceptance testing, but it is going to be held by me, so it is alpha testing. It's still alpha, and there can be API changes. To actually replace existing Makefile/Cask-based solutions, it has to be reliable. After reaching beta, I may send PRs to authors of projects that can successfully adopt elinter, but I won't do that for now.

I will use Emacs Lisp projects created by others as input, preferably well-known ones. I will start with simple targets and gradually increase complexity. Variety also matters, because there seems to be no single agreed-upon way to organize Emacs Lisp projects right now.

Procedure

  1. Fork a repository containing source code of Emacs Lisp packages.
  2. Create elinter branch in the repository and install recipe files using elinter.el.
  3. Check if linting and testing (if any) runs locally.
  4. Create a GitHub workflow to run CI (example.
  5. Push to GitHub and trigger the action.
  6. If there is an existing Makefile for CI, it would be better to rewrite it using elinter to see if it can reduce configuration code.
  7. Report the result to this repository. Include a link to the action page.

Feedback

akirak commented 4 years ago

Example: lsp-dart

Feedback:

Because the experimental checks of melpazoid can produce a false positive, it is necessary to allow failures of those checks. There could be a couple of options:

Tests are not run if the preceeding linting step fails. It's probably better to run tests unconditionally in the action. Thus the action needs an option to specify a type of test to run.

akirak commented 4 years ago

Maybe an issue template is desired for this process, but I'm afraid it can produce too many tickets.

akirak commented 4 years ago

Also note annotations doesn't work as expected. They should point to individual error locations.

akirak commented 4 years ago

I've changed the action to allow failures from melpazoid. Now lsp-dart passes all checks: https://github.com/akirak/lsp-dart/runs/999222903?check_suite_focus=true

Running tests is still a separate step from the main action. I think it's okay.

akirak commented 4 years ago

reformatter.el

Feedback:

Received the following warnings generated by melpazoid (fixed):

  - reformatter.el#L105: It’s safer to sharp-quote function names; use ‘#’‘
  - reformatter.el#L259: It’s safer to sharp-quote function names; use ‘#’‘
  - reformatter.el#L260: It’s safer to sharp-quote function names; use ‘#’‘
  - reformatter.el#L287: It’s safer to sharp-quote function names; use ‘#’‘
  - reformatter.el#L9: Prefer ‘;; Version‘ over ‘;; Package-Version‘ (MELPA automatically adds ‘Package-Version‘)

Encountered the following errors in Emacs 24.5. I had to rewrite some parts of my elisp code. I also disabled checkdoc, since checkdoc-file function is unavailable:

Also failed to build melpazoid.el in Emacs 24.3, but it was not due to melpazoid itself, but because the build function in Nixpkgs uses functions that are not available in this version of Emacs. I am not sure if I need to work around this. It would be better to avoid linting using older versions of Emacs.

akirak commented 4 years ago

dhall-mode

This package didn't have CI. Linting produced some errors. After fixing those errors, the new CI passes.

akirak commented 4 years ago

Now you can specify a list of Nix packages available in the testing environment using --from-nixpkgs option, e.g.

elinter -t --ert --from-nixpkgs shfmt -- reformatter-tests.el

Also Emacs 24.3 is skipped (see the comment in #29), and reformatter.el now passes the CI.

akirak commented 4 years ago

I've added a GitHub workflow to display all examples in a single job (#32).

akirak commented 4 years ago

I've created a separate repository for demonstration: https://github.com/akirak/elinter-demo

From now on, I'll add examples to the workflow in the repository.