Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Limit maximum number of lines changed in file #1468

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

majisourav99
Copy link
Contributor

Limit maximum number of lines changed in file

During reviewing large PR, reviewer often times miss out critical bugs which later can cause production issues.
This PR limits the maximum number of lines changed in a PR to 500. It excludes test file changes.
To override the check, developer can add OVERRRIDE keyword in the title or description.

How was this PR tested?

CI

Does this PR introduce any user-facing changes?

  • No. You can skip the rest of this section.
  • Yes. Make sure to explain your proposed changes and call out the behavior change.

on:
pull_request:
paths:
- '**/*.java' # Monitor changes to Java files only
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we also include .avsc and .proto files please?

Schema changes ideally deserve dedicated PRs anyway, but without making things too complicated at first, we could at least include them in the count?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But for new protocol updates, 'added' will count the entire file as added which would be very high most of the time. Do we ever do inplace avsc changes?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well that is the point, protocol changes should be reviewed in isolation, prior to any code getting written 😁

EXCEEDED=false
while IFS=$'\t' read -r added removed file; do
# Skip test files
if [[ "${file,,}" == *test.java ]]; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this mean test class files must end with the suffix Test? That does not seem right, since we don't follow this convention consistently enough. Can we instead rely on the full path needing to contain src/main in order to be included?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea! Let me update that to check for full path, though developer should include "test" somewhere in the class name.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants