/usr/share/doc/lintian/lintian.html/section-3.3.html is in lintian 2.5.43.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
<HTML
><HEAD
><TITLE
>Writing your own Lintian checks</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
REL="HOME"
TITLE="Lintian User's Manual"
HREF="index.html"><LINK
REL="UP"
TITLE="Advanced usage"
HREF="chapter-3.html"><LINK
REL="PREVIOUS"
TITLE="The laboratory"
HREF="section-3.2.html"></HEAD
><BODY
CLASS="sect1"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>Lintian User's Manual</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="section-3.2.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
>Chapter 3. Advanced usage</TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
> </TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="sect1"
><H1
CLASS="sect1"
><A
NAME="section-3.3"
>3.3. Writing your own Lintian checks</A
></H1
><P
> This section describes how to write and deploy your own
Lintian checks. Lintian will load checks from the following
directories (in order):
</P
><P
></P
><UL
><LI
><P
> <TT
CLASS="filename"
>$LINTIAN_ROOT/checks</TT
>
</P
></LI
></UL
><P
> Existing checks can be shadowed by placing a check with the
same name in an directory appearing earlier in the list. This
also holds for the checks provided by Lintian itself.
</P
><P
> Checks in Lintian consist of a description file (.desc) and a
Perl module implementing the actual check (.pm). The
names of these checks must consist entirely of the lower case
characters ([a-z]), digits ([0-9]), underscore (_), dash (-),
period (.) and forward slashes (/).
</P
><P
> The check name must be a valid Perl unique module name after
the following transformations. All periods and dashes are
replaced with underscores. All forward slashes are replaced
with two colons (::).
</P
><P
> Check names without a forward slash (e.g. "fields") and names
starting with either "lintian/" or "coll/" are reserved for
the Lintian core. Vendors are recommended to use their vendor
name before the first slash (e.g. "ubuntu/fields").
</P
><DIV
CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="section-3.3.1"
>3.3.1. Check description file</A
></H2
><P
> The check description file is written in the same syntax as
Debian control files as described in the
<A
HREF="https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-controlsyntax"
TARGET="_top"
> Debian Policy Manual ยง5.1</A
>. Check description files
allow comments as described in the Policy Manual.
</P
><P
> The check description file has two paragraph types. The
first is the check description itself and must be the first
paragraph. The rest of the descriptions describe tags, one
tag per paragraph.
</P
><DIV
CLASS="sect3"
><H3
CLASS="sect3"
><A
NAME="section-3.3.1.1"
>3.3.1.1. Check description paragraph</A
></H3
><P
> The fields in the check description paragraph are:
</P
><P
></P
><DIV
CLASS="variablelist"
><DL
><DT
><SPAN
CLASS="emphasis"
><I
CLASS="emphasis"
>Check-Script</I
></SPAN
> (simple, mandatory)</DT
><DD
><P
> Name of the check. This is used to determine the
package name of the Perl module implementing the
check.
</P
></DD
><DT
><SPAN
CLASS="emphasis"
><I
CLASS="emphasis"
>Type</I
></SPAN
> (simple, mandatory)</DT
><DD
><P
> Comma separated list of package types for which this
check should be run. Allowed values in the list are
"binary" (.deb files), "changes" (.changes files),
"source" (.dsc files) and "udeb" (.udeb files).
</P
></DD
><DT
><SPAN
CLASS="emphasis"
><I
CLASS="emphasis"
>Needs-Info</I
></SPAN
> (simple, optional)</DT
><DD
><P
> Comma separated list of collections required for the
check to be run. Common values here include "unpacked",
"index" and "file-info".
</P
></DD
><DT
><SPAN
CLASS="emphasis"
><I
CLASS="emphasis"
>Info</I
></SPAN
> (multiline, optional)</DT
><DD
><P
> A short description of what the check is for.
</P
></DD
><DT
><SPAN
CLASS="emphasis"
><I
CLASS="emphasis"
>Author</I
></SPAN
> (simple, optional)</DT
><DD
><P
> Name and email of the person, who created (or
implemented etc.) the check.
</P
></DD
><DT
><SPAN
CLASS="emphasis"
><I
CLASS="emphasis"
>Abbrev</I
></SPAN
> (simple, optional)</DT
><DD
><P
> Alternative or abbreviated name of the check. These
can be used with certain command line options as an
alternative name for the check.
</P
></DD
></DL
></DIV
></DIV
><DIV
CLASS="sect3"
><H3
CLASS="sect3"
><A
NAME="section-3.3.1.2"
>3.3.1.2. Tag description paragraph</A
></H3
><P
> The fields in the tag description paragraph are:
</P
><P
></P
><DIV
CLASS="variablelist"
><DL
><DT
><SPAN
CLASS="emphasis"
><I
CLASS="emphasis"
>Tag</I
></SPAN
> (simple, mandatory)</DT
><DD
><P
> Name of the tag. It must consist entirely of the
lower or/and upper case characters ([a-zA-Z]),
digits ([0-9]), underscore (_), dash (-) and period (.).
The tag name should be at most 68 characters long.
</P
></DD
><DT
><SPAN
CLASS="emphasis"
><I
CLASS="emphasis"
>Severity</I
></SPAN
> (simple, mandatory)</DT
><DD
><P
> Determines the default value for how "severe" the
tag is. The value must be one of "serious",
"important", "normal", "minor", "wishlist" and
"pedantic". The effective severity and the value of
the Certainty field of a tag determine the
"one-letter" code (of non-experimental tags).
</P
></DD
><DT
><SPAN
CLASS="emphasis"
><I
CLASS="emphasis"
>Certainty</I
></SPAN
> (simple, mandatory)</DT
><DD
><P
> How accurate the tag is (believed to be). The value
must be one of "certain", "possible", "wild-guess".
The effective severity and the value of the
Certainty field of a tag determine the "one-letter"
code (of non-experimental tags).
</P
></DD
><DT
><SPAN
CLASS="emphasis"
><I
CLASS="emphasis"
>Info</I
></SPAN
> (multiline, mandatory)</DT
><DD
><P
> The description of the tag, which can be seen by
using lintian-info (etc.). The HTML tags
"<tt>" and "<i>" may be used in the
description.
</P
><P
> The symbols &, < and > must be escaped as
&amp;, &lt; and &gt; (respectively).
</P
><P
> Indented lines are considered "pre-formatted" and
will not be line wrapped. These lines are still
subject to the allowed HTML tags and above mentioned
escape sequences.
</P
></DD
><DT
><SPAN
CLASS="emphasis"
><I
CLASS="emphasis"
>Ref</I
></SPAN
> (simple, optional)</DT
><DD
><P
> A comma separated list of references. It can be used
to refer to extra documentation. It is primarily
used for manual references, HTTP links or Debian bug
references.
</P
><P
> If a reference contains a space, it is taken as a
manual reference (e.g. "policy 4.14"). These
references are recorded in the
"output/manual-references" data file.
</P
><P
> Other references include manpages ("lintian(1)"),
ftp or http(s) links ("https://lintian.debian.org"),
file references ("/usr/share/doc/lintian/changelog.gz")
or Debian bug numbers prefixed with a hash ("#651816").
</P
><P
> Unknown references are (silently) ignored.
</P
></DD
><DT
><SPAN
CLASS="emphasis"
><I
CLASS="emphasis"
>Experimental</I
></SPAN
> (simple, optional)</DT
><DD
><P
> Whether or not the tag is considered "experimental".
Recognised values are "no" (default) and "yes".
Experimental tags always use "X" as their
"one-letter" code.
</P
></DD
></DL
></DIV
></DIV
></DIV
><DIV
CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="section-3.3.2"
>3.3.2. Check Perl module file</A
></H2
><P
> This section describes the requirements for the Perl module
implementing a given check.
</P
><P
> The Perl package name of the check must be identical to
the check name (as defined by the "Check-Script" field in
the description file) with the following transformations:
</P
><P
></P
><UL
><LI
><P
>All periods and dashes are replaced with underscores.</P
></LI
><LI
><P
>All forward slashes are replaced by two colons (::).</P
></LI
><LI
><P
>The resulting value is prefixed with "Lintian::".</P
></LI
></UL
><P
> As an example, the check name <TT
CLASS="literal"
>contrib/hallo-world</TT
>
will result in the Perl package name
<TT
CLASS="literal"
>Lintian::contrib::hallo_world</TT
>.
</P
><DIV
CLASS="sect3"
><H3
CLASS="sect3"
><A
NAME="section-3.3.2.1"
>3.3.2.1. API of the "run" sub</A
></H3
><P
> The Perl module must implement the sub called <TT
CLASS="literal"
>run</TT
> in
that Perl package. This sub will be run once for each package to be
checked with 5 arguments. These are (in order):
</P
><P
></P
><UL
><LI
><P
>The package name.</P
></LI
><LI
><P
> The package type being checked in this run. This string
is one of "binary" (.deb), "changes" (.changes), "source"
(.dsc) or "udeb" (.udeb).
</P
></LI
><LI
><P
> An instance of API Lintian::Collect. Its exact type depends
on the type being processed and is one of
Lintian::Collect::Binary (.deb or .udeb),
Lintian::Collect::Changes (.changes) or
Lintian::Collect::Source (.dsc).
</P
></LI
><LI
><P
> An instance of Lintian::Processable that represents the
package being processed.
</P
></LI
><LI
><P
> An instance of Lintian::ProcessableGroup that represents
the other processables in the given group. An instance
of the Lintian::Collect::Group is available via its
"info" method.
</P
></LI
></UL
><P
> Further arguments may be added in the future after the above
mentioned ones. Implementations should therefore ignore
extra arguments beyond the ones they know of.
</P
><P
> If the run sub returns "normally", the check was run
successfully. Implementations should ensure the return
value is undefined.
</P
><P
> If the run sub invokes a trappable error (e.g. "die"), no
further checks are done on the package and Lintian will
(eventually) exit with 2 to its caller. The check may
still be run on other packages.
</P
><P
> The run sub may emit tags by invoking the sub "tag" from
Lintian::Tags (it can be imported). The first argument is
the name of the tag to emit. Any extra arguments will be
used as the "tag extra" (or diagnostics). Example:
</P
><PRE
CLASS="programlisting"
> use Lintian::Tags qw(tag);
sub run {
tag 'my-tag', 'hallo world';
}
</PRE
><P
> would emit the tag "my-tag" with the extra note "hallo
world" like this:
</P
><PRE
CLASS="screen"
> I: package: my-tag hallo world
</PRE
></DIV
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="section-3.2.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
> </TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>The laboratory</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="chapter-3.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
> </TD
></TR
></TABLE
></DIV
></BODY
></HTML
>
|