Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 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
8 changes: 0 additions & 8 deletions .flake8

This file was deleted.

15 changes: 4 additions & 11 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,10 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: '3.12'
# flake8 version should be same as the version in requirements/test.txt
# to avoid lint errors on CI
- name: pip install flak8
run: pip install flake8>=4.1.0
- name: Lint with flake8
run: |
flake8
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Install Ruff
run: pip install ruff>=0.15.0
Comment thread
FarhanAnjum-opti marked this conversation as resolved.
Outdated
- name: Lint with Ruff
run: ruff check .

integration_tests:
uses: optimizely/python-sdk/.github/workflows/integration_test.yml@master
Expand Down
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Development process
2. Please follow the [commit message guidelines](https://github.com/angular/angular/blob/master/CONTRIBUTING.md#-commit-message-guidelines)
for each commit message.
3. Make sure to add tests!
4. Run `flake8` to ensure there are no lint errors.
4. Run `ruff check .` to ensure there are no lint errors.
5. `git push` your changes to GitHub.
6. Open a PR from your fork into the master branch of the original
repo.
Expand All @@ -34,12 +34,12 @@ Pull request acceptance criteria
- Tests are located in `/tests` with one file per class.
- Please don't change the `__version__`. We'll take care of bumping
the version when we next release.
- Lint your code with Flake8 before submitting.
- Lint your code with Ruff before submitting.

Style
-----

We enforce Flake8 rules.
We enforce Ruff linting rules (Flake8-equivalent: pycodestyle + Pyflakes).

License
-------
Expand Down
2 changes: 1 addition & 1 deletion requirements/test.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
coverage
flake8 >= 4.0.1
ruff >= 0.15.0
funcsigs >= 0.4
pytest >= 6.2.0
pytest-cov
Expand Down
38 changes: 38 additions & 0 deletions ruff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Ruff configuration
# https://docs.astral.sh/ruff/configuration/

line-length = 120
target-version = "py39"
Comment thread
FarhanAnjum-opti marked this conversation as resolved.

exclude = [
".git",
".venv",
"__pycache__",
"build",
"dist",
"*.egg-info",
"*virtualenv*",
"optimizely/lib/pymmh3.py",
"tests/testapp/application.py",
]

[lint]
# Flake8-equivalent rules:
# E, W = pycodestyle (style errors & warnings)
# F = Pyflakes (logic errors, undefined names, unused imports)
select = ["E", "W", "F"]

# Match current flake8 ignores
# E722 - do not use bare 'except'
ignore = ["E722"]
Comment thread
FarhanAnjum-opti marked this conversation as resolved.

# Allow autofix for all rules
fixable = ["ALL"]
unfixable = []

[lint.per-file-ignores]
# Ignore unused imports in __init__ files
"__init__.py" = ["F401"]

[lint.isort]
known-first-party = ["optimizely"]
Loading