Skip to content

Commit 7f7e285

Browse files
committed
Make steps more concrete on how to contribute.
1 parent 4f0f9fe commit 7f7e285

File tree

2 files changed

+80
-56
lines changed

2 files changed

+80
-56
lines changed

GOALS.md

Lines changed: 25 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,42 @@
1-
# Overview
1+
# Goals
22

33
## Elevator pitch
44

5-
Coding guidelines are available within this repository, potentially deployed to a website mdBook-style.
5+
We will make Rust coding guidelines are available within this repository, deployed to an accessible location on the internet which comply with relevant standards for various safety-critical industries such as: IEC 61508, ISO 26262, and DO 178.
66

77
## Detailed
88

9-
In general these coding guidelines should be a set of rules of do / do not do with examples which should cover all "general" aspects of the Rust programming language, e.g. enums, structs, traits, and so on. We can use the [FLS](https://rust-lang.github.io/fls/index.html) as a means to ensure we have reasonable coverage of the language.
10-
11-
There should be an addendum which covers how various safety standards like ISO 26262 map onto the coding guidelines.
12-
13-
This serves as a tracking issue which is why it's considered "XL". Work will get logged against this in smaller chunks!
14-
15-
# Way of work
16-
17-
## Outline & issue breakdown
9+
In general these coding guidelines will be a set of rules of do / do not do with examples which should cover all "general" aspects of the Rust programming language, e.g. enums, structs, traits, and so on. We will use the [FLS](https://rust-lang.github.io/fls/index.html) as a means to ensure we have reasonable coverage of the language.
1810

19-
We will use the Coding Guidelines Work Items [board](https://github.com/orgs/rustfoundation/projects/1) as a means to break the work down into smaller chunks that can be tackled in a reasonable manner.
11+
There will be an addendum which covers how various safety standards like ISO 26262 map onto the coding guidelines.
2012

21-
## Contribution of existing guidelines
22-
23-
We are very open to receiving contributed coding guidelines in whole or in part and wholly originally contributions based on learnings from past organizational experience using Rust in safety-critical projects.
24-
25-
## Contribution of a new guideline
26-
27-
A good first step is to open a new [coding guideline issue](https://github.com/rustfoundation/safety-critical-rust-coding-guidelines/issues/new?template=CODING-GUIDELINE.yml).
28-
29-
# Goals
13+
## Criteria
3014

31-
* Coding guidelines that make a "best effort" attempt at cataloging common pieces (e.g. functions, arithmetic, unsafe) of the Rust programming language and how they fit into a safety-critical project
15+
* We produce coding guidelines that make a "best effort" attempt at cataloging common pieces (e.g. functions, arithmetic, unsafe) of the Rust programming language and how they fit into a safety-critical project
3216
* We will use [MISRA Compliance: 2020](https://misra.org.uk/app/uploads/2021/06/MISRA-Compliance-2020.pdf) for categorization
33-
* Includes rationale with links to parts of the Rust Project and wider Rust community for guidance
34-
* Could later be refined according to various standards, e.g. DO 178 or ISO 26262
35-
* Practical recommendations on how to use this piece of the language
36-
* May include considerations of "what" is being built, e.g. broadly speaking library software: (potentially broke down further into low-level driver code, a framework system for real-time applications, SDKs) vs application software
37-
* Should be done in parallel with developing an addendum matrix to reduce burden of attaching these later
38-
* We can begin with DO 178 and ISO 26262 at perhaps chapter level, maybe subsection level _for now_ and expand later
39-
* Releases of the coding guidelines are released and tagged with the versions of stable Rust that they support (e.g. `1.42`)
40-
* Upstream Clippy lints which will cover decidable guidelines
41-
42-
## Goals obtained by discussion with Tooling Subcommittee
43-
44-
* Make a label for each which _in theory_ is decidable or not
45-
* Include for each guideline a minimum of one compliant and one non-compliant example of code, to help illustrate its exact meaning and context.
46-
* Consider only the language reference / spec, not the tooling availability when writing the coding guidelines
47-
* Guidelines should be evidence-based, with statistics around human error when programming Rust, to support:
17+
* We include a rationale with links to parts of the Rust Project and wider Rust community for guidance
18+
* We will include linkage where appropriate to to various standards, e.g. CERT C, MISRA C, DO 178, ISO 26262
19+
* We will include practical recommendations on how to use this piece of the language using compliant and non-compliant examples
20+
* We will develop an addendum matrix to reduce burden of attaching these later
21+
* We will begin with DO 178 and ISO 26262 at perhaps chapter level, maybe subsection level _for now_ and expand later
22+
* We will release the coding guidelines tagged with the versions of stable Rust that they support (e.g. `1.42`)
23+
* We will create Clippy lints which will cover decidable guidelines
24+
25+
### Criteria obtained by discussion with Tooling Subcommittee
26+
27+
* We will affix a label for each guideline, which describes whether said guideline is decidable or not (in the theory of computation sense)
28+
* We will include for each guideline a minimum of one compliant and one non-compliant example of code, to help illustrate its exact meaning and context.
29+
* We will consider only the language reference / spec, not the tooling availability when writing the coding guidelines
30+
* We aim to produce evidence-based guidelines, with statistics around human error when programming Rust, to support:
4831
1. What guidelines are written, and
4932
2. Why a specific suggestion was made
50-
* Produce the guidelines in an artifact that's easily machine readable and consistent format to make it easier to consume by tool vendors as a baseline (e.g. multiple JSON files, one per language piece, also potentially one large JSON concatenated together)
33+
* We will produce the guidelines in an artifact that's easily machine readable and consistent format to make it easier to consume by tool vendors as a baseline (e.g. multiple JSON files, one per language piece, also potentially one large JSON concatenated together)
5134

52-
# Non-goals
35+
# Explicit non-goals
5336

54-
* For the initial version to be complete coverage of the Rust programming languages pieces
55-
* "Something" shipped to alleviate pressure at organizations is better than "nothing available"
37+
* For the initial version to be complete coverage of the Rust programming language
38+
* "Something" shipped to alleviate pressure at organizations is better than "nothing is available" even if we have to heavily subset the language
5639
* For any version to be conflict-free with various members' or their organizations' viewpoints
57-
* Members and their organizations may take different stances on how pieces of the Rust programming language should be viewed and approached. This is **okay and expected**.
40+
* Members and their organizations may take different stances on how Rust programming language constructs should be viewed and approached. This is **okay and expected**.
5841
* We'd like to ship something that we can obtain broad consensus on.
5942
* Worst case scenario: there may be a section here or there which you may need to adjust in an internal version that'd downstream.

README.md

Lines changed: 55 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -103,40 +103,81 @@ Once you have completed the above steps, you will now update the local copy of t
103103

104104
Open a new PR with only the changes necessary to rationalize the guidelines with the new FLS text.
105105

106+
## Outline & issue breakdown
107+
108+
We will use the Coding Guidelines Work Items [board](https://github.com/orgs/rustfoundation/projects/1) as a means to break the work down into smaller chunks that can be tackled in a reasonable manner.
109+
110+
## Contribution of existing guidelines
111+
112+
We are very open to receiving contributed coding guidelines in whole or in part and wholly originally contributions based on learnings from past organizational experience using Rust in safety-critical projects.
113+
106114
## Contributing to the coding guidelines
107115

108116
See [CONTRIBUTING.md](CONTRIBUTING.md).
109117

110-
### Chapter layout mirrors Ferrocene Language Specification
118+
### Have an idea? Want to discuss it?
119+
120+
While not mandatory, sometimes you'd like to check into the feasiblity of a guideline or discuss it with others to ensure it's not overlapping an existing guideline. Feel free to drop by the Safety-Critical Rust Consortium's Zulip stream: [here](https://rust-lang.zulipchat.com/#narrow/channel/445688-safety-critical-consortium). Please open a new topic per coding guideline you'd like to discuss.
121+
122+
### Preamble: chapter layout mirrors Ferrocene Language Specification
111123

112124
We have the same chapter layout as the [Ferrocene Language Specification](https://spec.ferrocene.dev/) (FLS). If you would like to contribute you may find a section from the FLS of interest and then write a guideline in the corresponding chapter of these coding guidelines.
113125

114-
### Submit coding guideline issue
126+
### 1. Submit coding guideline issue
115127

116128
For a new coding guideline you'd like to contribute, start with opening a [coding guideline issue](https://github.com/rustfoundation/safety-critical-rust-coding-guidelines/issues/new?template=CODING-GUIDELINE.yml).
117129

118-
Once an issue has been well-developed enough it's then time to write up the guideline.
130+
#### 1.a Finding the FLS ID
119131

120-
### Guideline template
132+
Note that the FLS ID should be filled according to the FLS paragraph ID for which the guideline is covering. One way to go about finding this is to inspect the page using your web browser. You'll be looking for something like:
121133

122-
We have a script `./generate_guideline_templates.py` which assumes you're using `uv` that can be run to generate the template for a guideline with properly randomized IDs.
134+
```html
135+
<p><span class="spec-paragraph-id" id="fls_4rhjpdu4zfqj">4.1:1</span>
136+
```
123137

124-
You can the copy and paste this guideline from the command line into the correct chapter.
138+
You would then pull `fls_4rhjpdu4zfqj` to place in the FLS ID field.
125139

126-
### Filling out the guideline
140+
### 2. A subcommittee member reviews the coding guideline issue, works with you the contributor
127141

128-
Reference `src/conf.py` to see valid selections for unfilled options in the guideline template.
142+
A member of the Coding Guidelines Subcommittee should get you a first review with some feedback within 14 days of submission. You'll work with one or more members to flesh out the concept and ensure the guideline is well prepared.
129143

130-
Note that the `:fls:` option should be filled according to the FLS paragraph ID for which the guideline is covering. One way to go about finding this is to inspect the page using your web browser. You'll be looking for something like:
144+
### 3. A pull request is generated from the coding guideline issue
131145

132-
```html
133-
<p><span class="spec-paragraph-id" id="fls_4rhjpdu4zfqj">4.1:1</span>
134-
```
146+
Once an issue has been well-developed enough, a subcommittee member will mark the issue with the label `sign-off: create pr from issue` to generate a pull request. You will see a GitHub Workflow trigger and a pull request will be created momentarily.
147+
148+
### 4. Contributor responds to feedback given on pull request
135149

136-
You would then pull `fls_4rhjpdu4zfqj` to place in the `:fls:` option.
150+
The generated pull request may attract additional feedback or simply be an easier place to suggest targeted edits.
137151

138-
Existing guidelines can also serve as examples on how guidelines are filled.
152+
As the contributor of the coding guideline and opener of the issue, you'll respond to comments, discuss, all the normal things on the pull request.
139153

154+
### 5. Contributor applies updates to coding guidelines issue
155+
156+
If you agree with the suggested changes, rather than making changes on the opened pull request, you will return to the original issue you opened via the coding guideline issue template and make the updates there.
157+
158+
### 6. A subcommittee member generates new pull request contents from coding guidelines issue
159+
160+
When you have completed all feedback given to you, ping one of the subcommittee members. They will then remove and affix the label `sign-off: create pr from issue` to push the changes made in the issue to the already opened pull request.
161+
162+
### 7. A subcommittee member merges the coding guideline pull request
163+
164+
Once the coding guideline contents have passed review, a subcommittee member will approve the pull request, and put it on the merge queue to be merged.
165+
166+
### 8. You contributed a coding guideline
167+
168+
That's it!
169+
170+
## Writing a guideline locally (less typical, not recommended)
171+
172+
While it is possible to create guidelines locally and open pull requests yourself, we encourage contributors to make use of the process described above since it handled some of the fiddly details for you as a guideline writer.
173+
174+
Generally speaking, pull requests for guidelines which do not follow the issue to pull request workflow described above will be closed with a recommendation to follow the workflow.
175+
176+
### Guideline template
177+
178+
We have a script `./generate_guideline_templates.py` which assumes you're using `uv` that can be run to generate the template for a guideline with properly randomized IDs.
179+
180+
You can the copy and paste this guideline from the command line into the correct chapter.
140181

141182
## [Code of Conduct][code-of-conduct]
142183

0 commit comments

Comments
 (0)