Skip to content
Open
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
13 changes: 13 additions & 0 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Ruff
on: [ push, pull_request ]
jobs:
ruff:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: astral-sh/ruff-action@v3
with:
src: >-
./src
./tests
./tests_aws
60 changes: 46 additions & 14 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,22 +75,54 @@ local git repository using the following command:
git commit -s
```

<!--
## Communication
**FIXME** Please feel free to connect with us on our [Slack channel](link).

## Setup
**FIXME** Please add any special setup instructions for your project to help the developer
become productive quickly.

## Testing
**FIXME** Please provide information that helps the developer test any changes they make
before submitting.

## Coding style guidelines
**FIXME** Optional, but recommended: please share any specific style guidelines you might
have for your project.
-->
1. **Clone the repository and install dependencies:**
```shell
git clone https://github.com/instana/python-sensor.git
cd python-sensor
pip install -e ".[dev]"
```

This installs the package in editable mode with development dependencies (pytest, ruff, pre-commit, etc.)

2. **Set up pre-commit hooks:**
```shell
pre-commit install
```

This automatically runs Ruff linter and formatter before each commit.

## Testing and Code Quality

Before submitting a pull request:

1. **Run tests:**
```shell
pytest
```

2. **Check code style:**
```shell
ruff check ./src ./tests ./tests_aws
```

Or run all pre-commit checks:
```shell
pre-commit run --all-files
```

**Note:** All pull requests to `main` must pass GitHub Actions checks (Ruff linter + test suite).

## Coding Style

- Python 3.9+ compatible code
- Follow PEP 8 style guidelines (enforced by Ruff)
- Include copyright headers in new files (see [Legal](#legal) section)
- Use type hints where appropriate
- Ruff automatically formats code on commit via pre-commit hooks

Configuration is defined in [`pyproject.toml`](pyproject.toml). For advanced Ruff usage, see [Ruff documentation](https://docs.astral.sh/ruff/).

<!-- Reference links -->

Expand Down
Loading