Skip to content

rule tool

Use rule to learn why a rule fires and how to fix what it reports. It returns the rule with its documentation, which is the text of its rule page, and its examples.

rule(package, rule)
  • Changes no file
  • A second call with the same arguments changes nothing more
  • Stays inside the project

Tags: rules.

The server gives the agent this description of the tool.

Read one rule: why it matters, what it reports, and its before and after examples.

Type: string. Required.

The rule's pack, by module name, such as pandas.

Type: string. Required.

The rule id, such as chained-assignment.

One rule with its documentation, which has examples and notes.

Field Type Required Default Description
package string yes Module name of the pack, such as pandas or sklearn.
rule string yes
severity "error", "warning", "info", "hint" yes
message string yes
fix "safe", "unsafe" or null yes
since string or null yes The first library version the rule applies to.
url string or null yes The rule documentation URL, when supplied.
doc string or null yes The rule's documentation as Markdown.
{"package":"pandas","rule":"no-inplace"}

The result has package, rule, severity, message, fix, since, url and doc.

{"package":"pandas","rule":"no-inplace","severity":"info","message":"inplace=True gives no speedup and blocks chaining. Reassign instead.","fix":"unsafe","since":null}

A package or rule that does not exist fails with a message that names it. A client can ask the server to complete package and rule.