emacs-eldev / eldev

Elisp development tool
https://emacs-eldev.github.io/eldev/
GNU General Public License v3.0
226 stars 17 forks source link

Teach package-lint that there is a multi-file package when linting #54

Closed publicimageltd closed 2 years ago

publicimageltd commented 2 years ago

If I run eldev lint on a multi-file package, the linter complains about missing dependency declarations for each file even though I have a metadata file (foo-pkg.el). Looking at the repo of package-lint, it seems that is an often discussed issue. While package-lint works well with single files, there seems to be no easy way to handle multi-file packages. I don't quite understand the problems, but fact is that multi file support is not yet there. However, some build systems like keg seem to have configured it correctly. Here's the link to the discussion: https://github.com/purcell/package-lint/pull/218#issuecomment-910347206

Since I have no understanding of the underlying issues, I don't know what I am exactly demanding. But would it be possible to somehow teach Eldev that it should lint the non-core files in a multi-file package with some dependencies etc. already set (e.g., taken from the core file or from the metadata file)? Close that issue if that's not possible or too outlandish in your opinion.

doublep commented 2 years ago

Eldev currently doesn't work nicely with multi-package projects in general. E.g. eldev dist always builds a single package, even if the project consists of several. Should be eventually improved...

Can you provide the URL of your project or of some other with similar structure?

publicimageltd commented 2 years ago

I was thinking of that project of mine: https://github.com/publicimageltd/delve The currently publicly available version, however, has no packagename-pkg.el file yet (major rewrite is in development and not pushed yet). But it does have package file w/o package attributes (no require, no version, etc.)

Here's another multi-file package: https://github.com/cpitclaudel/biblio.el It uses a package metadata declaration file.

I am actually using Eldev mostly for testing, and that works fine (besides package-lint, of course). BTW I can't find a command eldev dist (latest version, just did a eldev upgrade-self).

doublep commented 2 years ago

Ah, apparently I misunderstood. You mean a project with multiple .el files, not multiple resulting packages, right? In that case I really should look into it, because this is supposed to be well-supported already. Especially if another build tool manages to configure package-lint properly.

BTW I can't find a command eldev dist

Sorry, I meant eldev package. But it is not important, as I misunderstood the original request.

publicimageltd commented 2 years ago

Okay, thanks! My actual case is multiple files with one package declaration ("foo-pkg.el"); and expected behavior is that all attributes defined in that metadata will be inherited when package-lint checks the other files.

juergenhoetzel commented 2 years ago

I had the same issue in my multi-file package emacs-totp You can set package-lint-main-file in your local Eldev file:


(setq package-lint-main-file "totp.el")
` 
publicimageltd commented 2 years ago

@juergenhoetzel Yes, that's it! Thanks, now it works fine!

Maybe this should be documented somewhere.

doublep commented 2 years ago

Maybe this should be documented somewhere.

No, it is duty of Eldev to do it. You can use it as a workaround for now, but from 0.10 Eldev will do this natively. I actually prepared a change yesterday (also discovered package-lint-main-file), just not committed it yet.

doublep commented 2 years ago

Will close upon release.

doublep commented 2 years ago

Released in 0.10.