Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean consecutive empty /// lines and implement a checkpatch.pl check for it #1109

Open
ojeda opened this issue Aug 31, 2024 · 5 comments
Open
Labels
• docs Related to `Documentation/rust/`, `samples/`, generated docs, doctests, typos... easy Expected to be an easy issue to resolve. good first issue Good for newcomers

Comments

@ojeda
Copy link
Member

ojeda commented Aug 31, 2024

Clean up consecutive empty /// lines and implement a checkpatch.pl check for it. These should be two different patches.

At the time of writing, there are a couple instances at rust/kernel/rbtree.rs and rust/kernel/block/mq/request.rs.

Please note that the checkpatch.pl maintainers will need to agree to the change.


This requires submitting a proper patch to the LKML and the Rust for Linux mailing list. Please recall to test your changes (including generating the documentation if changed, running the Rust doctests if changed, etc.), to use a proper title for the commit, to sign your commit under the Developer's Certificate of Origin and to add a Suggested-by: tag and a Link: tag to this issue. Please see https://rust-for-linux.com/contributing for details.

Please take this issue only if you are new to the kernel development process and you would like to use it as a test to submit your first patch to the kernel. Please do not take it if you do not plan to make other contributions to the kernel.

@ojeda ojeda added • docs Related to `Documentation/rust/`, `samples/`, generated docs, doctests, typos... good first issue Good for newcomers labels Aug 31, 2024
@hrideshmg
Copy link

hrideshmg commented Sep 8, 2024

Hi there! Would love to give this a go. Thanks for creating these for us beginners :)

intel-lab-lkp pushed a commit to intel-lab-lkp/linux that referenced this issue Sep 9, 2024
Remove unnecessary empty `\\\` lines in the rust docs. Also add linebreaks
in kernel::block::mq::Request to fix formatting

Suggested-by: Miguel Ojeda <ojeda@kernel.org>
Link: Rust-for-Linux#1109
Signed-off-by: hridesh <hridesh699@gmail.com>
@ojeda
Copy link
Member Author

ojeda commented Sep 10, 2024

intel-lab-lkp pushed a commit to intel-lab-lkp/linux that referenced this issue Sep 11, 2024
Remove unnecessary empty `///` lines in the rust docs.

Suggested-by: Miguel Ojeda <ojeda@kernel.org>
Link: Rust-for-Linux#1109
Signed-off-by: Hridesh MG <hridesh699@gmail.com>
intel-lab-lkp pushed a commit to intel-lab-lkp/linux that referenced this issue Sep 11, 2024
Add a check to warn if there are consecutive empty `///` lines in rust
files.

Suggested-by: Miguel Ojeda <ojeda@kernel.org>
Link: Rust-for-Linux#1109
Signed-off-by: Hridesh MG <hridesh699@gmail.com>
@leonardotomascostadasilva

Wouldn't it be interesting to add a check whether a line has actually been added or modified? This would reduce checking for non-relevant lines

Something like that?

if ($realfile =~ /\.rs$/ && $line_type eq 'added') {
    if ($rawline =~ /^\+\s*\/\/\/$/ && $prevrawline =~ /^\+\s*\/\/\/$/) {
			WARN("RUST_DOC_EMPTY",
			     "avoid using consecutive empty rustdoc comments\n" . $herecurr);
    }
}
```

@hrideshmg
Copy link

This is already included in the regex that matches $rawline; it will only match lines in the diff that begin with a '+', implying that a line was added.

intel-lab-lkp pushed a commit to intel-lab-lkp/linux that referenced this issue Sep 16, 2024
Remove unnecessary empty `///` lines in the rust docs.

Suggested-by: Miguel Ojeda <ojeda@kernel.org>
Link: Rust-for-Linux#1109
Signed-off-by: Hridesh MG <hridesh699@gmail.com>
intel-lab-lkp pushed a commit to intel-lab-lkp/linux that referenced this issue Sep 16, 2024
Add a check to warn if there are consecutive empty `///` lines in rust
files.

Suggested-by: Miguel Ojeda <ojeda@kernel.org>
Link: Rust-for-Linux#1109
Signed-off-by: Hridesh MG <hridesh699@gmail.com>
@leonardotomascostadasilva

This is already included in the regex that matches $rawline; it will only match lines in the diff that begin with a '+', implying that a line was added.

Thanks for your feedback!

intel-lab-lkp pushed a commit to intel-lab-lkp/linux that referenced this issue Sep 29, 2024
Remove unnecessary empty `///` lines in the rust docs.

Suggested-by: Miguel Ojeda <ojeda@kernel.org>
Link: Rust-for-Linux#1109
Signed-off-by: Hridesh MG <hridesh699@gmail.com>
intel-lab-lkp pushed a commit to intel-lab-lkp/linux that referenced this issue Sep 29, 2024
Add a check to warn if there are consecutive empty `///` lines in rust
files.

Suggested-by: Miguel Ojeda <ojeda@kernel.org>
Link: Rust-for-Linux#1109
Signed-off-by: Hridesh MG <hridesh699@gmail.com>
@ojeda ojeda added the easy Expected to be an easy issue to resolve. label Oct 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
• docs Related to `Documentation/rust/`, `samples/`, generated docs, doctests, typos... easy Expected to be an easy issue to resolve. good first issue Good for newcomers
Development

No branches or pull requests

3 participants