Skip to content

Commit dfd53da

Browse files
committed
Document Pull Request size guidelines
1 parent 28b3386 commit dfd53da

2 files changed

Lines changed: 35 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,3 +78,32 @@ jobs:
7878

7979
- name: Run Samples tests
8080
run: vendor/bin/phpunit tests/Samples/
81+
82+
pr-size:
83+
name: PR size
84+
runs-on: ubuntu-latest
85+
permissions:
86+
contents: read
87+
env:
88+
BASE: ${{ github.event.pull_request.base.sha }}
89+
HEAD: ${{ github.event.pull_request.head.sha }}
90+
MAX_LINE_CHANGE_COUNT_SRC: 300
91+
steps:
92+
- name: Checkout code
93+
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
94+
with:
95+
persist-credentials: false
96+
fetch-depth: 0
97+
98+
- name: Check nr of lines changed
99+
run: |
100+
read ADDED REMOVED < <(git diff "$BASE" "$HEAD" --numstat -- src/ | awk '{added+=$1; removed+=$2} END {print added+0, removed+0}')
101+
echo "Lines changed in src/: +$ADDED -$REMOVED (max +/- $MAX_LINE_CHANGE_COUNT_SRC)"
102+
if [ "$ADDED" -gt $MAX_LINE_CHANGE_COUNT_SRC ] || [ "$REMOVED" -gt $MAX_LINE_CHANGE_COUNT_SRC ]; then
103+
echo
104+
echo "This PR is too large to review"
105+
echo "Please split it into smaller PRs"
106+
echo "=> See CONTRIBUTING.md for more info"
107+
echo
108+
exit 1
109+
fi

CONTRIBUTING.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,9 @@ There are some acceptable reasons to add comments:
3535
- Something is done in a specific way that is not intuitive. In this case, the considerations should be put in the comments.
3636
- A unit of code can be referenced by multiple names. A comment can clarify the alternative name.
3737
- For example: a parameter for `characterSpace` is named `Tc`. To clarify the name, this package uses `characterSpace` internally. A comment clarifying that this references `Tc` in the specification makes sense.
38+
39+
## Pull request size Guidelines
40+
41+
Pull requests should be **reviewable in under an hour**. This means:
42+
- Less than 300 lines of actual code changes (excluding tests)
43+
- Single logical change. Either one new feature or one bugfix per PR

0 commit comments

Comments
 (0)