Skip to content

Latest commit

 

History

History
126 lines (92 loc) · 4.58 KB

CONTRIBUTING.md

File metadata and controls

126 lines (92 loc) · 4.58 KB

Contributing

By participating in this project, you agree to abide our Code of conduct.

Set up your machine

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

Create a commit

Commit messages should be well formatted, and to make that "standardized", we are using Gitmoji.

You can follow the documentation on their website.

Submit a pull request

Push your branch to your repository fork and open a pull request against the main branch.

'Patching' an existing Qodana image

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

Release a new version

If you are a core maintainer and want to release a new version, all you need to release a new version is:

  1. 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
  1. Trigger release job in the release branch (e.g. 241)
  2. The release will be published to:
  1. For all integrations that use the CLI:

Troubleshooting choco releases

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 and choco (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/