Skip to content

Commit 1d1cad0

Browse files
committed
docs(ls): document the rule name validation and metadata validation features.
1 parent 0c19747 commit 1d1cad0

File tree

2 files changed

+43
-10
lines changed

2 files changed

+43
-10
lines changed

ls/editors/code/README.md

Lines changed: 43 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,50 @@ An image is worth a thousand words...
4545

4646
## Configuration
4747

48-
This extension respects the standard Visual Studio Code settings for formatting and other editor features. There are no YARA-X specific settings at this time.
49-
50-
The extension contributes the following default settings for the `[yara]` language:
48+
This extension provides configurations through VSCode's configuration settings. All configurations are under `YARA.*`.
5149

5250
```json
53-
"[yara]": {
54-
"editor.tabSize": 4,
55-
"editor.insertSpaces": false,
56-
"editor.detectIndentation": false,
57-
"editor.formatOnSave": true
58-
}
51+
"YARA.ruleNameValidation": "^APT_.+$",
52+
"YARA.metadataValidation": [
53+
{
54+
"identifier": "author",
55+
"required": true,
56+
"type": "string"
57+
},
58+
{
59+
"identifier": "version",
60+
"required": true,
61+
"type": "integer"
62+
}
63+
]
5964
```
6065

61-
You can override these in your user or workspace settings.
66+
### `YARA.ruleNameValidation`
67+
68+
Type: `string`
69+
Default: `""` (no validation)
70+
71+
A regular expression that rule names must conform to. If a rule name does not match this pattern, a warning will be
72+
generated.
73+
74+
### `YARA.metadataValidation`
75+
76+
Type: `array` of objects
77+
Default: `[]` (no validation)
78+
79+
An array of objects, where each object defines validation rules for a specific metadata field. Each object can have
80+
the following properties:
81+
82+
* `identifier` (string, required): The name of the metadata field to validate (e.g., `author`, `version`).
83+
* `required` (boolean, optional): If `true`, the metadata field must be present in the rule. Defaults to `false`.
84+
* `type` (string, optional): Specifies the expected type of the metadata value. Valid values are
85+
`"string"`, `"integer"`, `"float"`, and `"bool"`. If the value does not match the specified type, a warning will
86+
be generated.
87+
88+
For accessing these settings go to the Settings
89+
90+
<p align="center">
91+
<img src="images/settings.gif" width="95%" alt="Demo">
92+
<br/>
93+
<em>(Demo)</em>
94+
</p>
908 KB
Loading

0 commit comments

Comments
 (0)