Commit Graph

104 Commits

Author SHA1 Message Date
Ludovic Courtès 29f3089c84
lint: archival: Check with ‘lookup-directory-by-nar-hash’.
While this method is new and nar-sha256 ExtIDs are currently available
only for new visits, it is fundamentally more reliable than the other
methods, which is why it comes first.

* guix/lint.scm (check-archival)[lookup-by-nar-hash]: New procedure.
Call ‘lookup-by-nar-hash’ before the other lookup methods.
* tests/lint.scm ("archival: content available")
("archival: content unavailable but disarchive available")
("archival: missing revision")
("archival: revision available"): Add a 404 response corresponding to
the ‘lookup-external-id’ request.
* tests/lint.scm ("archival: nar-sha256 extid available"): New test.

Change-Id: I4a81d6e022a3b72e6484726549d7fbae627f8e73
2024-02-12 12:03:53 +01:00
Christopher Baines aa98a97607
lint: Speed up the formatting linter.
By using go-to-location which caches the number of bytes to seek by to get to
specific lines in a file.

* guix/lint.scm (report-formatting-issues): Use go-to-location.

Change-Id: I34e4d3acfbb1e14e026d2e7f712ba8d22b56c147
Signed-off-by: Christopher Baines <mail@cbaines.net>
2023-11-05 17:51:38 +00:00
Maxime Devos 96eda590e1
lint: Check that (cc-for-target) and friends are used.
"CC=gcc" is almost always incorrect; people often just don't
notice the incorrectness because they are compiling natively.
For an exception, see tzdata.

"guix style" partially made things worse, so I partially ignored it.

* guix/lint.scm (check-compiler-for-target): New linter.
* tests/lint.scm
("compiler-for-target: unconditional CC=gcc is unacceptable")
("compiler-for-target: looks through G-expressions")
("compiler-for-target: (cc-for-target) is acceptable")
("compiler-for-target: CC=gcc is acceptable when target=#false"):
Test it.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2023-09-08 19:12:15 +02:00
Nicolas Goaziou 29cc6b1cd6
gnu: Deprecate `texlive-tiny'.
At this point, there are three equivalent TeX Live sub-systems:
texlive-scheme-basic, texlive-tiny, and (texlive-updmap.cfg).  It is confusing
to keep so many around.

* doc/contributing.texi (Submitting Patches): Remove reference to
TEXLIVE-TINY.
* gnu/packages/algebra.scm (pari-gp)[native-inputs]:
(giac)[native-inputs]:
* gnu/packages/chez.scm (chez-sockets)[native-inputs]:
* gnu/packages/engineering.scm (fastcap)[native-inputs]:
* gnu/packages/gettext.scm (po4a)[native-inputs]:
* gnu/packages/maths.scm (cddlib)[native-inputs]:
(gnuplot)[native-inputs]:
(itpp)[native-inputs]:
* gnu/packages/ocaml.scm (unison)[native-inputs]:
* gnu/packages/pdf.scm (extractpdfmark)[native-inputs]:
* gnu/packages/photo.scm (enblend-enfuse): Replace TEXLIVE-TINY with a call to TEXLIVE-UPDMAP.CFG.
* gnu/packages/radio.scm (gnuradio)[native-inputs]: Remove unnecessary
TEXLIVE-TINY.
* gnu/packages/tex.scm (texlive-tiny): Deprecate it in favor of TEXLIVE-SCHEME-BASIC.
(texlive-makecmds)[native-inputs]:  Replace TEXLIVE-TINY with a call to TEXLIVE-UPDMAP.CFG.
* guix/lint.scm (check-inputs-should-be-native): Check only for
"texlive-updmap.cfg" input name.
2023-07-18 18:16:49 +02:00
Nicolas Goaziou 213cde14e3
guix: Add linter warning about texlive-updmap.cfg and texlive-tiny.
* guix/lint.scm (check-inputs-should-be-native): Warn when TEXLIVE-UPDMAP.CFG
and TEXLIVE-TINY are not native inputs.
2023-07-18 18:16:47 +02:00
Ludovic Courtès 71fd35c1d5
lint: archival: Warn against non-origin package sources.
Suggested by Maxim Cournoyer <maxim.cournoyer@gmail.com>
and Simon Tournier <zimon.toutoune@gmail.com>.

* guix/lint.scm (check-archival): Add 'local-file?' clause.  Clarify
message in case (package-source package) is not an origin.
* tests/lint.scm ("archival: not an origin"): New test.
2023-05-06 17:12:45 +02:00
Maxim Cournoyer 3bacd3c76a
Merge branch 'master' into core-updates.
Conflicts:
	gnu/local.mk
	gnu/packages/build-tools.scm
	gnu/packages/certs.scm
	gnu/packages/check.scm
	gnu/packages/compression.scm
	gnu/packages/cups.scm
	gnu/packages/fontutils.scm
	gnu/packages/gnuzilla.scm
	gnu/packages/guile.scm
	gnu/packages/ibus.scm
	gnu/packages/image-processing.scm
	gnu/packages/linux.scm
	gnu/packages/music.scm
	gnu/packages/nss.scm
	gnu/packages/pdf.scm
	gnu/packages/python-xyz.scm
	gnu/packages/qt.scm
	gnu/packages/ruby.scm
	gnu/packages/shells.scm
	gnu/packages/tex.scm
	gnu/packages/video.scm
	gnu/packages/vulkan.scm
	gnu/packages/web.scm
	gnu/packages/webkit.scm
	gnu/packages/wm.scm
2023-04-14 17:15:08 -04:00
Maxim Cournoyer cc7a79a8ad
Revert "lint: Append "/info/refs" to git-reference-url."
This reverts commit c9af27d4ca.

The change causes 'guix lint' to print URI not reachable (403) errors for
GitHub every URLs.
2023-03-28 22:22:50 -04:00
Felix Lechner c9af27d4ca
lint: Append "/info/refs" to git-reference-url.
For the atftp package added in the preceeding commit, lint produced this
warning:

  gnu/packages/networking.scm:2924:5: atftp@0.8.0:
    URI https://git.code.sf.net/p/atftp/code not reachable:
      404 ("Not Found")

Thanks to Sergey Trofimov for suggesting a fix! [1]

  [1]  https://issues.guix.gnu.org/62156#3

It was implemented here, and the warning disappeared.

* guix/lint.scm (check-source): Append "/info/refs" to git-reference-url.

Co-authored-by: Sergey Trofimov <sarg@sarg.org.ru>
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2023-03-27 18:48:53 +02:00
Ludovic Courtès ee0ef0b58f
lint: Prevent inlining of 'package-vulnerabilities'.
* guix/lint.scm (package-vulnerabilities): Prevent inlining.
2023-03-27 18:48:52 +02:00
Sergey Trofimov 4f63b4b86d
guix: Run check-synopsis-style with other local checks.
* guix/lint.scm (%network-dependent-checkers): Move check-synopsis-style to...
(%local-checkers): ... here.

Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
2023-03-21 14:06:47 -04:00
Andreas Enge ccb62d8feb
Merge remote-tracking branch 'origin/master' into core-updates 2023-03-20 18:49:06 +01:00
Ludovic Courtès ae587c2ef0
guix: Strip #:use-module lists.
This was obtained by setting up this environment:

  guix shell -D guix --with-input=guile@3.0.9=guile-next \
    --with-commit=guile-next=e2ed33ef0445c867fe56c247054aa67e834861f2
    -- make -j5

then adding 'unused-module' to (@@ (guix build compiler) %warnings),
building, and checking all the "unused module" warnings and removing
those that were definitely unused.
2023-03-13 15:08:33 +01:00
Antero Mejr a70b9fb319
lint: Check that python-pre-commit is not an input.
pre-commit should never be a native-input of python packages, it's a
package manager for commit linting that is irrelevant to builds.

* guix/lint.scm (check-inputs-should-not-be-an-input-at-all): Add entry
for python-pre-commit.

Signed-off-by: Lars-Dominik Braun <lars@6xq.net>
2023-03-12 11:04:07 +01:00
Efraim Flashner 4cf1acc7f3
Merge remote-tracking branch 'origin/master' into core-updates
Conflicts:
	doc/guix.texi
	gnu/local.mk
	gnu/packages/admin.scm
	gnu/packages/base.scm
	gnu/packages/chromium.scm
	gnu/packages/compression.scm
	gnu/packages/databases.scm
	gnu/packages/diffoscope.scm
	gnu/packages/freedesktop.scm
	gnu/packages/gnome.scm
	gnu/packages/gnupg.scm
	gnu/packages/guile.scm
	gnu/packages/inkscape.scm
	gnu/packages/llvm.scm
	gnu/packages/openldap.scm
	gnu/packages/pciutils.scm
	gnu/packages/ruby.scm
	gnu/packages/samba.scm
	gnu/packages/sqlite.scm
	gnu/packages/statistics.scm
	gnu/packages/syndication.scm
	gnu/packages/tex.scm
	gnu/packages/tls.scm
	gnu/packages/version-control.scm
	gnu/packages/xml.scm
	guix/build-system/copy.scm
	guix/scripts/home.scm
2023-01-30 12:39:40 +02:00
Ludovic Courtès a3619079f9
Remove now unnecessary uses of (guix grafts).
These modules would use (guix grafts) just to access '%graft?' and
related bindings, which are now in (guix store).

* gnu/ci.scm,
guix/gexp.scm,
guix/lint.scm,
guix/scripts.scm,
guix/scripts/archive.scm,
guix/scripts/build.scm,
guix/scripts/challenge.scm,
guix/scripts/deploy.scm,
guix/scripts/environment.scm,
guix/scripts/home.scm,
guix/scripts/pack.scm,
guix/scripts/package.scm,
guix/scripts/pull.scm,
guix/scripts/size.scm,
guix/scripts/system.scm,
guix/scripts/weather.scm,
tests/builders.scm,
tests/channels.scm,
tests/cpan.scm,
tests/derivations.scm,
tests/gexp.scm,
tests/graph.scm,
tests/guix-daemon.sh,
tests/monads.scm,
tests/pack.scm,
tests/packages.scm,
tests/profiles.scm,
tests/system.scm: Remove #:use-module (guix grafts).
2022-10-22 01:46:55 +02:00
Ludovic Courtès e0b414fc59
lint: source: Handle <svn-multi-reference> origins.
This is a followup to 2383e14518.

* guix/lint.scm (svn-reference-uri-with-userinfo): Accept REF being
an <svn-multi-reference> record.
(check-source): Handle 'svn-multi-reference?' origins like
'svn-reference?' origins.
2022-10-20 23:07:38 +02:00
Ludovic Courtès 2383e14518
lint: source: Add check for <svn-reference> over HTTP(S).
* guix/lint.scm (svn-reference-uri-with-userinfo): New procedure.
(check-source): Add 'svn-reference?' clause.
* tests/lint.scm ("source: svn-reference, HTTP 200")
("source: svn-reference, HTTP 404"): New tests.
2022-10-17 23:15:08 +02:00
Ludovic Courtès ec73570be5
lint: 'probe-uri' honors the 'userinfo' part of URIs.
* guix/lint.scm (probe-uri): Honor the 'userinfo' part of URI.
2022-10-17 23:15:08 +02:00
Maxim Cournoyer 990a4822f1
Merge branch 'staging' into core-updates
Conflicts resolved in:
	gnu/local.mk
	gnu/packages/cran.scm
	gnu/packages/gnome.scm
	gnu/packages/gtk.scm
	gnu/packages/icu4c.scm
	gnu/packages/java.scm
	gnu/packages/machine-learning.scm
	gnu/packages/tex.scm
2022-09-27 15:59:30 -04:00
Maxime Devos fc5c4ce4ec
lint: Extract logic of 'check-mirror-url'.
It will be useful for fixing <https://issues.guix.gnu.org/57477>.

* guix/lint.scm (check-mirror-url): Extract mirror://-constructing code to ...
* guix/gnu-maintenance.scm (uri-mirror-rewrite): ... here, tweaking the API
and implementation in anticipation of future users.

Co-authored-by: Ludovic Courtès <ludo@gnu.org>
2022-09-26 23:29:36 +02:00
Marius Bakke 77eb3008e3
Merge branch 'staging' into core-updates 2022-08-11 23:36:10 +02:00
Maxim Cournoyer eef8e2ec46
gnu: qttools: Rename to qttools-5.
Automated with:

  git grep -l qttools | xargs sed 's/\bqttools\b/\0-5/g' -i
  git checkout NEWS
2022-07-31 21:55:48 -04:00
Ludovic Courtès 8c3e9da13a
Merge branch 'master' into core-updates 2022-06-08 14:46:24 +02:00
Maxim Cournoyer 5d8fb87127
gnu: Remove python2-setuptools.
* gnu/packages/python-xyz.scm (python2-setuptools): Delete variable.
(python-setuptools)[properties]: Delete field.
* gnu/packages/syncthing.scm (syncthing-gtk): Delete commented native input.
* guix/lint.scm (check-inputs-should-not-be-an-input-at-all): Remove obsolete entries.
2022-05-31 14:54:16 -04:00
Maxim Cournoyer bec1c89891
gnu: Remove python2-mccabe.
* gnu/packages/python-xyz.scm (python2-mccabe): Delete variable.
2022-05-31 14:53:37 -04:00
Christopher Baines 00be2fcb0b
lint: check-derivation: Catch all exceptions.
Rather than raising the exception.

I'm looking at this as the linux-module-build-system is broken in such a way
that this causes the derivation linter to error.  With this change, it
correctly reports the issue.

* guix/lint.scm (check-derivation): Catch all exceptions.
2022-05-23 23:18:30 +01:00
Maxim Cournoyer a9429c8f22
Merge branch 'staging' into core-updates. 2022-03-21 23:39:43 -04:00
Maxime Devos 88e44f7e16
lint: check-tests-true: Allow #:tests? #t for some build systems.
emacs-build-system sets #:tests? #f by default, so the linter shouldn't warn
if #:tests? #t is set for packages using emacs-build-system.  Likewise for
texlive-build-system.

* guix/lint.scm (check-tests-true): Do not warn if the build system
  is emacs-build-system or texlive-build-system.
* tests/lint.scm
  ("tests-true: #:tests? #t acceptable for emacs packages")
  ("tests-true: #:tests? #t acceptable for texlive packages"): New tests.

Fixes: <https://issues.guix.gnu.org/50299>
Reported-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
2022-03-11 23:34:47 -05:00
Maxim Cournoyer 0d41fe4855
Merge branch 'staging' into core-updates.
With "conflicts" resolved in (mostly in favor of master/staging):
	gnu/packages/admin.scm
	gnu/packages/gnuzilla.scm
	gnu/packages/gtk.scm
	gnu/packages/kerberos.scm
	gnu/packages/linux.scm
	guix/lint.scm
2022-01-25 23:48:37 -05:00
Maxim Cournoyer 1bd169b5dc
guix: lint: Fix comment per TODO.
* guix/lint.scm (check-wrapper-inputs): Address TODO in comment.
2022-01-10 11:44:31 -05:00
Efraim Flashner 6ccf8ea81f
Merge branch 'master' into core-updates 2021-12-19 15:15:11 +02:00
Vagrant Cascadian 5f547a5c42
lint: Adjust patch file length check.
With the switch to "ustar" format in commit
bdf5c16ac0, the maximum file length has
increased.

* guix/lint.scm (check-patch-file-names): Adjust margin used to check for
  patch file lengths. Increase allowable patch file length appropriate to new
  tar format. Extend warning to explain that long files may break 'make dist'.
* tests/lint.scm: Update tests accordingly.
2021-12-17 21:04:25 -08:00
Leo Famulari 18d5e7c96b
lint: 'kdoctools' is typically used only while building.
* guix/lint.scm (check-inputs-should-be-native): Add kdoctools.
2021-12-16 13:51:54 -05:00
Efraim Flashner bc5155b952
Merge remote-tracking branch 'origin/master' into core-updates-frozen 2021-10-31 14:49:47 +02:00
Vagrant Cascadian b5f45a21c2
lint: Add description check for common typos.
Fixes: https://issues.guix.gnu.org/44675

* guix/lint.scm (check-description-typo): Add check for occurences of
  "This packages", "This modules", "allows to" and "permits to" in package
  descriptions.
* tests/lint.scm: Add tests for "This packages" and "allows to".
2021-10-24 14:26:12 -07:00
Mathieu Othacehe e486b2b674
Merge remote-tracking branch 'signed/master' into core-updates 2021-10-18 14:37:26 +00:00
Ludovic Courtès 2d06103288
lint: archival: Remove extra newline in warning.
* guix/lint.scm (check-archival): Remove extra newline in message.
2021-10-15 23:16:28 +02:00
Maxime Devos fcaed5b81e
lint: check-wrapper-inputs: Remove mentions of core-updates.
The #:sh argument of 'wrap-program' and 'wrap-qt-program' is
now in the current branch, so some comments aren't relevant anymore.

* guix/lint.scm (check-wrapper-inputs)[check-procedure-body]: Remove mentions
  of core-updates.

Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
2021-10-02 11:00:06 +00:00
Marius Bakke 5c3cb22c9b
Merge branch 'master' into core-updates-frozen
Conflicts:
	gnu/packages/bioinformatics.scm
	gnu/packages/chez.scm
	gnu/packages/docbook.scm
	gnu/packages/ebook.scm
	gnu/packages/gnome.scm
	gnu/packages/linux.scm
	gnu/packages/networking.scm
	gnu/packages/python-web.scm
	gnu/packages/python-xyz.scm
	gnu/packages/tex.scm
	gnu/packages/version-control.scm
	gnu/packages/xml.scm
	guix/build-system/dune.scm
	guix/build-system/go.scm
	guix/build-system/linux-module.scm
	guix/packages.scm
2021-09-17 01:25:52 +02:00
Ludovic Courtès 163d6385fd
lint: archival: Warn about non-origin sources.
* guix/lint.scm (check-archival): Warn about non-origin sources.
2021-09-10 17:30:54 +02:00
Ludovic Courtès 0e47fcced4
Merge branch 'master' into core-updates 2021-07-18 19:50:01 +02:00
Brice Waegeneire edb328ad83
lint: Check for leading whitespace in description.
* guix/lint.scm (check-description-style): Check for leading whitespace.
* tests/lint.scm: ("description: leading whitespace"): New test.
2021-07-13 07:25:05 +02:00
Ludovic Courtès b7f1b4c1d0
lint: Add 'input-labels' checker.
* guix/lint.scm (check-input-labels): New procedure.
(%local-checkers): Add 'input-labels' checker.
* tests/lint.scm ("input labels: no warnings")
("input labels: one warning"): New tests.
* doc/guix.texi (Invoking guix lint): Mention it.
2021-07-11 00:49:14 +02:00
Maxime Devos eac82c0e0a
lint: Lint usages of 'wrap-program' without a "bash" input.
When using 'wrap-program', "bash" (or "bash-minimal") should be
in inputs.  Otherwise, when cross-compiling, 'wrap-program' will use
a native bash instead of the cross bash and the 'patch-shebangs' won't
be able to correct this.

Tobias Geerinckx-Rice is added to the copyright lines because
a part of the "straw-viewer" package definition is included.

This linter detects 365 problematic package definitions at time
of writing.

* guix/lint.scm
  (report-wrap-program-error): New procedure.
  (check-wrapper-inputs): New linter.
  (%local-checkers)[wrapper-inputs]: Add the new linter.
  ("explicit #:sh argument to 'wrap-program' is acceptable")
  ("'check-wrapper-inputs' detects 'wrap-program' without \"bash\" in inputs")
  ("'check-wrapper-inputs' detects 'wrap-qt-program' without \"bash\" in inputs")
  ("\"bash\" in 'inputs' satisfies 'check-wrapper-inputs'")
  ("\"bash-minimal\" in 'inputs' satisfies 'check-wrapper-inputs'")
  ("'cut' doesn't hide bad usages of 'wrap-program'")
  ("bogus phase specifications don't crash the linter"): New tests.

Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
2021-07-07 10:00:52 +02:00
Maxime Devos a8e4c158f9
lint: Define some procedures for analysing code in phases.
* guix/lint.scm
  (check-optional-tests): Extract logic for extracting the phases from a
  package to ...
  (find-phase-deltas): ... here, and ...
  (report-bogus-phase-deltas): ... here.
  (check-optional-tests)[check-check-procedure]: Extract code for extracting
  the procedure body to ...
  (find-procedure-body) ... here.
  (find-phase-procedure): New procedure.
  (report-bogus-phase-procedure): New procedure.

Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
2021-07-07 10:00:52 +02:00
Maxime Devos 5532371a3a
lint: Verify if #:tests? is respected in the 'check' phase.
There have been a few patches to the mailing list lately
not respecting this, and this linter detects 630 package
definitions that could be modified to support the --without-tests
package transformation.

* guix/lint.scm
  (check-optional-tests): New linter.
  (%local-checkers)[optional-tests]: Add it.
* tests/lint.scm
  (package-with-phase-changes): New procedure.
  ("optional-tests: no check phase")
  ("optional-tests: check hase respects #:tests?")
  ("optional-tests: check phase ignores #:tests?")
  ("optional-tests: do not crash when #:phases is invalid")
  ("optional-tests: allow G-exps (no warning)")
  ("optional-tests: allow G-exps (warning)")
  ("optional-tests: complicated 'check' phase")
  ("optional-tests: 'check' phase is not first phase"): New tests.

Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
2021-06-30 13:53:00 +02:00
Ludovic Courtès 8a81ae61c1
lint: 'github-url' checker gracefully handles networking errors.
Fixes <https://bugs.gnu.org/49114>.
Reported by Tobias Geerinckx-Rice <me@tobias.gr>.

* guix/lint.scm (call-with-networking-fail-safe, with-networking-fail-safe):
Move higher in the file.
* guix/lint.scm (check-github-url): Wrap call to
'follow-redirects-to-github' in 'with-networking-fail-safe'.
2021-06-24 23:40:48 +02:00
Ludovic Courtès 468a5f8676
lint: 'with-networking-fail-safe' handles 'gnutls-error' exceptions.
* guix/lint.scm (call-with-networking-fail-safe): Add clause for 'gnutls-error'.
2021-06-24 23:40:48 +02:00
Ludovic Courtès c5b1b48f09
lint: check-patch-headers: Recognize Git diffs.
* guix/lint.scm (check-patch-headers): Add "diff --git " prefix.
2021-06-18 14:18:06 +02:00