CONTRIBUTING 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. Important things to consider if you want to contribute to the project (or any
  2. project in general, programming language and programming style aside)
  3. On authors, maintainers, and contributing:
  4. - If you want to write in a nice new contribution/feature, that's awesome, and
  5. I fully encourage it. However, unless what you make is very easy to
  6. maintain, do not submit a feature or module for distribution with the main
  7. project if you don't plan on supporting it or maintaining it yourself. This
  8. is *especially* important if it's big. Smaller features and contributions
  9. that are simple to understand/maintain can get away with this, but
  10. generally, other people do not want to have to fix your code if something
  11. breaks.
  12. I completely understand that you may have a busy life outside of the
  13. project, but if what you submit can go wrong, it will go wrong. If you
  14. don't have time to fix major problems, then you probably shouldn't be
  15. contributing to the project (or any project) in the first place.
  16. - Be prepared to work with other contributors. If you are venturing in to
  17. someone else's code (to improve/expand upon it, or to change it for the
  18. better), be prepared to talk and work with that person, whomever it may be.
  19. Do *not* go rewriting someone elses code from scratch just because you feel
  20. you can do it better. Instead, examine what they did, talk with the person
  21. (constructively) and if possible work with them to try to improve their
  22. existing code.
  23. This may require you to have some level of people skills. That *doesn't*
  24. mean you should have to take someone else's bullshit if they're being an
  25. asshole or being completely unreasonable, but it does mean that you should
  26. be somewhat civil and try to work together.
  27. - Be prepared to work with testers/users, sometimes you *have* to talk to
  28. users and go over the problem and find the solution. Users don't always
  29. know what they're doing, but I've found that most are more than willing to
  30. be patient and follow your instructions to help you debug the problem for
  31. mutual benefit. They will sing praises of you for fixing their problems,
  32. and you will have one less problem to deal with. You'll find that the
  33. community is awesome and filled with some amazing people. Work with them,
  34. cherish them, because they are truly what make the wheels of your project
  35. spin. For that reason, do *not* treat users badly, ever.
  36. - The author(s)/maintainer(s) often get the last say on big/important
  37. decisions for the project as a whole. A good maintainer will always listen,
  38. and will often ask others on the project for their opinions. At the same
  39. time, don't always expect everything to be democratic. Each individual
  40. project has its own rules, but more often than not it's probably more like a
  41. benevolent dictatorship. If that is the case and you have an opinion about
  42. a particular upcoming change/decision, simply talk with the maintainers
  43. about your opinion, and unless it ventures too far outside of whatever
  44. 'project vision' they have, they usually are (and should be) more than
  45. willing to take your personal opinions in to account for the sake of the
  46. project as a whole.
  47. Just keep in mind that there are always many subjective topics, and that
  48. like anything that's subjective, there often will be differing opinions that
  49. may not always become resolved.
  50. - However, that being said, do try to avoid taking up too much of the
  51. maintainer's time on any given discussion. Try to be to be as concise as
  52. possible, as they're often pretty busy, especially if they are doing most of
  53. the work on the project (which is almost always the case).
  54. Styles, formatting, and guidelines for code
  55. - You may use C, C++. or Objective-C (for apple) to create your modules,
  56. though please try to use C unless an API you're using requires C++ or
  57. Objective-C (such as windows COM classes, or apple Objetive-C APIs). Some
  58. maintainers may be lax with this (such as myself), but unless you plan on
  59. always being there to maintain the code, it's generally best to use C so
  60. everybody has common ground to work with. Language is a very personal thing
  61. and not everyone will agree, but it's something that is ultimately the
  62. decision of the author(s)/maintainer(s). Arguing about language in this
  63. instance will only seek to annoy them.
  64. - Coding style is mostly KNF (linux-style). We're using KNF because it's an
  65. established, well known style with the purpose of reducing bugs and
  66. improving readability in a variety of circumstances. This means K&R, 80
  67. columns max, preferable maximum function length of 42 lines, 8 character
  68. width tabs, lower_case_names, etc. I chose this for the sake of the
  69. project, don't argue about it, don't talk to me about it, just do it. If
  70. you can't deal with it, then you probably shouldn't be contributing to any
  71. projects period, because every good project has coding guidelines.
  72. See https://www.kernel.org/doc/Documentation/CodingStyle for a general
  73. guideline (though not necessarily a rulebook, for example we allow the use
  74. of boolean return values instead of ints for failure).
  75. - C++ is an exception to the lower_case_only rule, CamelCase is encouraged
  76. (though not required) to distinguish it from C code. Just a personal and
  77. subjective stylistic thing on my part.
  78. - Do not use dependencies for the sake of convenience. Use them only if you
  79. actually have a real need to depend on them. Just because the user
  80. interface code depends on some toolkit doesn't mean it's okay for your
  81. module to use that toolkit just so you can use some class or template they
  82. have that you enjoy using. Use the standard language libraries and use
  83. what's available in the core.
  84. - Core is C only (unless there's an operating specific thing that requires
  85. another language). I will especially not accept any code in the core that
  86. does not abide by these rules. I will be particularly uptight about the
  87. core.
  88. About these guidelines
  89. - These guidelines, the coding style, the format are for the sake of the
  90. project and everyone who contributes and helps maintain the project. They
  91. are not done so much for the sake of myself as the maintainer, but for the
  92. sake of everyone. These guidelines helps ensure better code, better
  93. conitribution, better cooperation, and code that (hopefully) everyone can
  94. contribute to on some measure of even ground. Everyone has their own
  95. personal style but sometimes there just has to be common ground for the sake
  96. of the project as a whole.