MaibornWolff / metric-gardener

BSD 3-Clause "New" or "Revised" License
5 stars 0 forks source link

Coupling metric: Use tree-sitter method `Query.matches()` instead of `Query.captures()` for querying types #355

Open mylinhdao opened 1 month ago

mylinhdao commented 1 month ago

Use the method Parser.Query.matches() instead of Parser.Query.captures() to get the types and their namespaces from syntax tree. This is because the method captures() return an array. Currently, if we want to find out which type belongs to which namespace, we rely on the order of elements in that array (ex. class at index n belongs to the next namespace at index < n).