Add rule (addrule)

Create a new style guide rule.

Create a new style guide rule.

Request

Use the shared HTTP API endpoint and request formats.

See HTTP API Overview.

Parameters

Parameter
Type
Required
Default
Notes

cmd

string

Yes

style_guide

Command name.

action

string

Yes

addrule

Action name.

lang

string

No

common

Language scope to create the rule in (example: en_US or en).

patterns

string[]

Yes

Patterns to match.

suggestions

string[]

No

[]

Replacement suggestions.

state

boolean

No

true

Enables/disables the rule.

context_include

string[]

No

[]

Matches only when one of these contexts exists.

context_exclude

string[]

No

[]

Skips matches when one of these contexts exists.

description

string

No

Message shown to the user.

circle-info

You can’t choose a rule ID.

The rule ID is generated as a hash of patterns + context_include. If patterns or context_include changes later, the rule will get a new ID.

Behavior

  • Creates a new rule in the target style guide file.

  • Returns the created rule in result.

Response

Single rule object containing its rule ID is returned.

See Response schema.

Errors

See Errors.

Examples

chevron-rightExample (JSON body)hashtag

Last updated

Was this helpful?