Skip to content

Commit 5e7c902

Browse files
authored
Merge pull request #94 from linux-credentials/contributor-guide
Add contributor guide
2 parents 469dfff + e972821 commit 5e7c902

File tree

2 files changed

+203
-0
lines changed

2 files changed

+203
-0
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# [unreleased]
2+
3+
## Breaking Changes
4+
5+
None.
6+
7+
## Improvements
8+
9+
- Initial release.

CONTRIBUTING.md

Lines changed: 194 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,194 @@
1+
Welcome! Thanks for looking into contributing to our project!
2+
3+
# Table of Contents
4+
5+
- [Ways to Contribute](#ways-to-contribute)
6+
- [Looking for Help?](#looking-for-help)
7+
- [Documentation](#documentation)
8+
- [Reporting Issues](#reporting-issues)
9+
- [Submitting Code](#submitting-code)
10+
- [Building](#building)
11+
- [Coding Style](#coding-style)
12+
- [Submitting PRs](#submitting-prs)
13+
- [Where do I start?](#where-do-i-start)
14+
- [Testing](#testing)
15+
16+
# Ways to Contribute
17+
18+
This document below primarily focuses on writing code for this
19+
project, but there are many different ways you can help out:
20+
21+
- **Testing**: We only have access to a limited set of hardware and accounts.
22+
Installing the project and using it yourself is a great way to get us more
23+
feedback to improve the project.
24+
25+
- **Writing UI implementations**: The UI included in this document is for reference
26+
purposes. We need developers who are familiar with (or willing to learn about)
27+
the specifics of integrating with particular desktop environments, like GNOME,
28+
KDE, etc.
29+
30+
- **Writing documentation**: Documentation is always hard. If you notice
31+
something missing or incorrect, then feel free to ask a question about it or
32+
send a pull request to address it.
33+
34+
- **Sponsorship**: We haven't set up any sort of platform to receive monetary
35+
donations, but if you are interested, you can reach out by filing an issue,
36+
and we can see what we can do. Individual sponsorships are not the only way to
37+
support the project: getting us in touch with companies or foundations
38+
offering grants for open source or hardware for testing is also helpful.
39+
40+
- **Spread the word**: We believe that this project is important to get in the hands
41+
of users. Whether you can help or not, telling others about the project and
42+
asking them to get involved is another way you can help!
43+
44+
And then there is, of course, writing code!
45+
46+
# Looking for Help?
47+
48+
Here is a list of helpful resources you can consult:
49+
50+
## Documentation
51+
52+
To help you get started, we have provided documentation for various parts of the
53+
project. Take a look at these:
54+
55+
- [credentialsd API Specification](/doc/api.md)
56+
- [ARCHITECTURE.md](/ARCHITECTURE.md), our architecture guide.
57+
- [BUILDING.md](/BUILDING.md)
58+
59+
You may also need to consult various specifications while developing.
60+
61+
- [WebAuthn (Level 3) Specification](https://www.w3.org/TR/webauthn-3/)
62+
- [CTAP 2.2 Specification](https://fidoalliance.org/specs/fido-v2.2-ps-20250714/fido-client-to-authenticator-protocol-v2.2-ps-20250714.html)
63+
64+
# Reporting Issues
65+
66+
If you find any bugs, inconsistencies or other problems, feel free to submit
67+
a GitHub [issue](https://github.com/linux-credentials/credentialsd/issues/new).
68+
69+
Also, if you have trouble getting on board, let us know so we can help future
70+
contributors to the project overcome that hurdle too.
71+
72+
## Security Issues
73+
74+
If you are reporting a security issue, please review
75+
[`SECURITY.md`](/SECURITY.md) for the prodedure to follow.
76+
77+
# Submitting Code
78+
79+
Ready to write some code? Great! Here are some guidelines to follow to
80+
help you on your way:
81+
82+
## Building
83+
84+
When you first start making changes, make sure you can build the code and run
85+
the tests.
86+
87+
To build the project, follow the build instructions in [`BUILDING.md`](/BUILDING.md).
88+
89+
To run tests, follow the [test instructions](/BUILDING.md#running-tests) in the
90+
same file.
91+
92+
## Coding Style
93+
94+
In general, try to replicate the coding style that is already present. Specifically:
95+
96+
### Naming
97+
98+
For internal consistency, credentialsd uses `snake_case` for D-Bus field names
99+
and `SCREAMING_SNAKE_CASE` for enum values. This is consistent with D-Bus
100+
conventions, but it is distinct from Web Credential Management/WebAuthn
101+
conventions, which this API is based on. Values specified within JSON string
102+
payloads should stick to the naming conventions as documented in the WebAuthn
103+
spec.
104+
105+
### Code Formatting and Linting
106+
107+
For Rust code, we use [rustfmt][] to ensure consistent formatting code and
108+
[clippy][] to catch common mistakes not caught by the compiler.
109+
110+
```sh
111+
# if you don't have them installed, install or update the stable toolchain
112+
rustup install stable
113+
# … and install prebuilt rustfmt and clippy executables (available for most platforms)
114+
rustup component add rustfmt clippy
115+
```
116+
117+
Before committing your changes, run `cargo fmt` to format the code (if your
118+
editor / IDE isn't set up to run it automatically) and `cargo clippy` to run
119+
lints. You'll need to run this from each Cargo project (`credentialsd/`,
120+
`credentialsd-ui/`, `credentialsd-common/`).
121+
122+
For Python code, we use [ruff][].
123+
124+
[rustfmt]: https://github.com/rust-lang/rustfmt#readme
125+
[clippy]: https://github.com/rust-lang/rust-clippy#readme
126+
[ruff]: https://docs.astral.sh/ruff/installation/
127+
128+
### Import Formatting
129+
130+
Organize your imports into three groups separated by blank lines:
131+
132+
1. `std` imports
133+
1. External imports (from other crates)
134+
1. Local imports (`crate::`, `super::`, `self::` and things like `LocalEnum::*`)
135+
136+
For example,
137+
138+
```rust
139+
use std::collections::HashMap;
140+
141+
use credentialsd_common::model::Operation;
142+
143+
use super::MyType;
144+
```
145+
146+
### Commit Messages
147+
148+
The commit message should start with the _area_ that is affected by the change, which is usually the name of the folder withouth the `credentialsd-` prefix. The exception is `credentialsd/` itself, which should use `daemon`.
149+
150+
Write commit messages using the imperative mood, as if completing the sentence:
151+
"If applied, this commit will \_\_\_." For example, use "Fix some bug" instead
152+
of "Fixed some bug" or "Add a feature" instead of "Added a feature".
153+
154+
Some examples:
155+
156+
- "daemon: Allow clients to cancel their own requests"
157+
- "ui: Allow users to go back to device selection"
158+
159+
(Take a look at this [blog post][commit-messages-guide] for more information on
160+
writing good commit messages.)
161+
162+
[commit-messages-guide]: https://www.freecodecamp.org/news/writing-good-commit-messages-a-practical-guide/
163+
164+
### Tracking Changes
165+
166+
For bug fixes, breaking changes and improvements add an entry about them to the
167+
[changelog](/CHANGELOG.md).
168+
169+
If your changes affect the the public D-Bus API (Gateway, Flow Control or UI
170+
Control APIs), also make sure to document the change in [doc/api.md](/doc/api.md) and
171+
add a note to the [revision history](/doc/api.md#revision-history) in that file.
172+
173+
## Submitting PRs
174+
175+
Once you're ready to submit your code, create a pull request, and one of our
176+
maintainers will review it. Once your PR has passed review, a maintainer will
177+
merge the request and you're done! 🎉
178+
179+
## Where do I start?
180+
181+
If this is your first contribution to the project, we recommend taking a look
182+
at one of the [open issues][] we've marked for new contributors.
183+
184+
[open issues]: https://github.com/linux-credentials/credentialsd/issues?q=is%3Aissue+is%3Aopen+label%3A"help+wanted"
185+
186+
# Testing
187+
188+
Before committing, run `meson test --interactive` from the `build/` directory to
189+
make sure that your changes can build and pass all tests, as well as running the
190+
formatting and linting tools [mentioned above](#code-formatting-and-linting).
191+
192+
You should also follow the install instructions in [`BUILDING.md`](/BUILDING.md)
193+
and execute authentication flows in a browser to ensure that everything
194+
still works as it should.

0 commit comments

Comments
 (0)