25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

129 lines
4.2 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 apply:
  9. * Do not introduce trailing whitespace
  10. * We use spaces for indenting only
  11. * Try not to introduce lines longer than 80 characters
  12. * Write small functions whenever possible
  13. * Avoid having too many clauses containing clauses containing clauses.
  14. Basically, avoid deeply nested functions.
  15. Follow the indentation style of existing files. The [erlang-mode for
  16. (emacs)](http://www.erlang.org/doc/man/erlang.el.html) indentation is going to
  17. always work. Other users may want to use 4-width spaces and make sure things
  18. align mostly the way they would with Emacs code, or with the rest of the
  19. project.
  20. Where possible, include type specifications for your code so type analysis
  21. will be as accurate as possible.
  22. Please add comments around tricky fixes or workarounds so that we can
  23. easily know why they're there at a glance.
  24. Pull requests and branching
  25. ---------------------------
  26. All fixes to rebar end up requiring a +1 from one or more of the project's
  27. maintainers. When opening a pull request, explain what the patch is doing
  28. and if it makes sense, why the proposed implementation was chosen.
  29. Try to use well-defined commits (one feature per commit) so that reading
  30. them and testing them is easier for reviewers and while bissecting the code
  31. base for issues.
  32. During the review process, you may be asked to correct or edit a few things
  33. before a final rebase to merge things.
  34. Please work in feature branches, and do not commit to `master` in your fork.
  35. Provide a clean branch without merge commits.
  36. Tests
  37. -----
  38. As a general rule, any behavioral change to rebar requires a test to go with
  39. it. If there's already a test case, you may have to modify that one. If there
  40. isn't a test case or a test suite, add a new test case or suite in `test/`.
  41. To run the tests:
  42. ```sh
  43. $ ./bootstrap
  44. $ ./rebar3 ct
  45. ```
  46. The rebar3 test suite is written using Common Test. As many of the tests as
  47. possible are written by using the programmatic rebar3 API rather than
  48. by running the escriptized project directly. The tests should be restricted
  49. to their `priv_dir` and leave the system clean after a run.
  50. If such tests prove hard to write, you can ask for help doing that in your
  51. pull request.
  52. For tests having a lot to do with I/O and terminal interaction, consider
  53. adding them to https://github.com/tsloughter/rebar3_tests
  54. Credit
  55. ------
  56. To give everyone proper credit in addition to the git history, please feel free to append
  57. your name to `THANKS` in your first contribution.
  58. Committing your changes
  59. -----------------------
  60. Please ensure that all commits pass all tests, and do not have extra Dialyzer warnings.
  61. To do that run `./rebar3 ct` and `./rebar3 as dialyze dialyzer`.
  62. #### Structuring your commits
  63. - Fixing a bug is one commit.
  64. - Adding a feature is one commit.
  65. - Adding two features is two commits.
  66. - Two unrelated changes is two commits (and likely two Pull requests)
  67. If you fix a (buggy) commit, squash (`git rebase -i`) the changes as a fixup commit into
  68. the original commit.
  69. #### Writing Commit Messages
  70. It's important to write a proper commit title and description. The commit title must be
  71. at most 50 characters; it is the first line of the commit text. The second line of the
  72. commit text must be left blank. The third line and beyond is the commit message. You
  73. should write a commit message. If you do, wrap all lines at 72 characters. You should
  74. explain what the commit does, what references you used, and any other information
  75. that helps understanding your changes.
  76. Basically, structure your commit message like this:
  77. <pre>
  78. One line summary (at most 50 characters)
  79. Longer description (wrap at 72 characters)
  80. </pre>
  81. ##### Commit title/summary
  82. * At most 50 characters
  83. * What was changed
  84. * Imperative present tense (Fix, Add, Change)
  85. * `Fix bug 123`
  86. * `Add 'foobar' command`
  87. * `Change default timeout to 123`
  88. * No period
  89. ##### Commit description
  90. * Wrap at 72 characters
  91. * Why, explain intention and implementation approach
  92. * Present tense