2 # vim:ts=4:sw=4:expandtab
4 # © 2016 Michael Stapelberg
6 # Checks for spelling errors in binaries and manpages (to be run by continuous
7 # integration to point out spelling errors before accepting contributions).
13 use lib 'testcases/lib';
14 use i3test::Util qw(slurp);
15 use Lintian::Check qw(check_spelling);
17 # Lintian complains if we don’t set a vendor.
20 Lintian::Data->set_vendor(
21 Lintian::Profile->new('debian', ['/usr/share/lintian'], {}));
25 # Whitelist for spelling errors in manpages, in case the spell checker has
27 my $binary_spelling_exceptions = {
28 #'exmaple' => 1, # Example for how to add entries to this whitelist.
29 'betwen' => 1, # asan_flags.inc contains this spelling error.
33 build/i3-config-wizard/i3-config-wizard
34 build/i3-dump-log/i3-dump-log
35 build/i3-input/i3-input
37 build/i3-nagbar/i3-nagbar
40 for my $binary (@binaries) {
41 check_spelling(slurp($binary), $binary_spelling_exceptions, sub {
42 my ($current, $fixed) = @_;
43 say STDERR qq|Binary "$binary" contains a spelling error: "$current" should be "$fixed"|;
48 # Whitelist for spelling errors in manpages, in case the spell checker has
50 my $manpage_spelling_exceptions = {
53 for my $name (glob('build/man/*.1')) {
54 for my $line (split(/\n/, slurp($name))) {
55 next if $line =~ /^\.\\\"/o;
56 check_spelling($line, $manpage_spelling_exceptions, sub {
57 my ($current, $fixed) = @_;
58 say STDERR qq|Manpage "$name" contains a spelling error: "$current" should be "$fixed"|;