Skip to content

Enforce size bounds recursively on directory content - #368

Merged
slawekjaranowski merged 3 commits into
apache:masterfrom
zabetak:directory-size-rule
Jun 11, 2025
Merged

slawekjaranowski merged 3 commits into
apache:masterfrom
zabetak:directory-size-rule

Conversation

@zabetak

@zabetak zabetak commented Jun 2, 2025

Copy link
Copy Markdown
Member

Enchance RequireFilesSize rule to be able to enforce size bounds in the entire content of a directory by optionally enabling the new recurscive flag.

The main motivation comes from the target directory that tends to store all kind of information from jar artifacts to test logs, reports, and many other things. It is not uncommon, that small seemingly innocent changes (e.g., adding a new test) can make the target directory unreasonably large consuming many GB of disk space. When such changes sneak into the project there is a high risk of causing CI/CD instability and intermittent failures that may be hard to notice.

Close #366

Following this checklist to help us incorporate your
contribution quickly and easily:

  • Your pull request should address just one issue, without pulling in other changes.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Each commit in the pull request should have a meaningful subject line and body.
    Note that commits might be squashed by a maintainer on merge.
  • Write unit tests that match behavioral changes, where the tests fail if the changes to the runtime are not applied.
    This may not always be possible but is a best-practice.
  • Run mvn verify to make sure basic checks pass.
    A more thorough check will be performed on your pull request automatically.
  • You have run the integration tests successfully (mvn -Prun-its verify).

If your pull request is about ~20 lines of code you don't need to sign an
Individual Contributor License Agreement if you are unsure
please ask on the developers list.

To make clear that you license your contribution under
the Apache License Version 2.0, January 2004
you have to acknowledge this by using the following check-box.

@zabetak
zabetak force-pushed the directory-size-rule branch 2 times, most recently from 32a7a25 to 98d8fb5 Compare June 2, 2025 15:43
Enchance RequireFilesSize rule to be able to enforce size bounds in the entire content of a directory by optionally enabling the new recurscive flag.

The main motivation comes from the target directory that tends to store all kind of information from jar artifacts to test logs, reports, and many other things. It is not uncommon, that small seemingly innocent changes (e.g., adding a new test) can make the target directory unreasonably large consuming many GB of disk space. When such changes sneak into the project there is a high risk of causing CI/CD instability and intermittent failures that may be hard to notice.

Close apache#366
@zabetak
zabetak force-pushed the directory-size-rule branch from 98d8fb5 to 5290d34 Compare June 2, 2025 18:37

@slawekjaranowski slawekjaranowski left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please also update documentation in enforcer-rules/src/site/apt/requireFilesSize.apt.vm

@zabetak

zabetak commented Jun 10, 2025

Copy link
Copy Markdown
Member Author

Many thanks for the review @slawekjaranowski ! I addressed your comments and updated the documentation in 6b56ba1. I run mvn site and checked that enforcer-rules/target/site/requireFilesSize.html reflects the changes.

@slawekjaranowski slawekjaranowski added the enhancement New feature or request label Jun 11, 2025
@slawekjaranowski slawekjaranowski added this to the 3.6.0 milestone Jun 11, 2025
@slawekjaranowski
slawekjaranowski merged commit 9469166 into apache:master Jun 11, 2025
@slawekjaranowski

Copy link
Copy Markdown
Member

@zabetak thanks

@zabetak
zabetak deleted the directory-size-rule branch June 12, 2025 07:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enforce size bounds on directories

2 participants