You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@grails.apache.org by "jamesfredley (via GitHub)" <gi...@apache.org> on 2026/07/17 08:47:16 UTC

[PR] Enable CodeNarc EmptyCatchBlock checks [grails-core]

jamesfredley opened a new pull request, #15991:
URL: https://github.com/apache/grails-core/pull/15991

   ## Summary
   
   - enable CodeNarc EmptyCatchBlock at priority 3
   - mark each reviewed intentional empty catch explicitly with the supported ignored parameter convention
   - add concise context or debug logging where silent fallback was not self-explanatory
   - retain normal priority thresholds without global violation budgets or file exclusions
   
   ## Verification
   
   - full root test suite: 2,990 tests, 0 failures, 54 skipped
   - aggregateViolations: zero EmptyCatchBlock findings
   - git diff --check
   
   This is an AI-generated starting point for stricter empty-catch enforcement.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@grails.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Enable CodeNarc EmptyCatchBlock checks [grails-core]

Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #15991:
URL: https://github.com/apache/grails-core/pull/15991#discussion_r3601747663


##########
grails-data-hibernate5/core/src/main/groovy/org/grails/orm/hibernate/AbstractHibernateGormInstanceApi.groovy:
##########
@@ -337,7 +337,7 @@ abstract class AbstractHibernateGormInstanceApi<D> extends GormInstanceApi<D> {
                         }
                     }
                 }
-                catch (InvalidPropertyException ipe) {
+                catch (InvalidPropertyException ignored) {
                     // property is not accessable

Review Comment:
   Spelling in the comment: "accessable" → "accessible".



##########
grails-web-url-mappings/src/main/groovy/org/grails/web/mapping/DefaultLinkGenerator.groovy:
##########
@@ -438,7 +438,9 @@ class DefaultLinkGenerator implements LinkGenerator, PluginManagerAware {
                     if (str) {
                         absolute = Boolean.parseBoolean(str)
                     }
-                } catch (e) {}
+                } catch (e) {
+                    log.debug('Unable to parse absolute link attribute', e)
+                }

Review Comment:
   The catch clause is untyped (`catch (e)`), which effectively catches very broadly and can hide serious errors. Since this block is only guarding `toString()`/`parseBoolean`, restrict the catch to `Exception` so `Error`s (e.g., OOME) are not swallowed.



##########
grails-shell-cli/src/main/groovy/org/grails/cli/profile/commands/CreateAppCommand.groovy:
##########
@@ -778,7 +778,7 @@ class CreateAppCommand extends ArgumentCompletingCommand implements ProfileRepos
     private void deleteDirectory(File directory) {
         try {
             directory?.deleteDir()
-        } catch (Throwable t) {
+        } catch (Throwable ignored) {
             // Ignore error deleting temporal directory

Review Comment:
   Spelling in the comment: "temporal directory" reads like a time-related directory; this appears to mean "temporary directory".



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@grails.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Enable CodeNarc EmptyCatchBlock checks [grails-core]

Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #15991:
URL: https://github.com/apache/grails-core/pull/15991#issuecomment-5001342576

   ## [Codecov](https://app.codecov.io/gh/apache/grails-core/pull/15991?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   :x: Patch coverage is `28.57143%` with `5 lines` in your changes missing coverage. Please review.
   :white_check_mark: Project coverage is 51.1152%. Comparing base ([`b980413`](https://app.codecov.io/gh/apache/grails-core/commit/b980413820757347744aa6c10c44d7103babea39?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`75f02aa`](https://app.codecov.io/gh/apache/grails-core/commit/75f02aaff8f018ffe3dc060ee81ed230e818d0c6?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   
   | [Files with missing lines](https://app.codecov.io/gh/apache/grails-core/pull/15991?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
   |---|---|---|
   | [...ovy/org/grails/plugins/support/WatchPattern.groovy](https://app.codecov.io/gh/apache/grails-core/pull/15991?src=pr&el=tree&filepath=grails-core%2Fsrc%2Fmain%2Fgroovy%2Forg%2Fgrails%2Fplugins%2Fsupport%2FWatchPattern.groovy&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-Z3JhaWxzLWNvcmUvc3JjL21haW4vZ3Jvb3Z5L29yZy9ncmFpbHMvcGx1Z2lucy9zdXBwb3J0L1dhdGNoUGF0dGVybi5ncm9vdnk=) | 0.0000% | [1 Missing :warning: ](https://app.codecov.io/gh/apache/grails-core/pull/15991?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [...ins/datasource/EmbeddedDatabaseShutdownHook.groovy](https://app.codecov.io/gh/apache/grails-core/pull/15991?src=pr&el=tree&filepath=grails-datasource%2Fsrc%2Fmain%2Fgroovy%2Forg%2Fgrails%2Fplugins%2Fdatasource%2FEmbeddedDatabaseShutdownHook.groovy&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-Z3JhaWxzLWRhdGFzb3VyY2Uvc3JjL21haW4vZ3Jvb3Z5L29yZy9ncmFpbHMvcGx1Z2lucy9kYXRhc291cmNlL0VtYmVkZGVkRGF0YWJhc2VTaHV0ZG93bkhvb2suZ3Jvb3Z5) | 0.0000% | [1 Missing :warning: ](https://app.codecov.io/gh/apache/grails-core/pull/15991?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [...li/src/main/groovy/org/grails/cli/GrailsCli.groovy](https://app.codecov.io/gh/apache/grails-core/pull/15991?src=pr&el=tree&filepath=grails-shell-cli%2Fsrc%2Fmain%2Fgroovy%2Forg%2Fgrails%2Fcli%2FGrailsCli.groovy&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-Z3JhaWxzLXNoZWxsLWNsaS9zcmMvbWFpbi9ncm9vdnkvb3JnL2dyYWlscy9jbGkvR3JhaWxzQ2xpLmdyb292eQ==) | 0.0000% | [1 Missing :warning: ](https://app.codecov.io/gh/apache/grails-core/pull/15991?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [...vy/org/grails/cli/gradle/GradleAsyncInvoker.groovy](https://app.codecov.io/gh/apache/grails-core/pull/15991?src=pr&el=tree&filepath=grails-shell-cli%2Fsrc%2Fmain%2Fgroovy%2Forg%2Fgrails%2Fcli%2Fgradle%2FGradleAsyncInvoker.groovy&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-Z3JhaWxzLXNoZWxsLWNsaS9zcmMvbWFpbi9ncm9vdnkvb3JnL2dyYWlscy9jbGkvZ3JhZGxlL0dyYWRsZUFzeW5jSW52b2tlci5ncm9vdnk=) | 0.0000% | [1 Missing :warning: ](https://app.codecov.io/gh/apache/grails-core/pull/15991?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [...org/grails/web/mapping/DefaultLinkGenerator.groovy](https://app.codecov.io/gh/apache/grails-core/pull/15991?src=pr&el=tree&filepath=grails-web-url-mappings%2Fsrc%2Fmain%2Fgroovy%2Forg%2Fgrails%2Fweb%2Fmapping%2FDefaultLinkGenerator.groovy&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-Z3JhaWxzLXdlYi11cmwtbWFwcGluZ3Mvc3JjL21haW4vZ3Jvb3Z5L29yZy9ncmFpbHMvd2ViL21hcHBpbmcvRGVmYXVsdExpbmtHZW5lcmF0b3IuZ3Jvb3Z5) | 0.0000% | [1 Missing :warning: ](https://app.codecov.io/gh/apache/grails-core/pull/15991?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   [![Impacted file tree graph](https://app.codecov.io/gh/apache/grails-core/pull/15991/graphs/tree.svg?width=650&height=150&src=pr&token=qJrryhpk7u&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)](https://app.codecov.io/gh/apache/grails-core/pull/15991?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   
   ```diff
   @@               Coverage Diff                @@
   ##             8.0.x     #15991         +/-   ##
   ================================================
   + Coverage         0   51.1152%   +51.1152%     
   - Complexity       0      17597      +17597     
   ================================================
     Files            0       2041       +2041     
     Lines            0      95494      +95494     
     Branches         0      16587      +16587     
   ================================================
   + Hits             0      48812      +48812     
   - Misses           0      39394      +39394     
   - Partials         0       7288       +7288     
   ```
   
   | [Files with missing lines](https://app.codecov.io/gh/apache/grails-core/pull/15991?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
   |---|---|---|
   | [...mmand/GrailsApplicationContextCommandRunner.groovy](https://app.codecov.io/gh/apache/grails-core/pull/15991?src=pr&el=tree&filepath=grails-console%2Fsrc%2Fmain%2Fgroovy%2Fgrails%2Fui%2Fcommand%2FGrailsApplicationContextCommandRunner.groovy&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-Z3JhaWxzLWNvbnNvbGUvc3JjL21haW4vZ3Jvb3Z5L2dyYWlscy91aS9jb21tYW5kL0dyYWlsc0FwcGxpY2F0aW9uQ29udGV4dENvbW1hbmRSdW5uZXIuZ3Jvb3Z5) | `2.7778% <ø> (ø)` | |
   | [...ils/ui/script/GrailsApplicationScriptRunner.groovy](https://app.codecov.io/gh/apache/grails-core/pull/15991?src=pr&el=tree&filepath=grails-console%2Fsrc%2Fmain%2Fgroovy%2Fgrails%2Fui%2Fscript%2FGrailsApplicationScriptRunner.groovy&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-Z3JhaWxzLWNvbnNvbGUvc3JjL21haW4vZ3Jvb3Z5L2dyYWlscy91aS9zY3JpcHQvR3JhaWxzQXBwbGljYXRpb25TY3JpcHRSdW5uZXIuZ3Jvb3Z5) | `0.0000% <ø> (ø)` | |
   | [.../grails/boot/config/GrailsAutoConfiguration.groovy](https://app.codecov.io/gh/apache/grails-core/pull/15991?src=pr&el=tree&filepath=grails-core%2Fsrc%2Fmain%2Fgroovy%2Fgrails%2Fboot%2Fconfig%2FGrailsAutoConfiguration.groovy&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-Z3JhaWxzLWNvcmUvc3JjL21haW4vZ3Jvb3Z5L2dyYWlscy9ib290L2NvbmZpZy9HcmFpbHNBdXRvQ29uZmlndXJhdGlvbi5ncm9vdnk=) | `61.5385% <ø> (ø)` | |
   | [...y/grails/boot/config/tools/ClassPathScanner.groovy](https://app.codecov.io/gh/apache/grails-core/pull/15991?src=pr&el=tree&filepath=grails-core%2Fsrc%2Fmain%2Fgroovy%2Fgrails%2Fboot%2Fconfig%2Ftools%2FClassPathScanner.groovy&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-Z3JhaWxzLWNvcmUvc3JjL21haW4vZ3Jvb3Z5L2dyYWlscy9ib290L2NvbmZpZy90b29scy9DbGFzc1BhdGhTY2FubmVyLmdyb292eQ==) | `57.4074% <ø> (ø)` | |
   | [.../dev/commands/template/TemplateRendererImpl.groovy](https://app.codecov.io/gh/apache/grails-core/pull/15991?src=pr&el=tree&filepath=grails-core%2Fsrc%2Fmain%2Fgroovy%2Fgrails%2Fdev%2Fcommands%2Ftemplate%2FTemplateRendererImpl.groovy&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-Z3JhaWxzLWNvcmUvc3JjL21haW4vZ3Jvb3Z5L2dyYWlscy9kZXYvY29tbWFuZHMvdGVtcGxhdGUvVGVtcGxhdGVSZW5kZXJlckltcGwuZ3Jvb3Z5) | `0.0000% <ø> (ø)` | |
   | [...pport/PersistenceContextInterceptorExecutor.groovy](https://app.codecov.io/gh/apache/grails-core/pull/15991?src=pr&el=tree&filepath=grails-core%2Fsrc%2Fmain%2Fgroovy%2Fgrails%2Fpersistence%2Fsupport%2FPersistenceContextInterceptorExecutor.groovy&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-Z3JhaWxzLWNvcmUvc3JjL21haW4vZ3Jvb3Z5L2dyYWlscy9wZXJzaXN0ZW5jZS9zdXBwb3J0L1BlcnNpc3RlbmNlQ29udGV4dEludGVyY2VwdG9yRXhlY3V0b3IuZ3Jvb3Z5) | `0.0000% <ø> (ø)` | |
   | [...grails/core/exceptions/DefaultErrorsPrinter.groovy](https://app.codecov.io/gh/apache/grails-core/pull/15991?src=pr&el=tree&filepath=grails-core%2Fsrc%2Fmain%2Fgroovy%2Forg%2Fgrails%2Fcore%2Fexceptions%2FDefaultErrorsPrinter.groovy&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-Z3JhaWxzLWNvcmUvc3JjL21haW4vZ3Jvb3Z5L29yZy9ncmFpbHMvY29yZS9leGNlcHRpb25zL0RlZmF1bHRFcnJvcnNQcmludGVyLmdyb292eQ==) | `47.4748% <ø> (ø)` | |
   | [.../hibernate/AbstractHibernateGormInstanceApi.groovy](https://app.codecov.io/gh/apache/grails-core/pull/15991?src=pr&el=tree&filepath=grails-data-hibernate5%2Fcore%2Fsrc%2Fmain%2Fgroovy%2Forg%2Fgrails%2Form%2Fhibernate%2FAbstractHibernateGormInstanceApi.groovy&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-Z3JhaWxzLWRhdGEtaGliZXJuYXRlNS9jb3JlL3NyYy9tYWluL2dyb292eS9vcmcvZ3JhaWxzL29ybS9oaWJlcm5hdGUvQWJzdHJhY3RIaWJlcm5hdGVHb3JtSW5zdGFuY2VBcGkuZ3Jvb3Z5) | `64.6342% <ø> (ø)` | |
   | [...grails/datastore/gorm/mongo/simple/EnumType.groovy](https://app.codecov.io/gh/apache/grails-core/pull/15991?src=pr&el=tree&filepath=grails-data-mongodb%2Fcore%2Fsrc%2Fmain%2Fgroovy%2Forg%2Fgrails%2Fdatastore%2Fgorm%2Fmongo%2Fsimple%2FEnumType.groovy&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-Z3JhaWxzLWRhdGEtbW9uZ29kYi9jb3JlL3NyYy9tYWluL2dyb292eS9vcmcvZ3JhaWxzL2RhdGFzdG9yZS9nb3JtL21vbmdvL3NpbXBsZS9FbnVtVHlwZS5ncm9vdnk=) | `58.2418% <ø> (ø)` | |
   | [.../groovy/grails/databinding/SimpleDataBinder.groovy](https://app.codecov.io/gh/apache/grails-core/pull/15991?src=pr&el=tree&filepath=grails-databinding-core%2Fsrc%2Fmain%2Fgroovy%2Fgrails%2Fdatabinding%2FSimpleDataBinder.groovy&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-Z3JhaWxzLWRhdGFiaW5kaW5nLWNvcmUvc3JjL21haW4vZ3Jvb3Z5L2dyYWlscy9kYXRhYmluZGluZy9TaW1wbGVEYXRhQmluZGVyLmdyb292eQ==) | `75.2577% <100.0000%> (ø)` | |
   | ... and [24 more](https://app.codecov.io/gh/apache/grails-core/pull/15991?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | |
   
   ... and [2007 files with indirect coverage changes](https://app.codecov.io/gh/apache/grails-core/pull/15991/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   </details>
   <details><summary> :rocket: New features to boost your workflow: </summary>
   
   - :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
   - :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
   </details>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@grails.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Enable CodeNarc EmptyCatchBlock checks [grails-core]

Posted by "testlens-app[bot] (via GitHub)" <gi...@apache.org>.
testlens-app[bot] commented on PR #15991:
URL: https://github.com/apache/grails-core/pull/15991#issuecomment-5007309773

   ## ✅ All tests passed ✅
   
   🏷️ Commit: a082291aa9e283d50e075d1b23da2fb9da7ca4f1
   ▶️ Tests:  21511 executed
   ⚪️ Checks: 61/61 completed
   
   ---
   _Learn more about TestLens at [testlens.app](https://testlens.app)._
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@grails.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Enable CodeNarc EmptyCatchBlock checks [grails-core]

Posted by "testlens-app[bot] (via GitHub)" <gi...@apache.org>.
testlens-app[bot] commented on PR #15991:
URL: https://github.com/apache/grails-core/pull/15991#issuecomment-5002394161

   ## ✅ All tests passed ✅
   
   🏷️ Commit: 75f02aaff8f018ffe3dc060ee81ed230e818d0c6
   ▶️ Tests:  58443 executed
   ⚪️ Checks: 63/63 completed
   
   ---
   _Learn more about TestLens at [testlens.app](https://testlens.app)._
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@grails.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Enable CodeNarc EmptyCatchBlock checks [grails-core]

Posted by "matrei (via GitHub)" <gi...@apache.org>.
matrei commented on PR #15991:
URL: https://github.com/apache/grails-core/pull/15991#issuecomment-5014918830

   > I'm interested to know what @matrei thinks about this. I'm good if he is.
   
   Yes, I like this. Maybe we can also remove the redundant comments that do not add any info, but just says `// ignore`?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@grails.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Enable CodeNarc EmptyCatchBlock checks [grails-core]

Posted by "jamesfredley (via GitHub)" <gi...@apache.org>.
jamesfredley merged PR #15991:
URL: https://github.com/apache/grails-core/pull/15991


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@grails.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Enable CodeNarc EmptyCatchBlock checks [grails-core]

Posted by "jdaugherty (via GitHub)" <gi...@apache.org>.
jdaugherty commented on PR #15991:
URL: https://github.com/apache/grails-core/pull/15991#issuecomment-5014082250

   I'm interested to know what @matrei thinks about this. I'm good if he is.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@grails.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org