Skip to content

Commit 56ceccc

Browse files
authored
Merge pull request #420 from secvisogram/chore/347-document-use-of-quotes
chore(documentation): #347 document use of quotes in strings
2 parents 3c86c70 + f163fbb commit 56ceccc

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

DEVELOPMENT.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Developing CSAF Validator Lib
2+
3+
## Table of Contents
4+
- [Code Style](#code-style)
5+
- [Formatting with prettier](#formatting-with-prettier)
6+
- [Quoting Strings](#quoting-strings)
7+
8+
9+
## Code Style
10+
11+
### Formatting with prettier
12+
13+
JavaScript code must be formatted with Prettier before it can be pushed to the repository.
14+
A prettier.config.cjs is provided.
15+
16+
### Quoting Strings
17+
18+
Strings have to be quoted in the following way:
19+
20+
- **Single quotes ''**
21+
- We use `''` (single quotes) when the string has no expressions inside.
22+
23+
- **Template literals (backticks)**
24+
- We use ` `` ` (template literals) when there is an expression to resolve in the string, e.g. ${metricIndex}
25+
26+
- **Quotation mark in string**
27+
- We use `""` (double quotation marks) in strings to mark text in messages
28+
29+
**Examples:**
30+
31+
Simple Message:
32+
33+
```
34+
message: 'value is not consistent with the vector string',
35+
```
36+
37+
Message with expression inside
38+
39+
```
40+
message: `branch structure nesting exceeds "${MAX_DEPTH}" branches (it is ${count} levels deep)`
41+
```
42+
43+
Message with "" inside
44+
45+
```
46+
message:
47+
'the ssvc id does neither match the "cve" nor it '+
48+
'matches the "text" of any item in the "ids" array',
49+
```

0 commit comments

Comments
 (0)