Louis-Philippe Véronneau pushed to branch master at lintian / lintian


Commits:
cf22df6f by Nilesh Patra at 2026-05-06T15:59:31+00:00
Update cute-field check to flag differently for "X-DH-Compat" (Closes: #1135283)

- - - - -
3588a63b by Nilesh Patra at 2026-05-06T15:59:31+00:00
Add test to flag correct "X-DH-Compat" style (See: #1072741)

- - - - -


5 changed files:

- lib/Lintian/Check/Fields/Style.pm
- + t/recipes/checks/fields/style/style-x-dh-compat/build-spec/debian/control.in
- + t/recipes/checks/fields/style/style-x-dh-compat/build-spec/fill-values
- + t/recipes/checks/fields/style/style-x-dh-compat/eval/desc
- + t/recipes/checks/fields/style/style-x-dh-compat/eval/hints


Changes:

=====================================
lib/Lintian/Check/Fields/Style.pm
=====================================
@@ -29,6 +29,8 @@ use namespace::clean;
 
 with 'Lintian::Check';
 
+my %cute_field_exceptions = ('x-dh-compat'      => 'X-DH-Compat',);
+
 # the fields in d/control provide the values for many fields elsewhere
 sub source {
     my ($self) = @_;
@@ -60,11 +62,14 @@ sub check_style {
 
         # title-case the field name
         my $standard = lc $name;
-        $standard =~ s/\b(\w)/\U$1/g;
-
-        # capitalize up to three letters after an X, if followed by hyphen
-        $standard =~ s/^(X[SBC]{1,3})-/\U$1-/i;
-
+        if (exists $cute_field_exceptions{$standard}) {
+            $standard = $cute_field_exceptions{$standard};
+        } else {
+            $standard =~ s/\b(\w)/\U$1/g;
+
+            # capitalize up to three letters after an X, if followed by hyphen
+            $standard =~ s/^(X[SBC]{1,3})-/\U$1-/i;
+        }
         my $position = $fields->position($name);
         my $pointer = $item->pointer($position);
 


=====================================
t/recipes/checks/fields/style/style-x-dh-compat/build-spec/debian/control.in
=====================================
@@ -0,0 +1,18 @@
+Source: [% $source %]
+Priority: [% $priority %]
+Section: [% $section %]
+Maintainer: [% $author %]
+Standards-Version: [% $standards_version %]
+Build-Depends: debhelper
+Rules-Requires-Root: [% $rules_requires_root %]
+X-dh-Compat: 13
+
+Package: [% $source %]
+Architecture: [% $package_architecture %]
+Pre-Depends: ${misc:Pre-Depends}
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Description: [% $description %]
+ This is a test package designed to exercise some feature or tag of
+ Lintian.  It is part of the Lintian test suite and may do very odd
+ things.  It should not be installed like a regular package.  It may
+ be an empty package.


=====================================
t/recipes/checks/fields/style/style-x-dh-compat/build-spec/fill-values
=====================================
@@ -0,0 +1,3 @@
+Skeleton: upload-non-native
+Testname: style-x-dh-compat
+Description: All caps spelling of field names.


=====================================
t/recipes/checks/fields/style/style-x-dh-compat/eval/desc
=====================================
@@ -0,0 +1,3 @@
+Testname: style-x-dh-compat
+Test-Against: cute-field
+Check: fields/style


=====================================
t/recipes/checks/fields/style/style-x-dh-compat/eval/hints
=====================================
@@ -0,0 +1 @@
+style-x-dh-compat (source): cute-field X-dh-Compat vs X-DH-Compat 
[debian/control:8]



View it on GitLab: 
https://salsa.debian.org/lintian/lintian/-/compare/84c16500d4ace1b0d7a307dbd38708938842efb2...3588a63b8296d820068318ffecbb71c572f93078

-- 
View it on GitLab: 
https://salsa.debian.org/lintian/lintian/-/compare/84c16500d4ace1b0d7a307dbd38708938842efb2...3588a63b8296d820068318ffecbb71c572f93078
You're receiving this email because of your account on salsa.debian.org. Manage 
all notifications: https://salsa.debian.org/-/profile/notifications | Help: 
https://salsa.debian.org/help


Reply via email to