https://github.com/pixee/codemodder-java
a framework for building java codemods
https://github.com/pixee/codemodder-java
codemods framework java library quality security static-analysis
Last synced: about 2 months ago
JSON representation
a framework for building java codemods
- Host: GitHub
- URL: https://github.com/pixee/codemodder-java
- Owner: pixee
- License: agpl-3.0
- Created: 2022-07-24T15:11:14.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-10-29T10:32:43.000Z (6 months ago)
- Last Synced: 2024-10-29T12:22:04.194Z (6 months ago)
- Topics: codemods, framework, java, library, quality, security, static-analysis
- Language: Java
- Homepage: https://codemodder.io
- Size: 4.47 MB
- Stars: 39
- Watchers: 5
- Forks: 6
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-java - Codemodder
README
# codemodder-java
This is the Java version of the [Codemodder Framework](https://codemodder.io/), which builds on traditional codemod frameworks by providing
codemods with additional context and services. Codemodder plugins inject codemods with the context and services they need to perform complex transforms.Pluggability and the complex transforms they enable distinguish codemodder codemods from traditional codemods.
For directions on how to write your own codemods, visit the [Codemodder documentation site](https://codemodder.io/).
Codemodder is sponsored by [pixee.ai](https://pixee.ai).
## Developing
Follow these instructions if you intend to modify and build this project from source.
### First Time Set Up
1. Install JDK 17 for building this project. We recommend [Eclipse Adoptium](https://adoptium.net/)
1. Install [Semgrep](https://semgrep.dev/) CLI. See
[here](https://semgrep.dev/docs/getting-started/#installing-and-running-semgrep-locally)
for instructions. It can usually be done via `pip`:
```shell
pip install semgrep==1.84.1
```If your python library paths contain your home directory as a root folder (i.e.
due to the use of the `$HOME` environment variable), you may need to manually
set up your `PYTHONPATH` for tests:```shell
PYTHONPATH=$HOME/ ./gradlew check
```You can check your python paths with:
```shell
python -m site
```### Building
```shell
./gradlew assemble
```### Running Tests
```shell
./gradlew check
```You need to be able to run [Docker](https://www.docker.com/) for some tests. Make sure you have it installed and have the necessary permissions to run with your user.
#### OpenAI Integration Tests
Some tests integrate with the OpenAI platform. To run these tests, configure an OpenAI key in the Gradle
property `codemodderOpenAIKey`. When no API key is configured, the tests will be skipped.You can add the Gradle property to your `~/.gradle/gradle.properties` file:
```properties
codemodderOpenAIKey=your-openai-key
```### Run the Core Codemods
You can download and run the latest release from this repository in order to run the core codemods as a CLI:```bash
$ unzip codemodder-java-codemods-.zip
$ sh core-codemods-/bin/core-codemods
```In order to run them during active development from Gradle, you can use the `run` task:
```shell
./gradlew :core-codemods:run --args='--output /path/to/my.codetf --dry-run /path/to/project/'
```