Something went wrong. Try again.
@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
Something went wrong. Try again.
8.7 kB · 200 lines
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201@title Contributing Code@group detailPhorge is an open-source project, and welcomes contributions from the communityat large. However, there are some guidelines we ask you to follow.Overview========The most important parts of contributing code to Phorge are: - File a task with a bug report or feature request //before// you write code. - We do not accept GitHub pull requests. - Some alternative approaches are available if your change isn't something we want to bring upstream.The rest of this article describes these points in more detail, and thenprovides guidance on writing and submitting patches.If you just want to contribute some code but don't have a specific bug orfeature in mind, see the bottom of this document for tips on finding ways to getstarted.For general information on contributing to Phorge, see@{article:Contributor Introduction}.Coordinate First================Before sending code, you should file a task describing what you'd like to write.When you file a task, mention that you'd like to write the code to fix it. Wecan help contextualize your request or bug and guide you through writing anupstreamable patch, provided it's something that's upstreamable. If it isn'tupstreamable, we can let you know what the issues are and help find anotherplan of attack.You don't have to file first (for example, if you spot a misspelling it'snormally fine to just send a diff), but for anything even moderately complexyou're strongly encouraged to file first and coordinate with the upstream.Rejecting Patches=================If you send us a patch without coordinating it with us first, it will probablybe immediately rejected, or sit in limbo for a long time and eventually berejected. The reasons we do this vary from patch to patch, but some of the mostcommon reasons are:**Unjustifiable Costs**: We support code in the upstream forever. Support isenormously expensive and takes up a huge amount of our time. The cost to supporta change over its lifetime is often 10x or 100x or 1000x greater than the costto write the first version of it. Many uncoordinated patches we receive are"white elephants", which would cost much more to maintain than the value theyprovide.As an author, it may look like you're giving us free work and we're rejecting itas too expensive, but this viewpoint doesn't align with the reality of a largeproject which is actively supported by a small, experienced team. Writing codeis cheap; maintaining it is expensive.By coordinating with us first, you can make sure the patch is something weconsider valuable enough to put long-term support resources behind, and thatyou're building it in a way that we're comfortable taking over.**Not a Good Fit**: Many patches aren't good fits for the upstream: theyimplement features we simply don't want. Coordinating with us first helpsmake sure we're on the same page and interested in a feature.The most common type of patch along these lines is a patch which adds newconfiguration options. We consider additional configuration options to havean exceptionally high lifetime support cost and are very unlikely to acceptthem. Coordinate with us first.**Not a Priority**: If you send us a patch against something which isn't apriority, we probably won't have time to look at it. We don't give specialtreatment to low-priority issues just because there's code written: we'd stillbe spending time on something lower-priority when we could be spending it onsomething higher-priority instead.If you coordinate with us first, you can make sure your patch is in an areaof the codebase that we can prioritize.**Overly Ambitious Patches**: Sometimes we'll get huge patches from newcontributors. These can have a lot of fundamental problems and require a hugeamount of our time to review and correct. If you're interested in contributing,you'll have more success if you start small and learn as you go.We can help you break a large change into smaller pieces and learn how thecodebase works as you proceed through the implementation, but only if youcoordinate with us first.**Generality**: We often receive several feature requests which ask for similarfeatures, and can come up with a general approach which covers all of the usecases. If you send us a patch for //your use case only//, the approach may betoo specific. When a cleaner and more general approach is available, we usuallyprefer to pursue it.By coordinating with us first, we can make you aware of similar use cases andopportunities to generalize an approach. These changes are often small, but canhave a big impact on how useful a piece of code is.**Infrastructure and Sequencing**: Sometimes patches are written against a pieceof infrastructure with major planned changes. We don't want to accept thesebecause they'll make the infrastructure changes more difficult to implement.Coordinate with us first to make sure a change doesn't need to wait on otherpieces of infrastructure. We can help you identify technical blockers andpossibly guide you through resolving them if you're interested.Prototype Changes====================We generally advise against submitting patches for prototype applications, asthey may not be widely adopted and may need extra care from rare users who areparticularly familiar with them.For the same reasons, we also discourage feature requests or bug reports forprototype applications, unless you are very familiar with their original designand original workflows. You are welcome to [[https://we.phorge.it/ponder/ |open a question in Ponder]] instead. To learn more about prototypeapplications, see @{article:User Guide: Prototype Applications}.No Pull Requests================We do not accept pull requests on GitHub: - Pull requests do not get lint and unit tests run, so issues which are normally caught statically can slip by. - Phorge is code review software, and developed using its own workflows. Pull requests bypass some of these workflows (for example, they will not trigger Herald rules to notify interested parties). - GitHub is not the authoritative master repository and we maintain a linear history, so merging pull requests is cumbersome on our end. - If you're comfortable enough with Phorge to contribute to it, you should also be comfortable using it to submit changes.Instead of creating a pull request, use `arc diff` to create a revision on theupstream install. Your change will go through the normal Phorge reviewprocess.Alternatives============If you've written code but we're not accepting it into the upstream, somealternative approaches include:**Maintain a local fork.** This will require some ongoing effort to port yourchanges forward when you update, but is often very reasonable for simplechanges.**Develop as an application.** Many parts of Phorge's infrastructure aremodular, and modularity is increasing over time. A lot of changes can be builtas external modules or applications without forking Phorge itself. Thereisn't much documentation for this right now, but you can look athow other applications are implemented, and at other third-party code thatextends Phorge.**Rise to prominence.** We're more willing to accept borderline changes fromcommunity members who are active, make multiple contributions, or have a historywith the project. This is not carte blanche, but distinguishing yourself canmake us feel more comfortable about supporting a change which is slightlyoutside of our comfort zone.Writing and Submitting Patches==================To actually submit a patch, run `arc diff` in `phorge/` or `arcanist/`.When executed in these directories, `arc` should automatically talk to theupstream install. You can add #blessed_reviewers as a reviewer.You should read the relevant coding convention documents before you submit achange. If you're a new contributor, you don't need to worry about this toomuch. Just try to make your code look similar to the code around it, and wecan help you through the details during review. - @{article:General Coding Standards} (for all languages) - @{article:PHP Coding Standards} (for PHP) - @{article:Javascript Coding Standards} (for Javascript)In general, if you're coordinating with us first, we can usually provideguidance on how to implement things. The other articles in this section alsoprovide information on how to work in the Phorge codebase.Next Steps==========Continue by: - preparing your development environment as described in the @{article:Developer Setup} - returning to the @{article:Contributor Introduction}