#[non_exhaustive]pub enum Lint {
Show 23 variants
ExtraId,
UndeclaredVariable,
UndeclaredMarkup,
DroppedMarkup,
DynamicSelect,
BadOptionValue,
GatedFunction,
DoNotTranslate,
DuplicateId,
LocaleMismatch,
UnknownFunction,
MissingTranslation,
NeutralNumbers,
UnpairedMarkup,
MissingPluralCategory,
NonNfcSource,
DroppedPlaceholder,
UnknownOption,
UnusedId,
SuspiciousBidi,
DynamicCurrency,
DynamicUnit,
NonstandardName,
}Expand description
One check mf2 check makes.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
ExtraId
A translation has an id the source locale does not.
UndeclaredVariable
A translation uses a variable the source message does not declare.
A language that needs more input (grammatical gender, say) gets it by
the source declaring it with .input, even where its own pattern
ignores it.
UndeclaredMarkup
A translation uses a markup name the source message does not.
DroppedMarkup
A translation leaves out markup the source message has: a
{#link}terms{/link} gone from the French sentence takes the link
away from French readers, and nothing at run time says so. An error by
default, where a dropped placeholder is a warning — a plural variant
routinely drops {$count} (“one” says “a message”), and nothing
routinely drops a link; a corpus that drops emphasis on purpose may
turn it down.
DynamicSelect
A select option is not a literal, so nothing can tell which rules a
message selects by until it runs. An error by default: the catalog
then has to carry both plural rule sets, and the message reports a Bad
Option anyway. A corpus that means it may turn it down.
BadOptionValue
A well-known option has a literal value it cannot take. An error by default, though the runtime would report Bad Option on its own — the suite has messages that do exactly that on purpose.
GatedFunction
A function whose client feature is off — :percent, :currency and
:unit without fn-number, :datetime, :date and :time without
fn-datetime. A translation can never silently add formatting code to
the wasm (plans/03-runtime.md §5.1).
DoNotTranslate
An entry marked @do-not-translate differs from the source’s.
DuplicateId
Two entries of one locale have the same id, so one of them would be silently dropped.
LocaleMismatch
A file declares an @locale other than the directory it sits in.
An error by default — it is nearly always a copy that was never
finished — but a corpus that keeps one locale’s files under another
tag on purpose may turn it down.
UnknownFunction
A function no registered crate provides. An error by default and configurable, since custom functions are legal.
MissingTranslation
An id the source locale has and a translation does not: it falls back.
NeutralNumbers
A placeholder can receive a number and fn-number is off, so a number
renders without the locale’s symbols. The build cannot see what an
application passes, so a placeholder that only receives text raises it too.
UnpairedMarkup
Markup opened and not closed, or closed and not opened.
MissingPluralCategory
A plural .match that does not mention every category the target
locale has.
NonNfcSource
Source text that is not in NFC.
DroppedPlaceholder
A placeholder the source has and a translation dropped.
UnknownOption
An option a built-in function does not define — dateStyle on
:datetime, say. MF2 ignores it, so the message formats as though it
were not there, and nothing at run time says so.
UnusedId
An id no tr! in the workspace names.
SuspiciousBidi
Unpaired bidi isolates in literal text.
DynamicCurrency
A :currency whose currency option is not a literal, so the catalog
must carry every currency CLDR has; listing the codes it can hold in
mf2.toml [locale_data] carries only those and silences this
(plans/02-catalog-format.md §4.4).
DynamicUnit
The same for :unit.
NonstandardName
A variable, option, function, markup or attribute name that is not a
Unicode identifier under MF2’s profile of UAX #31, uses a character
UTS #39’s General Security Profile does not allow, or mixes scripts —
syntax.md asks linters to warn on exactly these.
Implementations§
Source§impl Lint
impl Lint
Sourcepub fn default_level(self) -> Level
pub fn default_level(self) -> Level
What it does when mf2.toml says nothing.
Sourcepub fn floor(self) -> Level
pub fn floor(self) -> Level
The lowest level mf2.toml may set it to. A lint whose floor
is Level::Error states a rule the rest of the pipeline
relies on — a build that ignored it could not produce a
correct catalog — so it cannot be turned down.
Trait Implementations§
impl Copy for Lint
Source§impl<'de> Deserialize<'de> for Lint
impl<'de> Deserialize<'de> for Lint
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for Lint
Source§impl Ord for Lint
impl Ord for Lint
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for Lint
impl PartialOrd for Lint
impl StructuralPartialEq for Lint
Auto Trait Implementations§
impl Freeze for Lint
impl RefUnwindSafe for Lint
impl Send for Lint
impl Sync for Lint
impl Unpin for Lint
impl UnsafeUnpin for Lint
impl UnwindSafe for Lint
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more