openrewrite / openrewrite/rewrite
Jenkins parser does not resolve shared library methods from @Library
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 3.7k
- Forks
- 570
- Avg merge
- 13h 12m
- Merged PRs (30d)
- 261
Description
Description
The Jenkins/Groovy parser does not resolve methods provided by shared libraries imported via the @Library annotation. This affects any recipe that relies on type attribution in Jenkinsfiles and lead to unresolvable types.
Example Jenkinsfile:
#!groovy
@Library(['my-pipeline-library', 'my-jenkins-library'])
sbPipeline()
sbPipeline() is defined in an external Jenkins shared library, not in the Jenkinsfile itself. The parser cannot resolve this method, resulting in missing type attribution. Recipes like FindCallGraph then report "Method type not found" warnings, but the root cause is the parser not understanding @Library imports.
Expected behavior
The Jenkins/Groovy parser should either:
- Resolve shared library methods if the library source is available in the analysis scope, or
- Model
@Libraryimports as external dependencies so that downstream recipes can distinguish "unresolved external method" from "truly unknown method"
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the Jenkins/Groovy parser handling @Library annotations and the FindCallGraph path that reports missing method types. Compare how shared-library methods are represented when source is available versus absent. Done means shared-library methods resolve when possible, or external dependencies are modeled distinctly so downstream recipes avoid treating them as unknown.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- groovy
- Domain
- compilers, devtools
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 40/100