Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lint checking for common mistakes? #245

Open
jb55 opened this issue Oct 8, 2018 · 3 comments
Open

Lint checking for common mistakes? #245

jb55 opened this issue Oct 8, 2018 · 3 comments

Comments

@jb55
Copy link

jb55 commented Oct 8, 2018

Off the top of my head:

Any other common ones?

Maybe not mistakes specifically, but common conventions.

@jtojnar
Copy link
Contributor

jtojnar commented Sep 11, 2019

It would be useful to have a linter as a standalone tool. Perhaps it could be integrated to @Synthetica9’s nix-linter.


Here are some other occasions I repeatedly comment on:

  • When known build tool/setup hook is in buildInputs instead of nativeBuildInputs
    • cmake, ninja, meson, autoconf, automake, libtool, intltool, gettext, appstream-glib, gobject-introspection, wrapGAppsHook, wrapQtAppsHook…
  • When a patch is added to patches but no comment describing it is nearby.
  • When using improbable package variant (e.g. gtk3-x11 – here we could check if the source actually depends on this rather than gtk3)
  • When patch file is added to nixpkgs (suggest fetchpatch)
  • When fetching from git with rev=${commithash} but ${version}unstable-yyyy-mm-dd
  • When fetching from git with rev=refs/tags/${version} (replace with rev=${version})
  • When name="foo-${version}" is used. Suggest pname
  • When unquoted URLs are used ([RFC 0045] Deprecating unquoted URL syntax rfcs#45, not nixpkgs specific)
  • When hardcoded phases like buildPhase or installPhase invoking make are used (suggest makeFlags)
  • When hardcoded phases are used but they lack runHook

For new packages:

  • Check that meta.maintainers is present
  • Check that meta.license is present
  • Check that meta.platforms is present

@davidak
Copy link
Member

davidak commented Nov 8, 2019

@jtojnar great list. I created an issue at Synthetica9/nix-linter#30.

@nixos-discourse
Copy link

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/avoiding-targets-of-past-treewide-fixes/5494/2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants