-
-
Notifications
You must be signed in to change notification settings - Fork 740
Improve contribution guide #4128
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
Conversation
### Code | ||
|
||
- Don't add `@nogc`, `@pure`, `@safe`, `nothrow` attributes yourself - let the compiler infer it! However add unittest check for these attributes if possible |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All those attributes should be put on non-templated functions manually. You should make it clear that the above statement only applies to templates.
You should also make a note that all user impacting changes should have a corresponding changelog entry.
Tightly related fix are OK to go in the same PR. Unrelated fixes/refactorings/additions should preferably go separate pull request(s). |
- Fork [on Github](https://github.com/D-Programming-Language/phobos) | ||
- Use our [Bugzilla bug tracker](http://d.puremagic.com/issues/) | ||
- Follow the [Styleguide](http://dlang.org/dstyle.html) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: "style guide" should be two words.
5a28566
to
04d74be
Compare
- [Autotester](http://wiki.dlang.org/Git_Commit_Tester) will automatically compile the code in your PR and test it on all supported platforms. For you first PR you need approval from any reviewer - ping them in case they forget. | ||
- [ ] Do all tests pass? You can run the tests of a single module with `rdmd -main -unittest module.d`, of an entire package with `make -f posix.mak std/algorithm.test` and all tests with `make -f posix.mak unittest` | ||
- [ ] Do your tests cover all cases? (you can check code coverage in the resulting `module.lst` of `rdmd -cov -main -unittest module.d`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might want to mention that it's useful to run tests locally as well, to prevent waste of autotester cycles by silly mistakes like typos and syntax errors, or code that obviously doesn't work even locally. Phobos unittests can be run by:
make -f posix.mak unittest
But that takes a long time, so I often just run:
dmd -main -unittest std/algorithm/iteration.d -of/tmp/test && ./test; echo $?
and it will print 0
if all goes well, otherwise there will be an error message or a non-zero error code (usually means a crash).
Of course, this is on Posix only... Windows users probably would have a different workflow.
04d74be
to
71dd91c
Compare
@ZombineDev incorporated all your feedback & I added a couple of other items to the list.
Changed to "the D style".
AFAIK the idea of explicitly specifying the return type if possible is that it is easier to read (documentation and code)
I tried to shorten this a bit. Hope you still like it, otherwise criticize again ;-)
Does anyone have more information on this? Update:
These instructions are already there - I recommend to use |
1818a69
to
608cd81
Compare
Might also want to mention what to do if the auto-tester comes back with a merge failure? |
- Use `$(REF_ALTTEXT)` for a different link name (format is `$(REF_ALTTEXT your text, formattedRead, std, format)` | ||
- Variables will be automatically put in backticks, use an underscore to avoid this behavior (e.g. `_foo`) | ||
- Don't put examples in your ddoc header - use the `///` magic to annotate them. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not clear (to a newbie) what "///
magic" means. Might want to give an example + short explanation?
113dea9
to
50c11d3
Compare
All comments addressed.
I added the section on rebasing and squashing from Starting as a Contributor and modified it a bit - so all is in one document. |
50c11d3
to
8a599db
Compare
LGTM, thanks for taking the time to improve this very important document! I'll wait a bit for other reviewers to take a look, then it's merge time! |
8a599db
to
c91d90d
Compare
The pleasure is on my side ;-)
I hope that other reviewers can recall some problems they had in their newbie time or common errors they criticize on PRs. |
unittest | ||
{ | ||
assert(1 == 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Niptick: use four spaces, instead of one tab.
I applaud your work here, but I argue that this is the wrong place for it. About four months ago @CyberShadow and I consolidated all contriduting information (it was strewn about five or so different places) into one article: http://wiki.dlang.org/Starting_as_a_Contributor I would like it if that article stayed the definitive source on contributing, as spreading everything around lead to info being forgotten about and becoming outdated. So, please add this information there instead. |
### Tests | ||
|
||
- [Autotester](http://wiki.dlang.org/Git_Commit_Tester) will automatically compile the code in your PR and test it on all supported platforms. For your first PR you need approval from any reviewer - ping them in case they forget. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"all supported platforms" - technically not all, only most of the supported (x86 and x86_64 platforms). Maybe we should add a note to consult with the other compiler devs (GDC and LLVM) about low-level changes that may make cross-compiler portability more difficult.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rephrased to "All PRs must pass all tests for all supported platforms of [autotester]" and added the line about GDC/LLVM devs.
c91d90d
to
5f34746
Compare
1. [Fork](https://help.github.com/articles/fork-a-repo/) [Phobos](https://github.com/D-Programming-Language/phobos) on Github | ||
2. Create your [own branch](https://github.com/Kunena/Kunena-Forum/wiki/Create-a-new-branch-with-git-and-manage-branches) | ||
3. Work locally on your new feature or fix (see the tips below) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe a good place to link to building and locally testing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 done. However I kept the link to tests
and link there to locally testing. The new tests
section provides some helpful advice like using rdmd -main -unittest
for single modules.
I disagree with you for the following reasons
Kudos!
For the argumentation above I would prefer the other way around: removing the Phobos part and add it here. |
@JackStouffer I think that most of what @greenify has written in this PR doesn't overlap with the information on the wiki. The other repositories would also benefit from specific contribution guides. I think that common information should be consolidated (maybe on the wiki) and the specific guides should be in each repository. |
5f34746
to
b0cc731
Compare
@greenify I saw that you addressed all of my comments. Nice work! |
@greenify Please see the discussion here: #3832 If the documentation for this sort of thing isn't all in one place, it will become outdated and people will forget to update it. This is a slippery slope, if we start putting the info in different places again it will snowball.
And the first thing in this document is a link to the wiki article in question
The vast majority of the document is necessary for even opening a simple PR and testing it. |
All the more reason for it to be added to the wiki page. |
I agree that any info missing from the wiki page ought to be added there. However, I think a case can be made for a "quick start to contributing to Phobos" type of document in place of our current |
- Maximal `@nogc`, `@safe`, `pure`, `nothrow` in _non-templated_ functions | ||
- Don't add `@nogc`, `@safe`, `pure`, `nothrow` attributes to _templated_ functions - let the compiler infer it! However add unittest checks for these attributes if possible (e.g. `pure nothrow @nogc @safe unittest { ... }`) | ||
- Avoid to use `auto` as return type wherever possible (makes the documentation easier to read) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: 'avoid using' instead of 'avoid to use'.
b0cc731
to
ea9ac68
Compare
I'm sorry, but @JackStouffer is right. We have code not in one repository, but several. Lacking a way to transclude Markdown files across repositories, our only options are links or copy-paste. Before everything was consolidated into one article, everything was a huge mess with conflicting or outdated information all over the place. As such, merging this pull request would be a regression. The wiki is not any less official than the markdown file, and such text guides are better hosted on the wiki anyway, since they do not warrant the high contributing bar that a pull request entails. Please integrate any relevant information into the wiki and close this pull request. |
ea9ac68
to
ce8ec08
Compare
|
Nice, maybe link to that directly from |
Already preparing the PR ;-) |
@CyberShadow the process of using the wiki for important documents seems to me like a regression. Wiki pages don't get reviewed before published, which is a major disadvantage, IMO. Just look at all thr improvements that @greenify as a result of this PR review. |
The actually important documents, such as the language spec, are hosted on dlang.org.
We do not have the resources to review typo / dead link fixes. Look at the page's history: https://wiki.dlang.org/?title=Get_involved&action=history Could you really see every edit (series of successive edits by one editor) as a separate pull request?
Yes. Or you could watch the wiki page. Email notifications are enabled.
Where's the Rust RFC that teaches people on how to use git and github? |
In reference to the forum thread, I propose some hints and advice for new contributors. The current list resembles stuff that I learned over the last weeks, feel fee to add your own insights ;-)
This guide should also inform new users about undocumented (or hard to find) policies like pinging people or
std.experimental
.I used
-
for all bullets as the Github markdown checklist syntax only supports- [ ]
and I wanted to have only one typePreview.