Tools
Tools are used to collect information about issues in the project. These can be linters, static code analyzers, or other tools.
The output from different tools need to be parsed to extract the list of Issues. Then Issues are passed further to the proposal engine which forms a query to a Backend.
--all (default)
Try all tools, or configured ones.
--sonar
This tool will try fixing issues, coming from SonarQube or SonarCloud.
--sonar
flag might accept additional parameters, like --sonar=pullRequest=78
Example of .hallux
file for SonarQube:
tools:
sonar:
url: https://sonarqube.hallux.dev
validity_test: ./run-validity-tests.sh -x
project: halluxdev_hallux_AYpIk3Z__hwOMJbIE7XQ
search_params: resolved=false&severities=MINOR,MAJOR,CRITICAL&statuses=OPEN,CONFIRMED,REOPENED
Example of a GitHub action for SonarQube:
name: Pull Request Pipeline
Example of .hallux
file for SonarCloud:
tools:
sonar:
url: https://sonarcloud.io
validity_test: ./run-validity-tests.sh -x
project: halluxdev_hallux
search_params: projects=halluxdev_hallux&resolved=false&severities=MINOR,MAJOR,CRITICAL&statuses=OPEN,CONFIRMED,REOPENED
Example of a GitHub action for SonarCloud:
name: Pull Request Pipeline
on:
pull_request:
branches: [ master ]
types: [opened, synchronize, reopened]
env:
BUILD_TYPE: Release
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
# *** Install dependencies and run unit tests ***
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.HALLUX_GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_CLOUD_TOKEN }}
- name: Try to fix Sonar issues
env:
SONAR_TOKEN: ${{ secrets.SONAR_CLOUD_TOKEN }}
SONAR_HOST_URL: https://sonarcloud.io
SONAR_PROJECT_VERSION: ${{ github.run_number }}
GITHUB_TOKEN: ${{ secrets.HALLUX_GITHUB_TOKEN }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
run: |
export PYTHONPATH=$(pwd):${PYTHONPATH}
LOG_LEVEL=DEBUG python3 ./hallux/main.py --sonar=pullRequest=${{ github.event.pull_request.number }} --gpt3 --github https://github.com/halluxdev/hallux/pull/${{ github.event.pull_request.number }} hallux
--python
try fixing only python issues.
--ruff
try fixing only ruff issues.
--cpp
try fixing only c++ issues.