"use strict";(self.webpackChunkdocs_v_2=self.webpackChunkdocs_v_2||[]).push([[1328],{95788:(e,t,n)=>{n.d(t,{Iu:()=>u,yg:()=>y});var a=n(11504);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t){if(null==e)return{};var n,a,r=function(e,t){if(null==e)return{};var n,a,r={},i=Object.keys(e);for(a=0;a<i.length;a++)n=i[a],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)n=i[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var s=a.createContext({}),p=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},u=function(e){var t=p(e.components);return a.createElement(s.Provider,{value:t},e.children)},c="mdxType",g={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},m=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,i=e.originalType,s=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),c=p(n),m=r,y=c["".concat(s,".").concat(m)]||c[m]||g[m]||i;return n?a.createElement(y,o(o({ref:t},u),{},{components:n})):a.createElement(y,o({ref:t},u))}));function y(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=n.length,o=new Array(i);o[0]=m;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[c]="string"==typeof e?e:r,o[1]=l;for(var p=2;p<i;p++)o[p]=n[p];return a.createElement.apply(null,o)}return a.createElement.apply(null,n)}m.displayName="MDXCreateElement"},98932:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>o,default:()=>g,frontMatter:()=>i,metadata:()=>l,toc:()=>p});var a=n(45072),r=(n(11504),n(95788));const i={title:"Pull Request Guidelines",hide_title:!0,sidebar_position:3,version:1},o=void 0,l={unversionedId:"contributing/pull-request-guidelines",id:"contributing/pull-request-guidelines",title:"Pull Request Guidelines",description:"Pull Request Guidelines",source:"@site/docs/contributing/pull-request-guidelines.mdx",sourceDirName:"contributing",slug:"/contributing/pull-request-guidelines",permalink:"/docs/contributing/pull-request-guidelines",draft:!1,editUrl:"https://github.com/apache/superset/edit/master/docs/docs/contributing/pull-request-guidelines.mdx",tags:[],version:"current",sidebarPosition:3,frontMatter:{title:"Pull Request Guidelines",hide_title:!0,sidebar_position:3,version:1},sidebar:"tutorialSidebar",previous:{title:"Types of Contributions",permalink:"/docs/contributing/types-of-contributions"},next:{title:"Style Guide",permalink:"/docs/contributing/style-guide"}},s={},p=[{value:"Pull Request Guidelines",id:"pull-request-guidelines",level:2},{value:"Protocol",id:"protocol",level:3},{value:"Authoring",id:"authoring",level:4},{value:"Reviewing",id:"reviewing",level:4},{value:"Test Environments",id:"test-environments",level:4},{value:"Merging",id:"merging",level:4},{value:"Post-merge Responsibility",id:"post-merge-responsibility",level:4}],u={toc:p},c="wrapper";function g(e){let{components:t,...n}=e;return(0,r.yg)(c,(0,a.c)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,r.yg)("h2",{id:"pull-request-guidelines"},"Pull Request Guidelines"),(0,r.yg)("p",null,"A philosophy we would like to strongly encourage is"),(0,r.yg)("blockquote",null,(0,r.yg)("p",{parentName:"blockquote"},"Before creating a PR, create an issue.")),(0,r.yg)("p",null,"The purpose is to separate problem from possible solutions."),(0,r.yg)("p",null,(0,r.yg)("strong",{parentName:"p"},"Bug fixes:")," If you\u2019re only fixing a small bug, it\u2019s fine to submit a pull request right away but we highly recommend to file an issue detailing what you\u2019re fixing. This is helpful in case we don\u2019t accept that specific fix but want to keep track of the issue. Please keep in mind that the project maintainers reserve the rights to accept or reject incoming PRs, so it is better to separate the issue and the code to fix it from each other. In some cases, project maintainers may request you to create a separate issue from PR before proceeding."),(0,r.yg)("p",null,(0,r.yg)("strong",{parentName:"p"},"Refactor:")," For small refactors, it can be a standalone PR itself detailing what you are refactoring and why. If there are concerns, project maintainers may request you to create a ",(0,r.yg)("inlineCode",{parentName:"p"},"#SIP")," for the PR before proceeding."),(0,r.yg)("p",null,(0,r.yg)("strong",{parentName:"p"},"Feature/Large changes:")," If you intend to change the public API, or make any non-trivial changes to the implementation, we require you to file a new issue as ",(0,r.yg)("inlineCode",{parentName:"p"},"#SIP")," (Superset Improvement Proposal). This lets us reach an agreement on your proposal before you put significant effort into it. You are welcome to submit a PR along with the SIP (sometimes necessary for demonstration), but we will not review/merge the code until the SIP is approved."),(0,r.yg)("p",null,"In general, small PRs are always easier to review than large PRs. The best practice is to break your work into smaller independent PRs and refer to the same issue. This will greatly reduce turnaround time."),(0,r.yg)("p",null,"If you wish to share your work which is not ready to merge yet, create a ",(0,r.yg)("a",{parentName:"p",href:"https://github.blog/2019-02-14-introducing-draft-pull-requests/"},"Draft PR"),". This will enable maintainers and the CI runner to prioritize mature PR's."),(0,r.yg)("p",null,"Finally, never submit a PR that will put master branch in broken state. If the PR is part of multiple PRs to complete a large feature and cannot work on its own, you can create a feature branch and merge all related PRs into the feature branch before creating a PR from feature branch to master."),(0,r.yg)("h3",{id:"protocol"},"Protocol"),(0,r.yg)("h4",{id:"authoring"},"Authoring"),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},"Fill in all sections of the PR template.")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},"Title the PR with one of the following semantic prefixes (inspired by ",(0,r.yg)("a",{parentName:"p",href:"http://karma-runner.github.io/0.10/dev/git-commit-msg.html%5D"},"Karma"),"):"),(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"feat")," (new feature)"),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"fix")," (bug fix)"),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"docs")," (changes to the documentation)"),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"style")," (formatting, missing semi colons, etc; no application logic change)"),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"refactor")," (refactoring code)"),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"test")," (adding missing tests, refactoring tests; no application logic change)"),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"chore")," (updating tasks etc; no application logic change)"),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"perf")," (performance-related change)"),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"build")," (build tooling, Docker configuration change)"),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"ci")," (test runner, GitHub Actions workflow changes)"),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"other")," (changes that don't correspond to the above -- should be rare!)"),(0,r.yg)("li",{parentName:"ul"},"Examples:",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"feat: export charts as ZIP files")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"perf(api): improve API info performance")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"fix(chart-api): cached-indicator always shows value is cached")))))),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},"Add prefix ",(0,r.yg)("inlineCode",{parentName:"p"},"[WIP]")," to title if not ready for review (WIP = work-in-progress). We recommend creating a PR with ",(0,r.yg)("inlineCode",{parentName:"p"},"[WIP]")," first and remove it once you have passed CI test and read through your code changes at least once.")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},"If you believe your PR contributes a potentially breaking change, put a ",(0,r.yg)("inlineCode",{parentName:"p"},"!")," after the semantic prefix but before the colon in the PR title, like so: ",(0,r.yg)("inlineCode",{parentName:"p"},"feat!: Added foo functionality to bar"))),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Screenshots/GIFs:")," Changes to user interface require before/after screenshots, or GIF for interactions"),(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},"Recommended capture tools (",(0,r.yg)("a",{parentName:"li",href:"https://getkap.co/"},"Kap"),", ",(0,r.yg)("a",{parentName:"li",href:"https://www.cockos.com/licecap/"},"LICEcap"),", ",(0,r.yg)("a",{parentName:"li",href:"https://download.cnet.com/Skitch/3000-13455_4-189876.html"},"Skitch"),")"),(0,r.yg)("li",{parentName:"ul"},"If no screenshot is provided, the committers will mark the PR with ",(0,r.yg)("inlineCode",{parentName:"li"},"need:screenshot")," label and will not review until screenshot is provided."))),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Dependencies:")," Be careful about adding new dependency and avoid unnecessary dependencies."),(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},"For Python, include it in ",(0,r.yg)("inlineCode",{parentName:"li"},"setup.py")," denoting any specific restrictions and in ",(0,r.yg)("inlineCode",{parentName:"li"},"requirements.txt")," pinned to a specific version which ensures that the application build is deterministic."),(0,r.yg)("li",{parentName:"ul"},"For TypeScript/JavaScript, include new libraries in ",(0,r.yg)("inlineCode",{parentName:"li"},"package.json")))),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Tests:")," The pull request should include tests, either as doctests, unit tests, or both. Make sure to resolve all errors and test failures. See ",(0,r.yg)("a",{parentName:"p",href:"#testing"},"Testing")," for how to run tests.")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Documentation:")," If the pull request adds functionality, the docs should be updated as part of the same PR.")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"CI:")," Reviewers will not review the code until all CI tests are passed. Sometimes there can be flaky tests. You can close and open PR to re-run CI test. Please report if the issue persists. After the CI fix has been deployed to ",(0,r.yg)("inlineCode",{parentName:"p"},"master"),", please rebase your PR.")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Code coverage:")," Please ensure that code coverage does not decrease.")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},"Remove ",(0,r.yg)("inlineCode",{parentName:"p"},"[WIP]")," when ready for review. Please note that it may be merged soon after approved so please make sure the PR is ready to merge and do not expect more time for post-approval edits.")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},"If the PR was not ready for review and inactive for > 30 days, we will close it due to inactivity. The author is welcome to re-open and update."))),(0,r.yg)("h4",{id:"reviewing"},"Reviewing"),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},"Use constructive tone when writing reviews."),(0,r.yg)("li",{parentName:"ul"},"If there are changes required, state clearly what needs to be done before the PR can be approved."),(0,r.yg)("li",{parentName:"ul"},"If you are asked to update your pull request with some changes there's no need to create a new one. Push your changes to the same branch."),(0,r.yg)("li",{parentName:"ul"},"The committers reserve the right to reject any PR and in some cases may request the author to file an issue.")),(0,r.yg)("h4",{id:"test-environments"},"Test Environments"),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},"Members of the Apache GitHub org can launch an ephemeral test environment directly on a pull request by creating a comment containing (only) the command ",(0,r.yg)("inlineCode",{parentName:"li"},"/testenv up"),".",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},"Note that org membership must be public in order for this validation to function properly."))),(0,r.yg)("li",{parentName:"ul"},"Feature flags may be set for a test environment by specifying the flag name (prefixed with ",(0,r.yg)("inlineCode",{parentName:"li"},"FEATURE_"),") and value after the command.",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},"Format: ",(0,r.yg)("inlineCode",{parentName:"li"},"/testenv up FEATURE_<feature flag name>=true|false")),(0,r.yg)("li",{parentName:"ul"},"Example: ",(0,r.yg)("inlineCode",{parentName:"li"},"/testenv up FEATURE_DASHBOARD_NATIVE_FILTERS=true")),(0,r.yg)("li",{parentName:"ul"},"Multiple feature flags may be set in single command, separated by whitespace"))),(0,r.yg)("li",{parentName:"ul"},"A comment will be created by the workflow script with the address and login information for the ephemeral environment."),(0,r.yg)("li",{parentName:"ul"},"Test environments may be created once the Docker build CI workflow for the PR has completed successfully."),(0,r.yg)("li",{parentName:"ul"},"Test environments do not currently update automatically when new commits are added to a pull request."),(0,r.yg)("li",{parentName:"ul"},"Test environments do not currently support async workers, though this is planned."),(0,r.yg)("li",{parentName:"ul"},"Running test environments will be shutdown upon closing the pull request.")),(0,r.yg)("h4",{id:"merging"},"Merging"),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},"At least one approval is required for merging a PR."),(0,r.yg)("li",{parentName:"ul"},"PR is usually left open for at least 24 hours before merging."),(0,r.yg)("li",{parentName:"ul"},"After the PR is merged, ",(0,r.yg)("a",{parentName:"li",href:"https://help.github.com/articles/closing-issues-using-keywords/"},"close the corresponding issue(s)"),".")),(0,r.yg)("h4",{id:"post-merge-responsibility"},"Post-merge Responsibility"),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},"Project maintainers may contact the PR author if new issues are introduced by the PR."),(0,r.yg)("li",{parentName:"ul"},"Project maintainers may revert your changes if a critical issue is found, such as breaking master branch CI.")))}g.isMDXComponent=!0}}]); |