Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/codechecker_pr_analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ jobs:
PR_NUMBER: ${{ github.event.number }}
run: |
echo "{\"client_autologin\" : true,\"credentials\": {\"https://codechecker-demo.eastus.cloudapp.azure.com\": \"demo:demo\"}}" > ~/.codechecker.passwords.json
bash ./ci/github_analysis/codechecker_gate_pr.sh $GITHUB_REF
bash ./ci/github_analysis/codechecker_gate_pr.sh
68 changes: 54 additions & 14 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
Please insert every possible information you can obtain that could help us
reproduce and triage your issue. This usually includes:

* The relevant parts from CodeChecker's output.
* The version number of CodeChecker – execute
* The relevant parts from CodeChecker's output.
* The version number of CodeChecker – execute
`CodeChecker version --verbose debug` and copy the value for `Git tag info`.
* What you were trying to do.
* What behaviour was expected instead of what happened.

* What you were trying to do.
* What behaviour was expected instead of what happened.

## Contribution guidelines

### Python style

In CodeChecker, we use [pycodestyle](https://pypi.python.org/pypi/pycodestyle/)
and [pylint](https://www.pylint.org/) to automatically check our coding style.
`pycodestyle` and `pylint` are enforced by the test infrastructure –
Expand All @@ -24,10 +24,11 @@ and `pylint` targets.
In addition to the general rules of `pycodestyle`, please keep the following
rules while writing your code:

* Comments must be whole sentences, beginning with a capital letter and
* Comments must be whole sentences, beginning with a capital letter and
ending with a closing `.`.

### Order of `import` commands

Order your `import` commands according to as follows:

1. **System-wide** imports come first and foremost, e.g.
Expand All @@ -51,6 +52,7 @@ importing module's name, even if we only import a single class or function from
it.

#### Example

The example below should concisely show how module imports should be
structured:

Expand Down Expand Up @@ -95,65 +97,103 @@ from product_db_access_handler import ThriftProductHandler
# ... your code here
```

### Code quality
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be good to write down in this section which script should be run locally and from where to check the gating criteria ...

Copy link
Copy Markdown
Collaborator Author

@gulyasgergely902 gulyasgergely902 Jul 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd make a different user for this to avoid "demo" users find the production checks. Make codechecker product invisible to "demo" user.


Any change in the Pull Request against the codechecker repository will be checked
with CodeChecker itself for potential issues. If any new issue found, the Pull Request
cannot be merged before fixing them.

#### Running quality check locally

Quality check script can also be used locally which needs setting up the environment before the first run:

* Create a local settings file for automatically logging in to the CodeChecker Code Quality server

``` json
{
"client_autologin" : true,
"credentials": {
"https://codechecker-demo.eastus.cloudapp.azure.com": "codechecker:codechecker"
}
}
```

* Run `ci/github_analysis/codechecker_gate_pr.sh` to analyze the code.

__Important:__ Make sure you are running CodeChecker version equal or lower than the server version when running the script! Always check the current version at: https://codechecker-demo.eastus.cloudapp.azure.com/

### Directory layout

#### `analyzer`

This folder contains source code of the CodeChecker `analyzer` and
`build-logger`.

The `build-logger` can be found under the `tools` folder. This can be used to
capture the build process and generate a JSON compilation database.

#### `bin`

This folder contains entry points of the CodeChecker package such as
`codechecker-version` and wrapper scripts.

#### `codechecker_common`

`codechecker_common` is a python package where all common CodeChecker related
source code is found which are used by the analyzer and web part of
CodeChecker.

#### `config`

This folder contains common configuration files such as
[`labels`](config/label), `logger.conf` etc. which are used by the
`analyzer` and the `web` part of CodeChecker.

#### `docker`

This folder contains docker related files.

#### `docs`

This folder contains documentation files for the CodeChecker.

#### `scripts`

This folder contains multiple scripts which are used at the build process of
CodeChecker, gerrit integration, debug etc.

#### `tools`

This folder contains tools which are used by the `analyzer` and `web` part
of the CodeChecker such as `tu_collector`.

#### `web`

This folder contains source code of the CodeChecker web server and web client.

### Entry points

CodeChecker is organized into different entry-points based on different
features of the program, such as logging, analysing, result storage, web
server, etc.

A CodeChecker feature having its entry point consists of a bare minimum of
two (2) things:

* An entry point under `bin/codechecker-myfeature`.
* The entry point's definition containing the feature's command-line help and
* An entry point under `bin/codechecker-myfeature`.
* The entry point's definition containing the feature's command-line help and
argument parser under `cmd/myfeature.py`.

### Libraries

CodeChecker contains multiple python packages:
* `codechecker_common`: used by the analyzer and web part of the CodeChecker.
* `codechecker_analyzer`: contains source code of the CodeChecker analyzer.
* `codechecker_web`: used by the WEB server and client.
* `codechecker_client`: contains source code of the CodeChecker WEB client.
* `codechecker_server`: contains source code of the CodeChecker WEB server.
* `codechecker_api`: python api module files which are generated by a thrift

* `codechecker_common`: used by the analyzer and web part of the CodeChecker.
* `codechecker_analyzer`: contains source code of the CodeChecker analyzer.
* `codechecker_web`: used by the WEB server and client.
* `codechecker_client`: contains source code of the CodeChecker WEB client.
* `codechecker_server`: contains source code of the CodeChecker WEB server.
* `codechecker_api`: python api module files which are generated by a thrift
compiler.

Additionally, you may use different Python files to store code for your library
Expand Down
6 changes: 1 addition & 5 deletions ci/github_analysis/codechecker_gate_pr.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,11 @@

CC_URL="https://codechecker-demo.eastus.cloudapp.azure.com/codechecker"

if [ "$#" -ne 1 ]; then
echo "<PR_NAME> is missing"
fi

./ci/github_analysis/pylint_analyze.sh
report-converter -c -t pylint -o ./reports-pylint ./pylint-reports.json
CodeChecker cmd diff --url "$CC_URL" -b master -n ./reports-pylint --new
if [ "$?" -ne 0 ]; then
echo "ERROR. YOUR PR FAILED GATING! Please check new reports at $CC_URL/reports?run=master&newcheck=$1"
echo "ERROR. YOUR PR FAILED GATING!"
exit 1
else
echo "Gating successful. No new report found. Your PR is ready to be merged."
Expand Down