Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

125 linhas
4.3 KiB

  1. Contributing to rebar
  2. ---------------------
  3. Before implementing a new feature, please submit a ticket to discuss your plans.
  4. The feature might have been rejected already, or the implementation might already be decided.
  5. See [Community and Resources](README.md#community-and-resources).
  6. Code style
  7. ----------
  8. The following rules must be followed:
  9. * Do not introduce trailing whitespace
  10. * Do not mix spaces and tabs
  11. * Do not introduce lines longer than 80 characters
  12. The following rules should be followed:
  13. * Write small functions whenever possible
  14. * Avoid having too many clauses containing clauses containing clauses.
  15. Basically, avoid deeply nested functions.
  16. [erlang-mode (emacs)](http://www.erlang.org/doc/man/erlang.el.html)
  17. indentation is preferred. This will keep the code base consistent.
  18. vi users are encouraged to give [Vim emulation](http://emacswiki.org/emacs/Evil) ([more
  19. info](https://gitorious.org/evil/pages/Home)) a try.
  20. Pull requests and branching
  21. ---------------------------
  22. Use one topic branch per pull request. If you do that, you can add extra commits or fix up
  23. buggy commits via `git rebase -i`, and update the branch. The updated branch will be
  24. visible in the same pull request. Therefore, you should not open a new pull request when
  25. you have to fix your changes.
  26. Do not commit to master in your fork.
  27. Provide a clean branch without merge commits.
  28. Tests
  29. -----
  30. As a general rule, any behavioral change to rebar requires a test to go with it. If there's
  31. already a test case, you may have to modify that one. If there isn't a test case or a test
  32. suite, add a new test case or suite in `inttest/`. [retest](https://github.com/dizzyd/retest) based tests are preferred, but
  33. we also have EUnit tests in `test/`.
  34. Say you've added a new test case in `inttest/erlc`. To only execute the modified suite,
  35. you would do the following:
  36. ```sh
  37. # First we build rebar and its deps to also get `deps/retest/retest`
  38. $ make debug deps
  39. # Now we can test the modified erlc suite
  40. $ deps/retest/retest -v inttest/erlc
  41. ```
  42. To test EUnit tests, you would do:
  43. ```sh
  44. $ make debug
  45. $ ./rebar -v eunit
  46. ```
  47. You can also run `make test` to execute both EUnit and [retest](https://github.com/dizzyd/retest) tests as `make check` does.
  48. Credit
  49. ------
  50. To give everyone proper credit in addition to the git history, please feel free to append
  51. your name to `THANKS` in your first contribution.
  52. Committing your changes
  53. -----------------------
  54. Please ensure that all commits pass all tests, and do not have extra Dialyzer warnings.
  55. To do that run `make check`. If you didn't build via `make debug` at first, the beam files in
  56. `ebin/` might be missing debug_info required for [xref](http://www.erlang.org/doc/man/xref.html)
  57. and [Dialyzer](http://www.erlang.org/doc/man/dialyzer.html), causing a test
  58. failure.
  59. If that happens, running `make clean` before running `make check` could solve the problem.
  60. If you change any of the files with known but safe to ignore Dialyzer warnings, you may
  61. have to adapt the line number(s) in [dialyzer_reference](dialyzer_reference). If you do that,
  62. do not remove the
  63. leading blank line.
  64. #### Structuring your commits
  65. Fixing a bug is one commit.
  66. Adding a feature is one commit.
  67. Adding two features is two commits.
  68. Two unrelated changes is two commits.
  69. If you fix a (buggy) commit, squash (`git rebase -i`) the changes as a fixup commit into
  70. the original commit.
  71. #### Writing Commit Messages
  72. It's important to write a proper commit title and description. The commit title must be
  73. at most 50 characters; it is the first line of the commit text. The second line of the
  74. commit text must be left blank. The third line and beyond is the commit message. You
  75. should write a commit message. If you do, wrap all lines at 72 characters. You should
  76. explain what the commit does, what references you used, and any other information
  77. that helps understanding your changes.
  78. Basically, structure your commit message like this:
  79. <pre>
  80. One line summary (at most 50 characters)
  81. Longer description (wrap at 72 characters)
  82. </pre>
  83. ##### Commit title/summary
  84. * At most 50 characters
  85. * What was changed
  86. * Imperative present tense (Fix, Add, Change)
  87. * `Fix bug 123`
  88. * `Add 'foobar' command`
  89. * `Change default timeout to 123`
  90. * No period
  91. ##### Commit description
  92. * Wrap at 72 characters
  93. * Why, explain intention and implementation approach
  94. * Present tense