From 7f66c1c7a284ed15c198b770ef1c14a11daa99a8 Mon Sep 17 00:00:00 2001 From: Vitaly Bogdanov Date: Thu, 16 Mar 2023 16:54:25 +0300 Subject: [PATCH 1/5] Adding unsafe, FIXME and TODO rules into code style section --- CONTRIBUTING.md | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 19acda1b3..291a8b701 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -22,8 +22,8 @@ is less than 73 character long. Such commits looks better in GitHub history. Please don't include number and description of the issue into a commit summary -line. Use `Fixes #` in the pull request description to link the -PR to the issue. +line. Use `Fixes #` in the pull request description instead +to link the PR and the issue. PR should satisfy the following requirement before being merged: - contain latest changes from the repo; @@ -34,5 +34,24 @@ Feel free to raise draft PR if you need an advice or help with your changes. ## Code style -We have no specific code style rules for now. Please take a look at the -existing code and stick to its style. +We have small set of code style rules for now. The rule of thumb is to take a look +at the existing code and stick to its style. + +### General + +If you want to leave some reminder in code, for example to fix somthing later, +you can do it by two ways. Add a comment starting with `FIXME` to mark something +which should be done before the PR is merged. Add a comment starting with `TODO` +to mark the improvement which can be postponed and done later by a separate PR. +Main purpose of `TODO` comment is to trigger a developer who looks at the code +after you and make him fix the issue if it is apropriate. If change or question +is big enough or it affects the API of the module it is better to raise an issue +instead. + +### Rust + +When working on Rust C API prefere making `unsafe` blocks as small as possible. +It allows easily detect blocks which can be a source of issues. Usually it is +not required to mark C API functions `unsafe` because they are not intended to +be used from the Rust safe code. + From 064e91ee2da27335b3fb1eeca4b9f90698b689c2 Mon Sep 17 00:00:00 2001 From: Vitaly Bogdanov Date: Thu, 16 Mar 2023 22:25:46 +0300 Subject: [PATCH 2/5] Fix typo Co-authored-by: Anatoly Belikov --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 291a8b701..ca4df42ff 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -39,7 +39,7 @@ at the existing code and stick to its style. ### General -If you want to leave some reminder in code, for example to fix somthing later, +If you want to leave some reminder in code, for example to fix something later, you can do it by two ways. Add a comment starting with `FIXME` to mark something which should be done before the PR is merged. Add a comment starting with `TODO` to mark the improvement which can be postponed and done later by a separate PR. From c22384e4bc5732ce489e3f339307d4a4590d42b7 Mon Sep 17 00:00:00 2001 From: Vitaly Bogdanov Date: Thu, 16 Mar 2023 22:26:08 +0300 Subject: [PATCH 3/5] Fix typo Co-authored-by: Anatoly Belikov --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ca4df42ff..e9184a160 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -50,7 +50,7 @@ instead. ### Rust -When working on Rust C API prefere making `unsafe` blocks as small as possible. +When working on Rust C API prefer making `unsafe` blocks as small as possible. It allows easily detect blocks which can be a source of issues. Usually it is not required to mark C API functions `unsafe` because they are not intended to be used from the Rust safe code. From ad73d0961f50c8f5b3d739add2ffd031b40c9f56 Mon Sep 17 00:00:00 2001 From: Vitaly Bogdanov Date: Thu, 16 Mar 2023 23:49:59 +0300 Subject: [PATCH 4/5] Change wording Co-authored-by: Anatoly Belikov --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e9184a160..835608811 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -51,7 +51,7 @@ instead. ### Rust When working on Rust C API prefer making `unsafe` blocks as small as possible. -It allows easily detect blocks which can be a source of issues. Usually it is +This makes it easier to find blocks that might be source of issues. Usually it is not required to mark C API functions `unsafe` because they are not intended to be used from the Rust safe code. From d9dedf03065739904719a7d13c38e7f7cf30b055 Mon Sep 17 00:00:00 2001 From: Vitaly Bogdanov Date: Fri, 17 Mar 2023 12:02:36 +0300 Subject: [PATCH 5/5] Fix errors Co-authored-by: Nil Geisweiller --- CONTRIBUTING.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 835608811..facc072a9 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -43,10 +43,10 @@ If you want to leave some reminder in code, for example to fix something later, you can do it by two ways. Add a comment starting with `FIXME` to mark something which should be done before the PR is merged. Add a comment starting with `TODO` to mark the improvement which can be postponed and done later by a separate PR. -Main purpose of `TODO` comment is to trigger a developer who looks at the code -after you and make him fix the issue if it is apropriate. If change or question -is big enough or it affects the API of the module it is better to raise an issue -instead. +The main purpose of a `TODO` comment is to trigger a developer who looks at the +code after you and make him fix the issue if it is appropriate. If the change or +question is big enough or it affects the API of the module it is better to raise +an issue instead. ### Rust