Skip to content

Commit 7d8864f

Browse files
committed
Merge branch 'main' into feat/pointer-comparison-rule
2 parents 53cfab8 + dc61206 commit 7d8864f

160 files changed

Lines changed: 46186 additions & 21255 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/ISSUE_TEMPLATE/CODING-GUIDELINE.yml

Lines changed: 275 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ name: Coding Guideline
22
description: File a coding guideline of interest
33
title: "[Coding Guideline]: "
44
labels: ["coding guideline"]
5-
assignees:
6-
- PLeVasseur
5+
assignees: []
76
body:
87
- type: markdown
98
attributes:
@@ -122,8 +121,14 @@ body:
122121
id: amplification
123122
attributes:
124123
label: Amplification
125-
description: An Amplification is a chance to expand or clarify the Guideline's Title. Optional as needed. Normative. Rationale should not be entered here, but below in Rationale.
126-
placeholder: In particular, it's important to not `foo` when `bar` under typical conditions of `baz`
124+
description: |
125+
An Amplification is a chance to expand or clarify the Guideline's Title. Optional as needed. Normative. Rationale should not be entered here, but below in Rationale.
126+
127+
**Citing references:** To cite a bibliography entry, use `[CITATION-KEY]` syntax (e.g., `[RUST-REF-UNION]`). These will be automatically linked to your bibliography entries.
128+
placeholder: |
129+
In particular, it's important to not `foo` when `bar` under typical conditions of `baz`.
130+
131+
As documented in [RUST-REF-UNION], this behavior is undefined.
127132
validations:
128133
required: false
129134
- type: textarea
@@ -138,39 +143,291 @@ body:
138143
id: rationale
139144
attributes:
140145
label: Rationale
141-
description: Here we explain the why of this Coding Guideline. Should be as long or as short as needed. Non-normative.
142-
placeholder: As documented in the below reference, we see that under conditions `baz` if we `foo` when `bar`-ing we encounter suprising behavior `biz`. ...
146+
description: |
147+
Here we explain the why of this Coding Guideline. Should be as long or as short as needed. Non-normative.
148+
149+
**Citing references:** To cite a bibliography entry, use `[CITATION-KEY]` syntax (e.g., `[RUST-REF-UNION]`). These will be automatically linked to your bibliography entries.
150+
placeholder: |
151+
As documented in the below reference, we see that under conditions `baz` if we `foo` when `bar`-ing we encounter surprising behavior `biz`.
152+
153+
The Rust Reference [RUST-REF-UNION] explains this in detail.
143154
validations:
144155
required: true
156+
157+
# ==========================================================================
158+
# Non-Compliant Example 1 (Required)
159+
# ==========================================================================
160+
- type: markdown
161+
attributes:
162+
value: |
163+
---
164+
## Non-Compliant Examples
165+
166+
Provide at least one non-compliant example. You may add up to 4 total.
145167
- type: textarea
146-
id: non-compliant-example-prose
168+
id: non-compliant-example-prose-1
147169
attributes:
148-
label: Non-Compliant Example - Prose
170+
label: Non-Compliant Example 1 - Prose
149171
description: Here we write a textual description of why the Non-Compliant Example - Code exhibits unintended or consequential behavior. Non-normative.
150172
placeholder: As seen below in the `non_compliant_example()` function, when `baz` and `bar` are both active and we `foo`, later during refactoring it's possible to get `biz` instead of `boz` behavior. ...
151173
validations:
152174
required: true
153175
- type: textarea
154-
id: non-compliant-example-code
176+
id: non-compliant-example-code-1
155177
attributes:
156-
label: Non-Compliant Example - Code
157-
description: Here we write a code example showcasing the unintended or consequential behavior. Non-normative.
158-
placeholder: fn non_compliant_example() { /* ... */ }
178+
label: Non-Compliant Example 1 - Code
179+
description: |
180+
Code example showcasing the unintended or consequential behavior. Non-normative. Please wrap your code in a fenced code block with the `rust` language specifier.
181+
182+
**Hidden lines:** If your code needs `use` statements, a `fn main()` wrapper, or other boilerplate to compile, but you don't want them shown in the documentation, prefix those lines with `# ` (hash + space). These lines will be compiled but hidden in the rendered docs.
183+
184+
Example with hidden lines:
185+
````
186+
```rust
187+
# use std::mem::MaybeUninit;
188+
# fn main() {
189+
let x: u32 = unsafe { MaybeUninit::uninit().assume_init() }; // UB
190+
# }
191+
```
192+
````
193+
placeholder: |
194+
```rust
195+
# use std::collections::HashMap;
196+
# fn main() {
197+
let map = HashMap::new();
198+
# }
199+
```
159200
validations:
160201
required: true
202+
203+
# ==========================================================================
204+
# Non-Compliant Example 2 (Optional)
205+
# ==========================================================================
206+
- type: textarea
207+
id: non-compliant-example-prose-2
208+
attributes:
209+
label: Non-Compliant Example 2 - Prose (Optional)
210+
description: Additional non-compliant example prose. Leave empty if not needed.
211+
placeholder: Another scenario where this guideline is violated...
212+
validations:
213+
required: false
214+
- type: textarea
215+
id: non-compliant-example-code-2
216+
attributes:
217+
label: Non-Compliant Example 2 - Code (Optional)
218+
description: Additional non-compliant code example. Leave empty if not needed.
219+
placeholder: |
220+
```rust
221+
# fn main() {
222+
// Another non-compliant example
223+
# }
224+
```
225+
validations:
226+
required: false
227+
228+
# ==========================================================================
229+
# Non-Compliant Example 3 (Optional)
230+
# ==========================================================================
231+
- type: textarea
232+
id: non-compliant-example-prose-3
233+
attributes:
234+
label: Non-Compliant Example 3 - Prose (Optional)
235+
description: Additional non-compliant example prose. Leave empty if not needed.
236+
placeholder: Yet another scenario where this guideline is violated...
237+
validations:
238+
required: false
161239
- type: textarea
162-
id: compliant-example-prose
240+
id: non-compliant-example-code-3
163241
attributes:
164-
label: Compliant Example - Prose
242+
label: Non-Compliant Example 3 - Code (Optional)
243+
description: Additional non-compliant code example. Leave empty if not needed.
244+
placeholder: |
245+
```rust
246+
# fn main() {
247+
// Another non-compliant example
248+
# }
249+
```
250+
validations:
251+
required: false
252+
253+
# ==========================================================================
254+
# Non-Compliant Example 4 (Optional)
255+
# ==========================================================================
256+
- type: textarea
257+
id: non-compliant-example-prose-4
258+
attributes:
259+
label: Non-Compliant Example 4 - Prose (Optional)
260+
description: Additional non-compliant example prose. Leave empty if not needed.
261+
placeholder: A fourth scenario where this guideline is violated...
262+
validations:
263+
required: false
264+
- type: textarea
265+
id: non-compliant-example-code-4
266+
attributes:
267+
label: Non-Compliant Example 4 - Code (Optional)
268+
description: Additional non-compliant code example. Leave empty if not needed.
269+
placeholder: |
270+
```rust
271+
# fn main() {
272+
// Another non-compliant example
273+
# }
274+
```
275+
validations:
276+
required: false
277+
278+
# ==========================================================================
279+
# Compliant Example 1 (Required)
280+
# ==========================================================================
281+
- type: markdown
282+
attributes:
283+
value: |
284+
---
285+
## Compliant Examples
286+
287+
Provide at least one compliant example. You may add up to 4 total.
288+
- type: textarea
289+
id: compliant-example-prose-1
290+
attributes:
291+
label: Compliant Example 1 - Prose
165292
description: Here we write a textual description of why the Compliant Example - Code avoids unintended or consequential behavior by following the Coding Guideline.
166293
placeholder: As seen below in the `compliant_example()` function, when `baz` and `bar` are both active and we avoid doing `foo`, later during refactoring we've prevented an error by construction. ...
167294
validations:
168295
required: true
169296
- type: textarea
170-
id: compliant-example-code
297+
id: compliant-example-code-1
171298
attributes:
172-
label: Compliant Example - Code
173-
description: Here we write a code example showcasing we avoid unintended or consequential behavior by following the Coding Guideline.
174-
placeholder: fn compliant_example() { /* ... */ }
299+
label: Compliant Example 1 - Code
300+
description: |
301+
Code example showcasing we avoid unintended or consequential behavior by following the Coding Guideline. Please wrap your code in a fenced code block with the `rust` language specifier.
302+
303+
**Hidden lines:** If your code needs `use` statements, a `fn main()` wrapper, or other boilerplate to compile, but you don't want them shown in the documentation, prefix those lines with `# ` (hash + space). These lines will be compiled but hidden in the rendered docs.
304+
305+
Example with hidden lines:
306+
````
307+
```rust
308+
# use std::collections::HashMap;
309+
# fn main() {
310+
let mut map = HashMap::new();
311+
map.insert("key", "value"); // Compliant usage
312+
# }
313+
```
314+
````
315+
placeholder: |
316+
```rust
317+
# fn main() {
318+
let safe_value = 42u32; // Properly initialized
319+
# }
320+
```
175321
validations:
176322
required: true
323+
324+
# ==========================================================================
325+
# Compliant Example 2 (Optional)
326+
# ==========================================================================
327+
- type: textarea
328+
id: compliant-example-prose-2
329+
attributes:
330+
label: Compliant Example 2 - Prose (Optional)
331+
description: Additional compliant example prose. Leave empty if not needed.
332+
placeholder: Another way to comply with this guideline...
333+
validations:
334+
required: false
335+
- type: textarea
336+
id: compliant-example-code-2
337+
attributes:
338+
label: Compliant Example 2 - Code (Optional)
339+
description: Additional compliant code example. Leave empty if not needed.
340+
placeholder: |
341+
```rust
342+
# fn main() {
343+
// Another compliant example
344+
# }
345+
```
346+
validations:
347+
required: false
348+
349+
# ==========================================================================
350+
# Compliant Example 3 (Optional)
351+
# ==========================================================================
352+
- type: textarea
353+
id: compliant-example-prose-3
354+
attributes:
355+
label: Compliant Example 3 - Prose (Optional)
356+
description: Additional compliant example prose. Leave empty if not needed.
357+
placeholder: Yet another way to comply with this guideline...
358+
validations:
359+
required: false
360+
- type: textarea
361+
id: compliant-example-code-3
362+
attributes:
363+
label: Compliant Example 3 - Code (Optional)
364+
description: Additional compliant code example. Leave empty if not needed.
365+
placeholder: |
366+
```rust
367+
# fn main() {
368+
// Another compliant example
369+
# }
370+
```
371+
validations:
372+
required: false
373+
374+
# ==========================================================================
375+
# Compliant Example 4 (Optional)
376+
# ==========================================================================
377+
- type: textarea
378+
id: compliant-example-prose-4
379+
attributes:
380+
label: Compliant Example 4 - Prose (Optional)
381+
description: Additional compliant example prose. Leave empty if not needed.
382+
placeholder: A fourth way to comply with this guideline...
383+
validations:
384+
required: false
385+
- type: textarea
386+
id: compliant-example-code-4
387+
attributes:
388+
label: Compliant Example 4 - Code (Optional)
389+
description: Additional compliant code example. Leave empty if not needed.
390+
placeholder: |
391+
```rust
392+
# fn main() {
393+
// Another compliant example
394+
# }
395+
```
396+
validations:
397+
required: false
398+
399+
# ==========================================================================
400+
# Bibliography (Optional)
401+
# ==========================================================================
402+
- type: markdown
403+
attributes:
404+
value: |
405+
---
406+
## Bibliography (Optional)
407+
408+
Add references to external sources that support your guideline.
409+
Use standard Markdown reference link syntax, then cite with `[CITATION-KEY]` in your text.
410+
411+
**Example - defining references:**
412+
```
413+
[RUST-REF-UNION]: https://doc.rust-lang.org/reference/items/unions.html "The Rust Reference | Unions"
414+
[CERT-C-INT34]: https://wiki.sei.cmu.edu/confluence/x/ItcxBQ "SEI CERT C | INT34-C. Do not shift by negative bits"
415+
```
416+
417+
**Example - citing in your Amplification or Rationale:**
418+
```
419+
As documented in [RUST-REF-UNION], unions require unsafe access.
420+
```
421+
- type: textarea
422+
id: bibliography
423+
attributes:
424+
label: Bibliography
425+
description: |
426+
Use Markdown reference link syntax: `[KEY]: URL "Author | Title"`
427+
428+
Citation keys must be UPPERCASE-WITH-HYPHENS, start with a letter, max 50 chars.
429+
placeholder: |
430+
[RUST-REF-UNION]: https://doc.rust-lang.org/reference/items/unions.html "The Rust Reference | Unions"
431+
[CERT-C-INT34]: https://wiki.sei.cmu.edu/confluence/x/ItcxBQ "SEI CERT C | INT34-C. Do not shift by negative bits"
432+
validations:
433+
required: false

0 commit comments

Comments
 (0)