Skip to content

CI - add ruff check of the code #7372

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
May 28, 2025
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
14 changes: 9 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,15 @@ jobs:
with:
python-version: '3.11'
architecture: 'x64'
- name: Install pylint
run: pip install -r dev_tools/requirements/pylint.env.txt
- name: Display version
run: check/pylint --version
- name: Lint
- name: Install lint tools
run: pip install -r dev_tools/requirements/lint.env.txt
- name: Display versions
run: |
ruff --version
check/pylint --version
- name: Lint with ruff
run: FORCE_COLOR=1 ruff check
- name: Lint with pylint
run: check/pylint -v
doc_test:
if: github.repository_owner == 'quantumlib'
Expand Down
1 change: 1 addition & 0 deletions dev_tools/requirements/deps/dev-tools.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
-r notebook.txt
-r tensorflow-docs.txt
-r packaging.txt
-r ruff.txt

# For testing and analyzing code.
asv
Expand Down
1 change: 1 addition & 0 deletions dev_tools/requirements/deps/ruff.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ruff~=0.11.11
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
-r deps/cirq-all.txt

-r deps/pylint.txt
-r deps/ruff.txt
21 changes: 20 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ include = [
]
omit = ["benchmarks/*"]


[tool.coverage.report]
exclude_also = [
"^ *pass$",
Expand Down Expand Up @@ -48,3 +47,23 @@ markers = [
]
# Silence deprecation warnings about option "asyncio_default_fixture_loop_scope"
asyncio_default_fixture_loop_scope = "function"


[tool.ruff]
line-length = 100
target-version = "py311"
extend-exclude = ["*_pb2.py*"]

[tool.ruff.lint]
select = [
# "ANN201", # missing-return-type-undocumented-public-function
# "F401", # unused-import
# "F601", # multi-value-repeated-key-literal
"F821", # undefined-name
"TC001", # typing-only-first-party-import
"TC002", # typing-only-third-party-import
# "TC003", # typing-only-standard-library-import
"UP006", # non-pep585-annotation
"UP007", # non-pep604-annotation-union
"UP037", # quoted-annotation
]
Loading