  Searches for gravitational-wave signals are often based on maximizing a
detection statistic over a bank of waveform templates, covering a given
parameter space with a variable level of correlation. Results are often
evaluated using a noise-hypothesis test, where the background is characterized
by the sampling distribution of the loudest template. In the context of
continuous gravitational-wave searches, properly describing said distribution
is an open problem: current approaches focus on a particular detection
statistic and neglect template-bank correlations. We introduce a new approach
using extreme value theory to describe the distribution of the loudest
template's detection statistic in an arbitrary template bank. Our new proposal
automatically generalizes to a wider class of detection statistics, including
(but not limited to) line-robust statistics and transient continuous-wave
signal hypotheses, and improves the estimation of the expected maximum
detection statistic at a negligible computing cost. The performance of our
proposal is demonstrated on simulated data as well as by applying it to
different kinds of (transient) continuous-wave searches using O2 Advanced LIGO
data. We release an accompanying Python software package, distromax,
implementing our new developments.
