[rocprof-compute] updated formatting workflow and docs (#348)

* updated formatting workflow and docs

* restored requirements.txt
Tento commit je obsažen v:
jamessiddeley-amd
2025-08-14 14:12:24 -04:00
odevzdal GitHub
rodič 3fd8af5974
revize 2936a468aa
5 změnil soubory, kde provedl 60 přidání a 48 odebrání
+19 -7
Zobrazit soubor
@@ -30,14 +30,26 @@ jobs:
working-directory: projects/rocprofiler-compute
run: |
python -m pip install --upgrade pip
python -m pip install black isort
python -m pip install ruff
if [ -f requirements.txt ]; then python -m pip install -r requirements.txt; fi
- name: Run black formatter
working-directory: projects/rocprofiler-compute
run: black .
- name: Run isort formatter
working-directory: projects/rocprofiler-compute
run: isort .
- name: Run Ruff Linter and Import Sorter
run: |
ruff check . --fix --exit-zero
- name: Run Ruff Formatter
run: |
ruff format .
- name: Check for formatting/linting changes
run: |
git config --global user.name 'github-actions'
git config --global user.email 'github-actions@github.com'
git add -A .
if ! git diff --cached --quiet; then
echo "::error::Files were modified by ruff. Please run 'ruff check . --fix && ruff format .' locally and commit the changes."
git diff --cached --patch # Show the diff in the logs
exit 1
else
echo "Ruff found no issues or all issues were fixed and files are clean."
fi
cmake:
runs-on: ubuntu-22.04
+39
Zobrazit soubor
@@ -52,6 +52,45 @@ Now, when you commit code to the repository you should see something like this:
Please see the [pre-commit documentation](https://pre-commit.com/#quick-start) for additional information.
## Contribution Guidelines
To ensure code quality and consistency, we use **Ruff**, a fast Python linter and formatter. Before submitting a pull request, please ensure your code is formatted and linted correctly. This is the manual alternative to running ruff pre-commit hooks.
-----
## Installing and Running Ruff
Ruff is available on PyPI and can be installed using `pip`:
```bash
pip install ruff
```
Once installed, you can run Ruff from the command line. To check for linting errors and formatting issues, navigate to the project root and run:
```bash
ruff check .
ruff format --check .
```
To automatically fix most of the issues detected, you can use the `--fix` flag with the `check` command and run the `format` command without the `--check` flag:
```bash
ruff check --fix .
ruff format .
```
-----
## Disabling Formatting for Specific Sections
There may be instances where you need to disable Ruff's formatting on a specific block of code. You can do this using special comments:
* **`# fmt: off`** and **`# fmt: on`**: These comments can be used to disable and re-enable formatting for a block of code.
* **`# fmt: skip`**: This comment, placed at the end of a line, will prevent Ruff from formatting that specific statement.
You can also disable specific linting rules for a line by using `# noqa: <rule_code>`.
## Coding guidelines
Below are some repository specific guidelines which are followed througout the repository.
+1 -40
Zobrazit soubor
@@ -75,7 +75,7 @@ To build the binary we follow these steps:
NOTE: Since RHEL 8 ships with glibc version 2.28, this standalone binary can only be run on environment with glibc version greater than 2.28.
glibc version can be checked using `ldd --version` command.
NOTE: libnss3.so shared library is required when using --roof-only option which generates roofline data in PDF format
NOTE: libnss3.so shared library is required when using --roof-only option which generates roofline data in PDF format
To test the standalone binary provide the `--call-binary` option to pytest.
@@ -104,42 +104,3 @@ style reference is provided below for convenience:
url = {https://doi.org/10.5281/zenodo.7314631}
}
```
### Contribution Guidelines
To ensure code quality and consistency, we use **Ruff**, a fast Python linter and formatter. Before submitting a pull request, please ensure your code is formatted and linted correctly.
-----
### Installing and Running Ruff
Ruff is available on PyPI and can be installed using `pip`:
```bash
pip install ruff
```
Once installed, you can run Ruff from the command line. To check for linting errors and formatting issues, navigate to the project root and run:
```bash
ruff check .
ruff format --check .
```
To automatically fix most of the issues detected, you can use the `--fix` flag with the `check` command and run the `format` command without the `--check` flag:
```bash
ruff check --fix .
ruff format .
```
-----
### Disabling Formatting for Specific Sections
There may be instances where you need to disable Ruff's formatting on a specific block of code. You can do this using special comments:
* **`# fmt: off`** and **`# fmt: on`**: These comments can be used to disable and re-enable formatting for a block of code.
* **`# fmt: skip`**: This comment, placed at the end of a line, will prevent Ruff from formatting that specific statement.
You can also disable specific linting rules for a line by using `# noqa: <rule_code>`.
Binární soubor nebyl zobrazen.

Před

Šířka:  |  Výška:  |  Velikost: 17 KiB

Za

Šířka:  |  Výška:  |  Velikost: 18 KiB

+1 -1
Zobrazit soubor
@@ -16,4 +16,4 @@ tabulate
textual
textual_plotext
textual-fspicker
tqdm
tqdm