By participating in this project, you agree to abide our Code of conduct.
qd
is written in Go.
Prerequisites:
Other things you might need to develop:
Clone the project anywhere:
git clone [email protected]:JetBrains/qodana-cli.git
cd
into the cli
directory and run for debug:
go run main.go
Build a binary with
go build -o qd main.go
Test your code with coverage:
go test -v $(go list -f '{{.Dir}}/...' -m | xargs)
Test your code with a human-readable report (requires go install github.com/mfridman/tparse@latest
):
export GITHUB_ACTIONS=true # skip third-party linter tests
set -o pipefail && go test -json -v $(go list -f '{{.Dir}}/...' -m | xargs) | tparse -all
Dry-run goreleaser:
goreleaser release --snapshot --clean
Commit messages should be well formatted, and to make that "standardized", we are using Gitmoji.
You can follow the documentation on their website.
Push your branch to your repository fork and open a pull request against the main branch.
For testing purposes, it can be necessary to patch an existing Qodana image with a custom qodana-cli build. To achieve that, first build a linux binary:
# assume we're in the cli directory
env GOOS=linux CGO_ENABLED=0 go build -o qd-custom
Then build a new docker image, replacing the bundled qodana-cli with the newly built one:
# Use any existing qodana image
FROM registry.jetbrains.team/p/sa/containers/qodana-go:latest
COPY qd-custom /opt/idea/bin/qodana
docker build . -t qd-image
And lastly run the custom image with the custom binary:
/path/to/qodana-cli/cli/qd-custom scan --linter="docker.io/library/qd-image" --skip-pull
If you are a core maintainer and want to release a new version, all you need to release a new version is:
- Tag release in the release branch (e.g.
241
)
git checkout 241 && git tag -a vX.X.X -m "vX.X.X" && git push origin vX.X.X
- Trigger release job in the release branch (e.g.
241
) - The release will be published to:
JetBrains/qodana-cli
release page- Chocolatey registry
- GitHub's repositories that are used for package managers:
- external (updates are done via pull requests):
Microsoft/winget-pkgs
- internal (updates are done via direct commits):
JetBrains/scoop-utils
andJetBrains/homebrew-utils
- external (updates are done via pull requests):
- For all integrations that use the CLI:
- for all CIs (except TeamCity): the update will be done automatically via pull request, read https://github.com/JetBrains/qodana-action/blob/main/CONTRIBUTING.md#release-a-new-version
- TeamCity: after GitHub action release, bump CLI catalogue version, like this.
Releases through choco
channel can be unstable sometimes depending on the Chocolatey services,
so if you have any issues with it on release, upload the package manually:
- Set up
goreleaser
andchoco
(for non-Windows systems – look at ci.yml for details) - Run the following commands:
- Check out the wanted tag
- Release the package locally to generate all metadata files and executables
- Set the correct checksum for the already published package (can be obtained from the release page)
- Set up
choco
API key and publish
git checkout v2024.1.2
goreleaser release --skip-publish --clean
vim dist/qodana.choco/tools/chocolateyinstall.ps1
choco apikey --key <YOUR_API_KEY> --source https://push.chocolatey.org/
cd dist/qodana.choco && choco pack && choco push qodana.2024.1.2.nupkg --source https://push.chocolatey.org/