Debian Codegraph @

CONTRIBUTING.md

raw symbols SCIP
1
2 # Contribution Guide
3
4
5 ## Before contributing code
6
7 As with many open source projects, we use the GitHub [issue
8 tracker](https://github.com/cue-labs/oci/issues) to not only track bugs, but
9 also coordinate work on new features, bugs, designs and proposals. Given the
10 inherently distributed nature of open-source this coordination is important
11 because it very often serves as the main form of communication between
12 contributors.
13
14 You can also exchange ideas or feedback with other contributors via the CUE
15 project's `#contributing` [Slack
16 channel](https://cuelang.slack.com/archives/CMY132JKY), as well as the
17 contributor office hours calls which we hold via the [community
18 calendar](https://cuelang.org/s/community-calendar) once per week.
19
20 ### Check the issue tracker
21
22 Whether you already know what contribution to make, or you are searching for an
23 idea, the [issue tracker](https://github.com/cue-labs/oci/issues) is always the
24 first place to go. Issues are triaged to categorize them and manage the
25 workflow.
26
27 TODO: add detail on how we label and categorise issues.
28
29 ### Open an issue for any new problem
30
31 Excluding very trivial changes, all contributions should be connected to an
32 existing issue. Feel free to open one and discuss your plans. This process
33 gives everyone a chance to validate the design, helps prevent duplication of
34 effort, and ensures that the idea fits inside the goals for the language and
35 tools. It also checks that the design is sound before code is written; the code
36 review tool is not the place for high-level discussions.
37
38 Sensitive security-related issues should be reported to <a
39 href="mailto:[email protected]">[email protected]</a>.
40
41 ## Becoming a code contributor
42
43 The code contribution process used by the this project, like the [CUE
44 project](https://cuelang.org), is a little different from that used by other
45 open source projects. We assume you have a basic understanding of
46 [`git`](https://git-scm.com/) and [Go](https://golang.org) (1.21 or later).
47
48 The first thing to decide is whether you want to contribute a code change via
49 GitHub or GerritHub. Both workflows are fully supported, and whilst GerritHub is
50 used by the core project maintainers as the "source of truth", the GitHub Pull
51 Request workflow is 100% supported - contributors should feel entirely
52 comfortable contributing this way if they prefer.
53
54 Contributions via either workflow must be accompanied by a Developer Certificate
55 of Origin.
56
57 ### Asserting a Developer Certificate of Origin
58
59 Contributions must be accompanied by a [Developer Certificate of
60 Origin](https://developercertificate.org/), we are using version 1.1.
61
62 All commit messages must contain the `Signed-off-by` line with an email address
63 that matches the commit author. This line asserts the Developer Certificate of Origin.
64
65 When committing, use the `--signoff` (or `-s`) flag:
66
67 ```console
68 $ git commit -s
69 ```
70
71 You can also [set up a prepare-commit-msg git
72 hook](#do-i-really-have-to-add-the--s-flag-to-each-commit) to not have to supply
73 the `-s` flag.
74
75 The explanations of the GitHub and GerritHub contribution workflows that follow
76 assume all commits you create are signed-off in this way.
77
78
79 ## Preparing for GitHub Pull Request (PR) Contributions
80
81 TODO: add detail.
82
83 ## Preparing for GerritHub [CL](https://google.github.io/eng-practices/#terminology) Contributions
84
85 TODO: add detail.
86
87 ## Good commit messages
88
89 Commit messages follow a specific set of conventions, which we discuss in this
90 section.
91
92 Here is an example of a good one taken from the [CUE
93 project](https://cuelang.org):
94
95
96 ```
97 cue/ast/astutil: fix resolution bugs
98
99 This fixes several bugs and documentation bugs in
100 identifier resolution.
101
102 1. Resolution in comprehensions would resolve identifiers
103 to themselves.
104
105 2. Label aliases now no longer bind to references outside
106 the scope of the field. The compiler would catch this invalid
107 bind and report an error, but it is better not to bind in the
108 first place.
109
110 3. Remove some more mentions of Template labels.
111
112 4. Documentation for comprehensions was incorrect
113 (Scope and Node were reversed).
114
115 5. Aliases X in `X=[string]: foo` should only be visible
116 in foo.
117
118 Fixes #946
119 ```
120
121 ### First line
122
123 The first line of the change description is conventionally a short one-line
124 summary of the change, prefixed by the primary affected package
125 (`cue/ast/astutil` in the example above).
126
127 A rule of thumb is that it should be written so to complete the sentence "This
128 change modifies CUE to \_\_\_\_." That means it does not start with a capital
129 letter, is not a complete sentence, and actually summarizes the result of the
130 change.
131
132 Follow the first line by a blank line.
133
134
135 ### Main content
136
137 The rest of the description elaborates and should provide context for the change
138 and explain what it does. Write in complete sentences with correct punctuation,
139 just like for your comments. Don't use HTML, Markdown, or any other markup
140 language.
141
142
143 ### Referencing issues
144
145 The special notation `Fixes #12345` associates the change with issue 12345 in
146 the [issue tracker](https://github.com/cue-labs/oci/issue/12345) When this
147 change is eventually applied, the issue tracker will automatically mark the
148 issue as fixed.
149
150
151 If the change is a partial step towards the resolution of the issue, uses the
152 notation `Updates #12345`. This will leave a comment in the issue linking back
153 to the change in Gerrit, but it will not close the issue when the change is
154 applied.
155
156
157 All issues are tracked in the main repository's issue tracker.
158 If you are sending a change against a subrepository, you must use the
159 fully-qualified syntax supported by GitHub to make sure the change is linked to
160 the issue in the main repository, not the subrepository (eg. `Fixes
161 cue-lang/cue#999`).
162
163
164 ## The review process
165
166 TODO: add detail.
167
168 ## Miscellaneous topics
169
170 This section collects a number of other comments that are outside the
171 issue/edit/code review/submit process itself.
172
173
174
175 ### Copyright headers
176
177 TODO: add detail.
178
179 ### Do I really have to add the `-s` flag to each commit?
180
181 Earlier in this guide we explained the role the [Developer Certificate of
182 Origin](https://developercertificate.org/) plays in contributions to the CUE
183 project. we also explained how `git commit -s` can be used to sign-off each
184 commit. But:
185
186 * it's easy to forget the `-s` flag;
187 * it's not always possible/easy to fix up other tools that wrap the `git commit`
188 step.
189
190 You can automate the sign-off step using a [`git`
191 hook](https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks). Run the
192 following commands in the root of a `git` repository where you want to
193 automatically sign-off each commit:
194
195 ```
196 cat <<'EOD' > .git/hooks/prepare-commit-msg
197 #!/bin/sh
198
199 NAME=$(git config user.name)
200 EMAIL=$(git config user.email)
201
202 if [ -z "$NAME" ]; then
203 echo "empty git config user.name"
204 exit 1
205 fi
206
207 if [ -z "$EMAIL" ]; then
208 echo "empty git config user.email"
209 exit 1
210 fi
211
212 git interpret-trailers --if-exists doNothing --trailer \
213 "Signed-off-by: $NAME <$EMAIL>" \
214 --in-place "$1"
215 EOD
216 chmod +x .git/hooks/prepare-commit-msg
217 ```
218
219 If you already have a `prepare-commit-msg` hook, adapt it accordingly. The `-s`
220 flag will now be implied every time a commit is created.
221
222
223
224 ## Code of Conduct
225
226 We follow guidelines for participating in CUE community spaces and a reporting
227 process for handling issues can be found in the [Code of
228 Conduct](https://cuelang.org/docs/contribution_guidelines/conduct).