Library issues are tracked using GitHub Issues. Please review all existing issues before creating a new one. If you would like to work on an open issue, please comment to that effect and assign yourself to the issue.
Executing one of the test scripts
./buildAndRunAndroidExample.sh
./buildAndRunAndroidKtsExample.sh
./buildAndRunJavaKotlinExample.sh
./buildAndRunJavaKotlinKtsExample.sh
will
- publish a Gnag artifact based on the code currently in your working directory to your local Maven repository;
- run the
gnagCheck
task defined by this artifact on the corresponding example project.
Assuming the artifact was successfully built, published, and run, you should find a local Gnag report at {example-folder}/app/build/outputs/gnag/gnag.html
(for Android example projects) or {example-folder}/build/outputs/gnag/gnag.html
(for Java/Kotlin example projects). The example applications deliberately include suspicious code that Gnag will flag as violations.
Testing commenting on pull requests is a little more involved.
-
Create your own GitHub repository for Gnag testing.
-
Generate a new auth token for your GitHub account. Make sure it has all repository permissions.
-
Open a new pull request within your test repository.
-
In the
{example-folder}/app/build.gradle
file (for Android example projects) or{example-folder}/build.gradle
file (for Java/Kotlin example projects), update therepoName
,authToken
andissueNumber
entries in thegithub
block within thegnag
configuration closure as follows:github { repoName 'your_github_id/test_repository_name' authToken 'generated_auth_token' issueNumber 'test_repository_pull_request_number' }
-
Update the corresponding test script to run
./gradlew clean gnagReport
rather than./gradlew clean gnagCheck
.
Executing the corresponding test script
./buildAndRunAndroidExample.sh
./buildAndRunAndroidKtsExample.sh
./buildAndRunJavaKotlinExample.sh
./buildAndRunJavaKotlinKtsExample.sh
will now
- publish a Gnag artifact based on the code currently in your working directory to your local Maven repository;
- run the
gnagReport
task defined by this artifact on the corresponding example project.
Assuming the artifact was successfully built, published, and run, you should see Gnag post an aggregated violations comment on the pull request you opened in your test repository.
Perform all the steps from the Testing aggregated comments section, then in addition:
- Create a new branch in your test repository.
- Copy the contents of the example application module from the Gnag repository to this branch. Make sure that the
app
folder is in the root of your repository. - Open a pull request from this branch into master.
- In the
{example-folder}/app/build.gradle
file (for Android example projects) or{example-folder}/build.gradle
file (for Java/Kotlin example projects), update theissueNumber
entry in thegithub
block within thegnag
configuration closure to match the issue number of this new pull request.
Executing the corresponding test script
./buildAndRunAndroidExample.sh
./buildAndRunAndroidKtsExample.sh
./buildAndRunJavaKotlinExample.sh
./buildAndRunJavaKotlinKtsExample.sh
should now post inline pull request comments (where appropriate).
Before opening a pull request, you must generate license headers in any new source files by executing the Gradle command:
./gradlew licenseFormat
The Travis CI pull request build will fail if any source file is missing this generated header.