<commit_before># Overview

The table below shows an overview of all gitlint's built-in rules, with more specific details further down the page.

Gitlint also has [community **contrib**uted rules](contrib_rules.md) which are not listed here as they're disabled by default.

In addition, you can also [write your own user-defined rule](user_defined_rules.md) in case you don't find
what you're looking for.


ID    | Name                        | gitlint version   | Description
------|-----------------------------|-------------------|-------------------------------------------
T1    | title-max-length            | >= 0.1.0          | Title length must be &lt; 72 chars.
T2    | title-trailing-whitespace   | >= 0.1.0          | Title cannot have trailing whitespace (space or tab)
T3    | title-trailing-punctuation  | >= 0.1.0          | Title cannot have trailing punctuation (?:!.,;)
T4    | title-hard-tab              | >= 0.1.0          | Title cannot contain hard tab characters (\t)
T5    | title-must-not-contain-word | >= 0.1.0          | Title cannot contain certain words (default: "WIP")
T6    | title-leading-whitespace    | >= 0.4.0          | Title cannot have leading whitespace (space or tab)
T7    | title-match-regex           | >= 0.5.0          | Title must match a given regex (default: None)
T8    | title-min-length            | >= 0.14.0         | Title length must be &gt; 5 chars.
B1    | body-max-line-length        | >= 0.1.0          | Lines in the body must be &lt; 80 chars
B2    | body-trailing-whitespace    | >= 0.1.0          | Body cannot have trailing whitespace (space or tab)
B3    | body-hard-tab               | >= 0.1.0          | Body cannot contain hard tab characters (\t)
B4    | body-first-line-empty       | >= 0.1.0          | First line of the body (second line of commit message) must be empty
B5    | body-min-length             | >= 0.4.0          | Body length must be at least 20 characters
B6    | body-is-missing             | >= 0.4.0          | Body message must be specified
B7    | body-changed-file-mention   | >= 0.4.0          | Body must contain references to certain files if those files are changed in the last commit
B8    | body-match-regex            | >= 0.14.0         | Body must match a given regex (default: None)
M1    | author-valid-email          | >= 0.9.0          | Author email address must be a valid email address
I1    | ignore-by-title             | >= 0.10.0         | Ignore a commit based on matching its title
I2    | ignore-by-body              | >= 0.10.0         | Ignore a commit based on matching its body
I3    | ignore-body-lines           | >= 0.14.0         | Ignore certain lines in a commit body that match a regex
I4    | ignore-by-author-name       | >= 0.16.0         | Ignore a commit based on matching its author name



## T1: title-max-length

ID    | Name                        | gitlint version | Description
------|-----------------------------|-----------------|-------------------------------------------
T1    | title-max-length            | >= 0.1          | Title length must be &lt; 72 chars.

### Options

Name           | gitlint version | Default | Description
---------------|-----------------|---------|----------------------------------
line-length    | >= 0.2          | 72      |  Maximum allowed title length

### Examples

#### .gitlint

```ini
# Titles should be max 72 chars
[title-max-length]
line-length=72

# It's the 21st century, titles can be 120 chars long
[title-max-length]
line-length=120
```

## T2: title-trailing-whitespace

ID    | Name                        | gitlint version | Description
------|-----------------------------|-----------------|-------------------------------------------
T2    | title-trailing-whitespace   | >= 0.1          | Title cannot have trailing whitespace (space or tab)


## T3: title-trailing-punctuation

ID    | Name                        | gitlint version | Description
------|-----------------------------|-----------------|-------------------------------------------
T3    | title-trailing-punctuation  | >= 0.1          | Title cannot have trailing punctuation (?:!.,;)


## T4: title-hard-tab

ID    | Name                        | gitlint version | Description
------|-----------------------------|-----------------|-------------------------------------------
T4    | title-hard-tab              | >= 0.1          | Title cannot contain hard tab characters (\t)


## T5: title-must-not-contain-word

ID    | Name                        | gitlint version | Description
------|-----------------------------|-----------------|-------------------------------------------
T5    | title-must-not-contain-word | >= 0.1          | Title cannot contain certain words (default: "WIP")

### Options

Name           | gitlint version | Default | Description
---------------|-----------------|---------|----------------------------------
words          | >= 0.3          | WIP     | Comma-separated list of words that should not be used in the title. Matching is case insensitive

### Examples

#### .gitlint

```ini
# Ensure the title doesn't contain swear words
[title-must-not-contain-word]
words=crap,darn,damn
```

## T6: title-leading-whitespace

ID    | Name                        | gitlint version | Description
------|-----------------------------|-----------------|-------------------------------------------
T6    | title-leading-whitespace    | >= 0.4          | Title cannot have leading whitespace (space or tab)

## T7: title-match-regex

ID    | Name                        | gitlint version | Description
------|-----------------------------|-----------------|-------------------------------------------
T7    | title-match-regex           | >= 0.5          | Title must match a given regex (default: .*)


### Options

Name           | gitlint version | Default | Description
---------------|-----------------|---------|----------------------------------
regex          | >= 0.5          | .*      | [Python regex](https://docs.python.org/library/re.html) that the title should match.

### Examples

#### .gitlint

```ini
# Ensure every title starts with a user-story like US123
[title-match-regex]
regex=^US[1-9][0-9]*
```

## T8: title-min-length ##

ID    | Name                        | gitlint version | Description
------|-----------------------------|-----------------|-------------------------------------------
T8    | title-min-length            | >= 0.14.0	      | Title length must be &gt; 5 chars.


### Options

Name           | gitlint version | Default | Description
---------------|-----------------|---------|----------------------------------
min-length     | >= 0.14.0       | 5       |  Minimum required title length

### Examples

#### .gitlint

```ini
# Titles should be min 3 chars
[title-min-length]
min-length=3
```

## B1: body-max-line-length

ID    | Name                        | gitlint version | Description
------|-----------------------------|-----------------|-------------------------------------------
B1    | body-max-line-length        | >= 0.1          | Lines in the body must be &lt; 80 chars

### Options

Name           | gitlint version | Default | Description
---------------|-----------------|---------|----------------------------------
line-length    | >= 0.2          | 80      |  Maximum allowed line length in the commit message body

### Examples

#### .gitlint

```ini
# It's the 21st century, lines can be 120 chars long
[body-max-line-length]
line-length=120

# Your tool prefers 72
[body-max-line-length]
line-length=72
```

## B2: body-trailing-whitespace

ID    | Name                        | gitlint version | Description
------|-----------------------------|-----------------|-------------------------------------------<commit_msg>Fix descriptions of length config parameters (#295)<commit_after># Overview

The table below shows an overview of all gitlint's built-in rules, with more specific details further down the page.

Gitlint also has [community **contrib**uted rules](contrib_rules.md) which are not listed here as they're disabled by default.

In addition, you can also [write your own user-defined rule](user_defined_rules.md) in case you don't find
what you're looking for.


ID    | Name                        | gitlint version   | Description
------|-----------------------------|-------------------|-------------------------------------------
T1    | title-max-length            | >= 0.1.0          | Title length must be &lt;= 72 chars.
T2    | title-trailing-whitespace   | >= 0.1.0          | Title cannot have trailing whitespace (space or tab)
T3    | title-trailing-punctuation  | >= 0.1.0          | Title cannot have trailing punctuation (?:!.,;)
T4    | title-hard-tab              | >= 0.1.0          | Title cannot contain hard tab characters (\t)
T5    | title-must-not-contain-word | >= 0.1.0          | Title cannot contain certain words (default: "WIP")
T6    | title-leading-whitespace    | >= 0.4.0          | Title cannot have leading whitespace (space or tab)
T7    | title-match-regex           | >= 0.5.0          | Title must match a given regex (default: None)
T8    | title-min-length            | >= 0.14.0         | Title length must be &gt;= 5 chars.
B1    | body-max-line-length        | >= 0.1.0          | Lines in the body must be &lt;= 80 chars
B2    | body-trailing-whitespace    | >= 0.1.0          | Body cannot have trailing whitespace (space or tab)
B3    | body-hard-tab               | >= 0.1.0          | Body cannot contain hard tab characters (\t)
B4    | body-first-line-empty       | >= 0.1.0          | First line of the body (second line of commit message) must be empty
B5    | body-min-length             | >= 0.4.0          | Body length must be at least 20 characters
B6    | body-is-missing             | >= 0.4.0          | Body message must be specified
B7    | body-changed-file-mention   | >= 0.4.0          | Body must contain references to certain files if those files are changed in the last commit
B8    | body-match-regex            | >= 0.14.0         | Body must match a given regex (default: None)
M1    | author-valid-email          | >= 0.9.0          | Author email address must be a valid email address
I1    | ignore-by-title             | >= 0.10.0         | Ignore a commit based on matching its title
I2    | ignore-by-body              | >= 0.10.0         | Ignore a commit based on matching its body
I3    | ignore-body-lines           | >= 0.14.0         | Ignore certain lines in a commit body that match a regex
I4    | ignore-by-author-name       | >= 0.16.0         | Ignore a commit based on matching its author name



## T1: title-max-length

ID    | Name                        | gitlint version | Description
------|-----------------------------|-----------------|-------------------------------------------
T1    | title-max-length            | >= 0.1          | Title length must be &lt;= 72 chars.

### Options

Name           | gitlint version | Default | Description
---------------|-----------------|---------|----------------------------------
line-length    | >= 0.2          | 72      |  Maximum allowed title length

### Examples

#### .gitlint

```ini
# Titles should be max 72 chars
[title-max-length]
line-length=72

# It's the 21st century, titles can be 120 chars long
[title-max-length]
line-length=120
```

## T2: title-trailing-whitespace

ID    | Name                        | gitlint version | Description
------|-----------------------------|-----------------|-------------------------------------------
T2    | title-trailing-whitespace   | >= 0.1          | Title cannot have trailing whitespace (space or tab)


## T3: title-trailing-punctuation

ID    | Name                        | gitlint version | Description
------|-----------------------------|-----------------|-------------------------------------------
T3    | title-trailing-punctuation  | >= 0.1          | Title cannot have trailing punctuation (?:!.,;)


## T4: title-hard-tab

ID    | Name                        | gitlint version | Description
------|-----------------------------|-----------------|-------------------------------------------
T4    | title-hard-tab              | >= 0.1          | Title cannot contain hard tab characters (\t)


## T5: title-must-not-contain-word

ID    | Name                        | gitlint version | Description
------|-----------------------------|-----------------|-------------------------------------------
T5    | title-must-not-contain-word | >= 0.1          | Title cannot contain certain words (default: "WIP")

### Options

Name           | gitlint version | Default | Description
---------------|-----------------|---------|----------------------------------
words          | >= 0.3          | WIP     | Comma-separated list of words that should not be used in the title. Matching is case insensitive

### Examples

#### .gitlint

```ini
# Ensure the title doesn't contain swear words
[title-must-not-contain-word]
words=crap,darn,damn
```

## T6: title-leading-whitespace

ID    | Name                        | gitlint version | Description
------|-----------------------------|-----------------|-------------------------------------------
T6    | title-leading-whitespace    | >= 0.4          | Title cannot have leading whitespace (space or tab)

## T7: title-match-regex

ID    | Name                        | gitlint version | Description
------|-----------------------------|-----------------|-------------------------------------------
T7    | title-match-regex           | >= 0.5          | Title must match a given regex (default: .*)


### Options

Name           | gitlint version | Default | Description
---------------|-----------------|---------|----------------------------------
regex          | >= 0.5          | .*      | [Python regex](https://docs.python.org/library/re.html) that the title should match.

### Examples

#### .gitlint

```ini
# Ensure every title starts with a user-story like US123
[title-match-regex]
regex=^US[1-9][0-9]*
```

## T8: title-min-length ##

ID    | Name                        | gitlint version | Description
------|-----------------------------|-----------------|-------------------------------------------
T8    | title-min-length            | >= 0.14.0	      | Title length must be &gt;= 5 chars.


### Options

Name           | gitlint version | Default | Description
---------------|-----------------|---------|----------------------------------
min-length     | >= 0.14.0       | 5       |  Minimum required title length

### Examples

#### .gitlint

```ini
# Titles should be min 3 chars
[title-min-length]
min-length=3
```

## B1: body-max-line-length

ID    | Name                        | gitlint version | Description
------|-----------------------------|-----------------|-------------------------------------------
B1    | body-max-line-length        | >= 0.1          | Lines in the body must be &lt;= 80 chars

### Options

Name           | gitlint version | Default | Description
---------------|-----------------|---------|----------------------------------
line-length    | >= 0.2          | 80      |  Maximum allowed line length in the commit message body

### Examples

#### .gitlint

```ini
# It's the 21st century, lines can be 120 chars long
[body-max-line-length]
line-length=120

# Your tool prefers 72
[body-max-line-length]
line-length=72
```

## B2: body-trailing-whitespace

ID    | Name                        | gitlint version | Description
------|-----------------------------|-----------------|-------------------------------------------
{'fraction_non_alphanumeric': 0.27589960302215394, 'fraction_numerical': 0.02465104366756307, 'mean_word_length': 1.180510959095351, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 73, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '52333', 'n_tokens_mistral': 4200, 'n_tokens_neox': 3827, 'n_words': 1284}