Units of Measure Number Format

Description

This rule enforces that numbers appearing before units of measurement should be written as numerals rather than spelled out as words. Following this convention improves readability and aligns with Microsoft's style guide recommendations for technical documentation. Consistent number formatting in measurements helps readers quickly scan and comprehend technical specifications and values.

Examples

This rule will flag cases where units of measurement are preceded by spelled-out numbers. Here are some examples:

✗ Incorrect:

  • "twenty meters long"
  • "five kilograms of material"
  • "three centimeters wide"
  • "twelve megapixels camera"

✓ Correct:

  • "20 meters long"
  • "5 kilograms of material"
  • "3 centimeters wide"
  • "12 megapixels camera"

The rule checks for various common units of measure, including:

  • Metric units (meters, grams, kilometers)
  • Imperial units (inches, pounds, miles)
  • Digital measurements (pixels)
  • Common abbreviations (cm, lb)

Rule Source

This rule comes from: https://github.com/mesosphere/dcos-docs-site

Rule Definition

extends: existence
message: "Don't spell out the number in '%s'."
link: https://docs.microsoft.com/en-us/style-guide/a-z-word-list-term-collections/term-collections/units-of-measure-terms
level: error
raw:
  - '[a-zA-Z]+\s'
tokens:
  - '(?:centi|milli)?meters'
  - '(?:kilo)?grams'
  - '(?:kilo)?meters'
  - '(?:mega)?pixels'
  - cm
  - inches
  - lb
  - miles
  - pounds