|
| 1 | +# jacoco-method-filter — Default Rules & HowTo (Scala) |
| 2 | +# [jmf:1.0.0] |
| 3 | +# |
| 4 | +# This file defines which methods should be annotated as *Generated so JaCoCo ignores them. |
| 5 | +# One rule per line. |
| 6 | +# |
| 7 | +# ───────────────────────────────────────────────────────────────────────────── |
| 8 | +# HOW TO USE (quick) |
| 9 | +# 1) Replace YOUR.PACKAGE.ROOT with your project’s package root (e.g., com.example.app). |
| 10 | +# 2) Start with the CONSERVATIVE section only. |
| 11 | +# 3) If clean, enable STANDARD. Use AGGRESSIVE only inside DTO/auto‑generated packages. |
| 12 | +# 4) Keep rules narrow (by package), prefer flags (synthetic/bridge) for compiler artifacts, |
| 13 | +# and add `id:` labels so logs are easy to read. |
| 14 | +# |
| 15 | +# ───────────────────────────────────────────────────────────────────────────── |
| 16 | +# ALLOWED SYNTAX (cheat sheet) |
| 17 | +# |
| 18 | +# General form: |
| 19 | +# <FQCN_glob>#<method_glob>(<descriptor_glob>) [FLAGS and PREDICATES...] |
| 20 | +# |
| 21 | +# FQCN_glob (dot form; $ allowed for inner classes): |
| 22 | +# Examples: *.model.*, com.example.*, * |
| 23 | +# |
| 24 | +# method_glob (glob on method name): |
| 25 | +# Examples: copy | $anonfun$* | get* | *_$eq |
| 26 | +# |
| 27 | +# descriptor_glob (JVM descriptor in (args)ret). You may omit it entirely. |
| 28 | +# • Omitting descriptor ⇒ treated as "(*)*" (any args, any return). |
| 29 | +# • Short/empty forms "", "()", "(*)" normalize to "(*)*". |
| 30 | +# Examples: |
| 31 | +# (I)I # takes int, returns int |
| 32 | +# (Ljava/lang/String;)V # takes String, returns void |
| 33 | +# () or (*) or omitted # any args, any return |
| 34 | +# |
| 35 | +# FLAGS (optional) — space or comma separated: |
| 36 | +# public | protected | private | synthetic | bridge | static | abstract |
| 37 | +# |
| 38 | +# PREDICATES (optional): |
| 39 | +# ret:<glob> # match return type only (e.g., ret:V, ret:I, ret:Lcom/example/*;) |
| 40 | +# id:<string> # identifier shown in logs/reports |
| 41 | +# name-contains:<s> # method name must contain <s> |
| 42 | +# name-starts:<s> # method name must start with <s> |
| 43 | +# name-ends:<s> # method name must end with <s> |
| 44 | +# |
| 45 | +# Notes |
| 46 | +# - Always use dot-form (com.example.Foo) for class names. |
| 47 | +# - Comments (# …) and blank lines are ignored. |
| 48 | +# |
| 49 | +# ───────────────────────────────────────────────────────────────────────────── |
| 50 | +# QUICK EXAMPLES |
| 51 | +# |
| 52 | +# Simple wildcards |
| 53 | +# *#*(*) |
| 54 | +# → Match EVERY method in EVERY class (any package). Useful only for diagnostics. |
| 55 | +# "(*)" normalizes to "(*)*" ⇒ any args, any return. |
| 56 | +# *.dto.*#*(*) |
| 57 | +# → Match every method on any class under any package segment named "dto". |
| 58 | +# Good when you treat DTOs as generated/boilerplate. |
| 59 | + |
| 60 | +# Scala case class helpers |
| 61 | +# *.model.*#copy(*) |
| 62 | +# → Matches Scala case-class `copy` methods under `*.model.*`. |
| 63 | +# Hides boilerplate clones with any parameter list and any return. |
| 64 | +# *.model.*#productArity() |
| 65 | +# → Matches zero-arg `productArity` (case-class/Product API). |
| 66 | +# *.model.*#productElement(*) |
| 67 | +# → Matches `productElement(int)` (or any descriptor form) on case classes. |
| 68 | +# *.model.*#productPrefix() |
| 69 | +# → Matches `productPrefix()`; returns the case class' constructor name. |
| 70 | + |
| 71 | +# Companion objects and defaults |
| 72 | +# *.model.*$*#apply(*) |
| 73 | +# → Matches companion `apply` factories under `*.model.*` (any args). |
| 74 | +# BE CAREFUL: can hide real factory logic; keep the package scope narrow. |
| 75 | +# *.model.*$*#unapply(*) |
| 76 | +# → Matches extractor `unapply` methods in companions under `*.model.*`. |
| 77 | +# *#*$default$*(*) |
| 78 | +# → Matches Scala-generated default-argument helpers everywhere. |
| 79 | +# Safe to keep enabled; they’re compiler-synthesized. |
| 80 | + |
| 81 | +# Anonymous / synthetic / bridge |
| 82 | +# *#$anonfun$* |
| 83 | +# → Matches any method whose name contains `$anonfun$` (Scala lambdas). |
| 84 | +# Consider adding `synthetic` and/or a package scope in real configs. |
| 85 | +# *#*(*):synthetic # any synthetic |
| 86 | +# → Matches ANY method marked `synthetic` (compiler-generated). |
| 87 | +# Powerful; scope by package to avoid hiding intentional glue code. |
| 88 | +# *#*(*):bridge # any bridge |
| 89 | +# → Matches Java generic bridge methods the compiler inserts. |
| 90 | +# Usually safe globally, but scoping is still recommended. |
| 91 | + |
| 92 | +# Setters / fluent APIs |
| 93 | +# *.dto.*#*_$eq(*) |
| 94 | +# → Matches Scala var setters in DTO packages (e.g., `name_=(...)`). |
| 95 | +# Good for excluding trivial field writes. |
| 96 | +# *.builder.*#with*(*) |
| 97 | +# → Matches builder-style fluent setters (`withXxx(...)`) in builder pkgs. |
| 98 | +# Treats chainable configuration as boilerplate. |
| 99 | +# *.client.*#with*(*) ret:Lcom/api/client/* |
| 100 | +# → Like above but ONLY when the return type matches your client package. |
| 101 | +# The `ret:` predicate protects real logic that returns other types. |
| 102 | + |
| 103 | +# Return-type constraints |
| 104 | +# *.jobs.*#*(*):ret:V |
| 105 | +# → Any method under `*.jobs.*` returning `void` (`V`). Often orchestration. |
| 106 | +# *.math.*#*(*):ret:I |
| 107 | +# → Any method under `*.math.*` returning primitive int (`I`). |
| 108 | +# *.model.*#*(*):ret:Lcom/example/model/* |
| 109 | +# → Any method under `*.model.*` that returns a type in `com.example.model`. |
| 110 | +# Handy when the *return type* uniquely identifies boilerplate. |
| 111 | + |
| 112 | +# ───────────────────────────────────────────────────────────────────────────── |
| 113 | +# GLOBALS RULES |
| 114 | +# ───────────────────────────────────────────────────────────────────────────── |
| 115 | +# ** all case class boilerplate |
| 116 | + |
| 117 | +# Scala case class helpers |
| 118 | +*#canEqual(*) id:case-canequal |
| 119 | +*#equals(*) id:case-equals |
| 120 | +*#apply(*) id:case-apply |
| 121 | +*#unapply(*) id:case-unapply |
| 122 | +*#hashCode(*) id:case-hashcode |
| 123 | +*#copy(*) id:case-copy |
| 124 | +*#copy$default$*(*) id:case-copy-defaults |
| 125 | +*#productElement() id:case-prod-element |
| 126 | +*#productArity() id:case-prod-arity |
| 127 | +*#productPrefix() id:case-prod-prefix |
| 128 | +*#productIterator() id:case-prod-iterator |
| 129 | +*#tupled() id:case-tupled |
| 130 | +*#curried() id:case-curried |
| 131 | +*#toString() id:case-tostring |
| 132 | +*#name() id:case-name |
| 133 | +*#groups() id:case-groups |
| 134 | +*#optionalAttributes() id:case-optionalAttributes |
| 135 | + |
| 136 | +# Companion objects, constructors, and static definitions |
| 137 | +*$#<init>(*) id:gen-ctor # constructors |
| 138 | +*$#<clinit>() id:gen-clinit # static initializer blocks |
| 139 | + |
| 140 | +# Companion objects and defaults |
| 141 | +*$*#apply(*) id:comp-apply |
| 142 | +*$*#unapply(*) id:comp-unapply |
| 143 | +*$*#toString(*) id:comp-tostring |
| 144 | +*$*#readResolve(*) id:comp-readresolve |
| 145 | + |
| 146 | +# anonymous class created by a macro expansion |
| 147 | +*$macro$*#$anonfun$inst$macro$* id:macro-inst |
| 148 | +*$macro$*#inst$macro$* id:macro-inst |
| 149 | + |
| 150 | +# lambda |
| 151 | +*#* synthetic name-contains:$anonfun$ id:scala-anonfun |
| 152 | + |
| 153 | +# ───────────────────────────────────────────────────────────────────────────── |
| 154 | +# PROJECT RULES |
| 155 | +# ───────────────────────────────────────────────────────────────────────────── |
| 156 | + |
| 157 | +# Options for method filtering: |
| 158 | +# *.api.http*#* |
| 159 | +# *.config*#* |
| 160 | +# za.co.absa.statusboard.Main*#* |
| 161 | +# za.co.absa.statusboard.repository.DynamoDb*#* |
| 162 | +# za.co.absa.statusboard.utils.DynamoDb*#* |
0 commit comments