---
schema_version: "1"
id: d989172e12f70ff135ebf861232442af79e853e5c245e98119affe8f7b77de01
title: Rules Output Schemas
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/code-analyzer/salesforce-code-analyzer/guides/output-schemas-rules.md
canonical_url: https://developer.salesforce.com/docs/platform/salesforce-code-analyzer/guide/output-schemas-rules.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: de7801ff3c82581c653083c85e80e1f0ad2c5cfed90a83b496a976f6fa11848c
products:
  - Salesforce Code Analyzer
---
# Rules Output Schemas

When you list the rules that are available to scan your code with the `code-analyzer rules` command, use the `--output-file` flag to write the results to a file. The format of the file depends on the extension you specify; valid values are `.json` and `.csv`. If you don't specify the `--output-file` flag, then you get human-readable output displayed in the terminal. Use `--output-file` and `--view` together to get both an output file and the human-readable results in the terminal.

This command, for example, writes the results to a JSON-formatted file.

```bash
sf code-analyzer rules --output-file results.json
```

See these reference docs for details about the output schemas for the `rules` command:

- [JSON](https://developer.salesforce.com/docs/platform/salesforce-code-analyzer/guide/output-schemas-json-rules.md)
- [CSV](https://developer.salesforce.com/docs/platform/salesforce-code-analyzer/guide/output-schemas-csv-rules.md)
