-
Notifications
You must be signed in to change notification settings - Fork 393
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
Allow keep to be explained #1447
Allow keep to be explained #1447
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If no one else has any comments on this by Monday, I'll merge it. I think it's a good idea
@achew22 did you receive any comments on this? |
rule/rule_test.go
Outdated
}, { | ||
desc: "prefix", | ||
src: ` | ||
# keep because of ticket #42 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that this needs updating.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct, updated in c0c70e2.
Allow the # keep comment to take more text after them for the keep author to add a reference to a ticket or to explain the need for the keep.
Co-authored-by: Fabian Meumertzheim <fabian@meumertzhe.im>
1abfd61
to
c0c70e2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, looks good to me from the functional side. I left two comments as I noticed we hadn't updated the docs and had no negative tests. Will right after.
}, { | ||
desc: "before with description", | ||
src: ` | ||
# keep: we need it for the ninja feature |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you also add negative tests for the undesirable cases I mentioned in my comments?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added in dc7aa9c.
@@ -996,7 +996,7 @@ func (r *Rule) sync() { | |||
func ShouldKeep(e bzl.Expr) bool { | |||
for _, c := range append(e.Comment().Before, e.Comment().Suffix...) { | |||
text := strings.TrimSpace(strings.TrimPrefix(c.Token, "#")) | |||
if text == "keep" { | |||
if text == "keep" || strings.HasPrefix(text, "keep: ") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please also document this new capability under https://github.com/bazelbuild/bazel-gazelle#keep-comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated in 708dd8b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
[](https://renovatebot.com) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [bazel_gazelle](https://togithub.com/bazelbuild/bazel-gazelle) | http_archive | minor | `v0.29.0` -> `v0.30.0` | --- ### Release Notes <details> <summary>bazelbuild/bazel-gazelle</summary> ### [`v0.30.0`](https://togithub.com/bazelbuild/bazel-gazelle/releases/tag/v0.30.0) [Compare Source](https://togithub.com/bazelbuild/bazel-gazelle/compare/v0.29.0...v0.30.0) #### What's Changed - fix: add missing Starlark dependency and introduce `bzl_test` by [@​cgrindel](https://togithub.com/cgrindel) in [https://github.com/bazelbuild/bazel-gazelle/pull/1413](https://togithub.com/bazelbuild/bazel-gazelle/pull/1413) - Upgrade rules_go and known imports by [@​linzhp](https://togithub.com/linzhp) in [https://github.com/bazelbuild/bazel-gazelle/pull/1426](https://togithub.com/bazelbuild/bazel-gazelle/pull/1426) - Regenerate known imports from downgraded go_googleapis by [@​linzhp](https://togithub.com/linzhp) in [https://github.com/bazelbuild/bazel-gazelle/pull/1429](https://togithub.com/bazelbuild/bazel-gazelle/pull/1429) - testdata with buildable Go pkg deep below by [@​linzhp](https://togithub.com/linzhp) in [https://github.com/bazelbuild/bazel-gazelle/pull/1433](https://togithub.com/bazelbuild/bazel-gazelle/pull/1433) - language/go: add //go:embed all:<pattern> support by [@​mbicz](https://togithub.com/mbicz) in [https://github.com/bazelbuild/bazel-gazelle/pull/1432](https://togithub.com/bazelbuild/bazel-gazelle/pull/1432) - Fix `go mod download` output expectation for errors by [@​illicitonion](https://togithub.com/illicitonion) in [https://github.com/bazelbuild/bazel-gazelle/pull/1442](https://togithub.com/bazelbuild/bazel-gazelle/pull/1442) - Apply map_kind to existing rules as well as new ones by [@​illicitonion](https://togithub.com/illicitonion) in [https://github.com/bazelbuild/bazel-gazelle/pull/1425](https://togithub.com/bazelbuild/bazel-gazelle/pull/1425) - Ignore symlinks into Bazel output rather than relying on name by [@​cpsauer](https://togithub.com/cpsauer) in [https://github.com/bazelbuild/bazel-gazelle/pull/1384](https://togithub.com/bazelbuild/bazel-gazelle/pull/1384) - Use `short_path` for `go` in the wrapper by [@​fmeum](https://togithub.com/fmeum) in [https://github.com/bazelbuild/bazel-gazelle/pull/1446](https://togithub.com/bazelbuild/bazel-gazelle/pull/1446) - feature: gazelle wrapper allows to pass environment variables by [@​manuelnaranjo](https://togithub.com/manuelnaranjo) in [https://github.com/bazelbuild/bazel-gazelle/pull/1438](https://togithub.com/bazelbuild/bazel-gazelle/pull/1438) - Update directive documentation by [@​moisesvega](https://togithub.com/moisesvega) in [https://github.com/bazelbuild/bazel-gazelle/pull/1454](https://togithub.com/bazelbuild/bazel-gazelle/pull/1454) - Update gazelle directive documenmtation. by [@​moisesvega](https://togithub.com/moisesvega) in [https://github.com/bazelbuild/bazel-gazelle/pull/1455](https://togithub.com/bazelbuild/bazel-gazelle/pull/1455) - Default Visibility extension overwrite on descent (fixes [#​1467](https://togithub.com/bazelbuild/bazel-gazelle/issues/1467)) by [@​dnathe4th](https://togithub.com/dnathe4th) in [https://github.com/bazelbuild/bazel-gazelle/pull/1472](https://togithub.com/bazelbuild/bazel-gazelle/pull/1472) - Allow keep to be explained by [@​stevebarrau](https://togithub.com/stevebarrau) in [https://github.com/bazelbuild/bazel-gazelle/pull/1447](https://togithub.com/bazelbuild/bazel-gazelle/pull/1447) - Respect repo_name in MODULE.bazel for load generation by [@​fmeum](https://togithub.com/fmeum) in [https://github.com/bazelbuild/bazel-gazelle/pull/1463](https://togithub.com/bazelbuild/bazel-gazelle/pull/1463) - Add `.ijwb` to `.gitignore` by [@​fmeum](https://togithub.com/fmeum) in [https://github.com/bazelbuild/bazel-gazelle/pull/1478](https://togithub.com/bazelbuild/bazel-gazelle/pull/1478) - Use spaces instead of tabs in go_repositor_tools_srcs.bzl by [@​fmeum](https://togithub.com/fmeum) in [https://github.com/bazelbuild/bazel-gazelle/pull/1479](https://togithub.com/bazelbuild/bazel-gazelle/pull/1479) - Run buildifier by [@​fmeum](https://togithub.com/fmeum) in [https://github.com/bazelbuild/bazel-gazelle/pull/1480](https://togithub.com/bazelbuild/bazel-gazelle/pull/1480) - bzlmod: Test BCR test module on all platforms by [@​fmeum](https://togithub.com/fmeum) in [https://github.com/bazelbuild/bazel-gazelle/pull/1481](https://togithub.com/bazelbuild/bazel-gazelle/pull/1481) - bzlmod: Allow overriding default Go module configuration by [@​seh](https://togithub.com/seh) in [https://github.com/bazelbuild/bazel-gazelle/pull/1456](https://togithub.com/bazelbuild/bazel-gazelle/pull/1456) - fix(bzlmod): apply go.sum sums after version resolution by [@​tyler-french](https://togithub.com/tyler-french) in [https://github.com/bazelbuild/bazel-gazelle/pull/1477](https://togithub.com/bazelbuild/bazel-gazelle/pull/1477) - fix(bzlmod/go_deps): don't read go.sum for empty go.mod files by [@​tyler-french](https://togithub.com/tyler-french) in [https://github.com/bazelbuild/bazel-gazelle/pull/1484](https://togithub.com/bazelbuild/bazel-gazelle/pull/1484) - feat(bzlmod): support go.mod replace directives by [@​tyler-french](https://togithub.com/tyler-french) in [https://github.com/bazelbuild/bazel-gazelle/pull/1450](https://togithub.com/bazelbuild/bazel-gazelle/pull/1450) - README update mentioning gazelle-haskell-modules by [@​kczulko](https://togithub.com/kczulko) in [https://github.com/bazelbuild/bazel-gazelle/pull/1439](https://togithub.com/bazelbuild/bazel-gazelle/pull/1439) - Exclude `.ijwb` from repository tools srcs by [@​fmeum](https://togithub.com/fmeum) in [https://github.com/bazelbuild/bazel-gazelle/pull/1490](https://togithub.com/bazelbuild/bazel-gazelle/pull/1490) - bzlmod: Fix interaction between replace and implicit upgrade check by [@​fmeum](https://togithub.com/fmeum) in [https://github.com/bazelbuild/bazel-gazelle/pull/1492](https://togithub.com/bazelbuild/bazel-gazelle/pull/1492) #### New Contributors - [@​darist](https://togithub.com/darist) made their first contribution in [https://github.com/bazelbuild/bazel-gazelle/pull/1410](https://togithub.com/bazelbuild/bazel-gazelle/pull/1410) - [@​mbicz](https://togithub.com/mbicz) made their first contribution in [https://github.com/bazelbuild/bazel-gazelle/pull/1432](https://togithub.com/bazelbuild/bazel-gazelle/pull/1432) - [@​cpsauer](https://togithub.com/cpsauer) made their first contribution in [https://github.com/bazelbuild/bazel-gazelle/pull/1384](https://togithub.com/bazelbuild/bazel-gazelle/pull/1384) - [@​manuelnaranjo](https://togithub.com/manuelnaranjo) made their first contribution in [https://github.com/bazelbuild/bazel-gazelle/pull/1438](https://togithub.com/bazelbuild/bazel-gazelle/pull/1438) - [@​moisesvega](https://togithub.com/moisesvega) made their first contribution in [https://github.com/bazelbuild/bazel-gazelle/pull/1454](https://togithub.com/bazelbuild/bazel-gazelle/pull/1454) - [@​stevebarrau](https://togithub.com/stevebarrau) made their first contribution in [https://github.com/bazelbuild/bazel-gazelle/pull/1447](https://togithub.com/bazelbuild/bazel-gazelle/pull/1447) - [@​seh](https://togithub.com/seh) made their first contribution in [https://github.com/bazelbuild/bazel-gazelle/pull/1456](https://togithub.com/bazelbuild/bazel-gazelle/pull/1456) - [@​kczulko](https://togithub.com/kczulko) made their first contribution in [https://github.com/bazelbuild/bazel-gazelle/pull/1439](https://togithub.com/bazelbuild/bazel-gazelle/pull/1439) **Full Changelog**: bazel-contrib/bazel-gazelle@v0.29.0...v0.30.0 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/cgrindel/bazel-starlib). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNS4yMy4zIiwidXBkYXRlZEluVmVyIjoiMzUuMjMuMyJ9--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
[](https://renovatebot.com) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [bazel_gazelle](https://togithub.com/bazelbuild/bazel-gazelle) | http_archive | minor | `v0.29.0` -> `v0.30.0` | --- ### ⚠ Dependency Lookup Warnings ⚠ Warnings were logged while processing this repo. Please check the Dependency Dashboard for more information. --- ### Release Notes <details> <summary>bazelbuild/bazel-gazelle</summary> ### [`v0.30.0`](https://togithub.com/bazelbuild/bazel-gazelle/releases/tag/v0.30.0) [Compare Source](https://togithub.com/bazelbuild/bazel-gazelle/compare/v0.29.0...v0.30.0) #### What's Changed - fix: add missing Starlark dependency and introduce `bzl_test` by [@​cgrindel](https://togithub.com/cgrindel) in [https://github.com/bazelbuild/bazel-gazelle/pull/1413](https://togithub.com/bazelbuild/bazel-gazelle/pull/1413) - Upgrade rules_go and known imports by [@​linzhp](https://togithub.com/linzhp) in [https://github.com/bazelbuild/bazel-gazelle/pull/1426](https://togithub.com/bazelbuild/bazel-gazelle/pull/1426) - Regenerate known imports from downgraded go_googleapis by [@​linzhp](https://togithub.com/linzhp) in [https://github.com/bazelbuild/bazel-gazelle/pull/1429](https://togithub.com/bazelbuild/bazel-gazelle/pull/1429) - testdata with buildable Go pkg deep below by [@​linzhp](https://togithub.com/linzhp) in [https://github.com/bazelbuild/bazel-gazelle/pull/1433](https://togithub.com/bazelbuild/bazel-gazelle/pull/1433) - language/go: add //go:embed all:<pattern> support by [@​mbicz](https://togithub.com/mbicz) in [https://github.com/bazelbuild/bazel-gazelle/pull/1432](https://togithub.com/bazelbuild/bazel-gazelle/pull/1432) - Fix `go mod download` output expectation for errors by [@​illicitonion](https://togithub.com/illicitonion) in [https://github.com/bazelbuild/bazel-gazelle/pull/1442](https://togithub.com/bazelbuild/bazel-gazelle/pull/1442) - Apply map_kind to existing rules as well as new ones by [@​illicitonion](https://togithub.com/illicitonion) in [https://github.com/bazelbuild/bazel-gazelle/pull/1425](https://togithub.com/bazelbuild/bazel-gazelle/pull/1425) - Ignore symlinks into Bazel output rather than relying on name by [@​cpsauer](https://togithub.com/cpsauer) in [https://github.com/bazelbuild/bazel-gazelle/pull/1384](https://togithub.com/bazelbuild/bazel-gazelle/pull/1384) - Use `short_path` for `go` in the wrapper by [@​fmeum](https://togithub.com/fmeum) in [https://github.com/bazelbuild/bazel-gazelle/pull/1446](https://togithub.com/bazelbuild/bazel-gazelle/pull/1446) - feature: gazelle wrapper allows to pass environment variables by [@​manuelnaranjo](https://togithub.com/manuelnaranjo) in [https://github.com/bazelbuild/bazel-gazelle/pull/1438](https://togithub.com/bazelbuild/bazel-gazelle/pull/1438) - Update directive documentation by [@​moisesvega](https://togithub.com/moisesvega) in [https://github.com/bazelbuild/bazel-gazelle/pull/1454](https://togithub.com/bazelbuild/bazel-gazelle/pull/1454) - Update gazelle directive documenmtation. by [@​moisesvega](https://togithub.com/moisesvega) in [https://github.com/bazelbuild/bazel-gazelle/pull/1455](https://togithub.com/bazelbuild/bazel-gazelle/pull/1455) - Default Visibility extension overwrite on descent (fixes [#​1467](https://togithub.com/bazelbuild/bazel-gazelle/issues/1467)) by [@​dnathe4th](https://togithub.com/dnathe4th) in [https://github.com/bazelbuild/bazel-gazelle/pull/1472](https://togithub.com/bazelbuild/bazel-gazelle/pull/1472) - Allow keep to be explained by [@​stevebarrau](https://togithub.com/stevebarrau) in [https://github.com/bazelbuild/bazel-gazelle/pull/1447](https://togithub.com/bazelbuild/bazel-gazelle/pull/1447) - Respect repo_name in MODULE.bazel for load generation by [@​fmeum](https://togithub.com/fmeum) in [https://github.com/bazelbuild/bazel-gazelle/pull/1463](https://togithub.com/bazelbuild/bazel-gazelle/pull/1463) - Add `.ijwb` to `.gitignore` by [@​fmeum](https://togithub.com/fmeum) in [https://github.com/bazelbuild/bazel-gazelle/pull/1478](https://togithub.com/bazelbuild/bazel-gazelle/pull/1478) - Use spaces instead of tabs in go_repositor_tools_srcs.bzl by [@​fmeum](https://togithub.com/fmeum) in [https://github.com/bazelbuild/bazel-gazelle/pull/1479](https://togithub.com/bazelbuild/bazel-gazelle/pull/1479) - Run buildifier by [@​fmeum](https://togithub.com/fmeum) in [https://github.com/bazelbuild/bazel-gazelle/pull/1480](https://togithub.com/bazelbuild/bazel-gazelle/pull/1480) - bzlmod: Test BCR test module on all platforms by [@​fmeum](https://togithub.com/fmeum) in [https://github.com/bazelbuild/bazel-gazelle/pull/1481](https://togithub.com/bazelbuild/bazel-gazelle/pull/1481) - bzlmod: Allow overriding default Go module configuration by [@​seh](https://togithub.com/seh) in [https://github.com/bazelbuild/bazel-gazelle/pull/1456](https://togithub.com/bazelbuild/bazel-gazelle/pull/1456) - fix(bzlmod): apply go.sum sums after version resolution by [@​tyler-french](https://togithub.com/tyler-french) in [https://github.com/bazelbuild/bazel-gazelle/pull/1477](https://togithub.com/bazelbuild/bazel-gazelle/pull/1477) - fix(bzlmod/go_deps): don't read go.sum for empty go.mod files by [@​tyler-french](https://togithub.com/tyler-french) in [https://github.com/bazelbuild/bazel-gazelle/pull/1484](https://togithub.com/bazelbuild/bazel-gazelle/pull/1484) - feat(bzlmod): support go.mod replace directives by [@​tyler-french](https://togithub.com/tyler-french) in [https://github.com/bazelbuild/bazel-gazelle/pull/1450](https://togithub.com/bazelbuild/bazel-gazelle/pull/1450) - README update mentioning gazelle-haskell-modules by [@​kczulko](https://togithub.com/kczulko) in [https://github.com/bazelbuild/bazel-gazelle/pull/1439](https://togithub.com/bazelbuild/bazel-gazelle/pull/1439) - Exclude `.ijwb` from repository tools srcs by [@​fmeum](https://togithub.com/fmeum) in [https://github.com/bazelbuild/bazel-gazelle/pull/1490](https://togithub.com/bazelbuild/bazel-gazelle/pull/1490) - bzlmod: Fix interaction between replace and implicit upgrade check by [@​fmeum](https://togithub.com/fmeum) in [https://github.com/bazelbuild/bazel-gazelle/pull/1492](https://togithub.com/bazelbuild/bazel-gazelle/pull/1492) #### New Contributors - [@​darist](https://togithub.com/darist) made their first contribution in [https://github.com/bazelbuild/bazel-gazelle/pull/1410](https://togithub.com/bazelbuild/bazel-gazelle/pull/1410) - [@​mbicz](https://togithub.com/mbicz) made their first contribution in [https://github.com/bazelbuild/bazel-gazelle/pull/1432](https://togithub.com/bazelbuild/bazel-gazelle/pull/1432) - [@​cpsauer](https://togithub.com/cpsauer) made their first contribution in [https://github.com/bazelbuild/bazel-gazelle/pull/1384](https://togithub.com/bazelbuild/bazel-gazelle/pull/1384) - [@​manuelnaranjo](https://togithub.com/manuelnaranjo) made their first contribution in [https://github.com/bazelbuild/bazel-gazelle/pull/1438](https://togithub.com/bazelbuild/bazel-gazelle/pull/1438) - [@​moisesvega](https://togithub.com/moisesvega) made their first contribution in [https://github.com/bazelbuild/bazel-gazelle/pull/1454](https://togithub.com/bazelbuild/bazel-gazelle/pull/1454) - [@​stevebarrau](https://togithub.com/stevebarrau) made their first contribution in [https://github.com/bazelbuild/bazel-gazelle/pull/1447](https://togithub.com/bazelbuild/bazel-gazelle/pull/1447) - [@​seh](https://togithub.com/seh) made their first contribution in [https://github.com/bazelbuild/bazel-gazelle/pull/1456](https://togithub.com/bazelbuild/bazel-gazelle/pull/1456) - [@​kczulko](https://togithub.com/kczulko) made their first contribution in [https://github.com/bazelbuild/bazel-gazelle/pull/1439](https://togithub.com/bazelbuild/bazel-gazelle/pull/1439) **Full Changelog**: bazel-contrib/bazel-gazelle@v0.29.0...v0.30.0 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/kreempuff/rules_unreal_engine). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNS4yMy4zIiwidXBkYXRlZEluVmVyIjoiMzUuNDAuMCJ9-->
What type of PR is this?
Feature
What package or component does this PR mostly affect?
rule
What does this PR do? Why is it needed?
Allow the # keep comment to take more text after them for the keep author to add a reference to a ticket or to explain the need for the keep.