GitHub Action for Code Inspector
**THIS REPOSITORY IS NO LONGER ACTIVE. PLEASE USE https://github.com/codiga/github-action **
The Code Inspector GitHub action allows you to check if your code meets quality criteria. When a commit is triggered, Code Inspector checks the quality of the source code according to your own metrics threshold.
The action lets you customize the number of metrics based on
Sign up on Code Inspector.
In the top right menu go to API token
Create a token and save it.
You need to add your Code Inspector API Token into GitHub.
On GitHub, go in your repository settings, click on the secret Secrets (on the right) and create a new secret.
Create a secret called CODE_INSPECTOR_API_TOKEN
and set it to the value of the API token generated at the previous step.
Once the secret is created, the secrets page will look as follow.
Create a file .github/workflows/main.yml
and insert the following
content.
on: [push]
jobs:
check-quality:
runs-on: ubuntu-latest
name: A job to check my code quality
steps:
- name: Check code meets quality standards
id: code-inspector
uses: codeinspectorio/github-action@master
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
code_inspector_api_token: ${{ secrets.CODE_INSPECTOR_API_TOKEN }}
force_ref: 'none'
min_quality_grade: 'WARNING'
min_quality_score: '50'
max_defects_rate: '0.0001'
max_complex_functions_rate: '0.0001'
max_long_functions_rate: '0.0001'
project_name: ''
max_timeout_sec: '600'
The following parameters should NOT be changed:
The following parameters can be changed:
EXCELLENT
, GOOD
, NEUTRAL
, WARNING
, CRITICAL
0
and 100
.0.001
means 1 defect per 1000 lines of codes.0.5
means that the code should not have more than 50% of functions with high complexity.0.4
means that the code should not have more than 40% of long functions.Everything is set up 🎉
Add a new commit and the Code Inspector engine will check if the new code meets your criteria.
To visualize the results details, you can use the frontend, our command-line client or use directly our API.
This GitHub action is about checking the code quality at every commit or pull request. If you want to have automated Code Reviews, Code Inspector supports automated code reviews with its GitHub app.
Feel free to open an issue on this GitHub project. If you have questions related to Code Inspector itself, please contact the support team