• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

jpedroh / generic-merge / 10030328882
80%

Build:
DEFAULT BRANCH: main
Ran 21 Jul 2024 06:07PM UTC
Jobs 1
Files 46
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

21 Jul 2024 06:05PM UTC coverage: 80.247% (-2.0%) from 82.296%
10030328882

push

github

web-flow
feat: Introduce custom identifier extraction mecanism (#62)

Up until now, we used matching handlers to capture special node
identifiers, diverging from their intended purpose. This approach also
required users to add Rust code to the project, limiting the tool's
generalization and extensibility.

This PR changes how node identifiers are extracted by moving the
extraction process to the parsing step. This improves performance (as it
runs only once per parse) and leverages Tree-sitter’s pattern matching
query functionality.

Users can now provide a configuration with node types and a Tree-sitter
query expression to extract identifiers. For example, in a Java class, a
user can extract a field declaration identifier using the query
`(variable_declarator name: _ @field_name)`, which captures the field
name.

However, Tree-sitter pattern matching can fall short in some cases. For
instance, when trying to retrieve the identifier for a class with an
inner class:

```java
class A {
    class B {
    }
}
```

Using the query `(class_declaration (identifier) @class_name)` matches
both classes A and B, resulting in `[A, B]` as the identifier, which is
incorrect. Since Tree-sitter’s query language doesn’t support matching a
single entry - this has to be done in userland code, which would
complicate the identifier extraction process.

To address this, this PR introduces the option to use a Regular
Expression for identifier extraction. The regular expression runs on the
node’s source code and captures only the first match. In this case,
`class [A-Za-z_][A-Za-z0-9_]*` correctly matches the class name, and we
can safely discard the match for class B (since only the first match is
considered).

These changes simplify the introduction of new extractors and eliminate
approximately 600 lines of Rust code (tests and source code) previously
used for node identifier extraction.

579 of 1059 branches covered (54.67%)

Branch coverage included in aggregate %.

182 of 183 new or added lines in 16 files covered. (99.45%)

57 existing lines in 2 files now uncovered.

2147 of 2338 relevant lines covered (91.83%)

271296.56 hits per line

Jobs
ID Job ID Ran Files Coverage
1 10030328882.1 21 Jul 2024 06:07PM UTC 0
80.25
GitHub Action Run
Source Files on build 10030328882
Detailed source file information is not available for this build.
  • Back to Repo
  • 2c6a135a on github
  • Prev Build on main (#10008386243)
  • Next Build on main (#10030472284)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc