Skip to content

Commit 6805da9

Browse files
authored
Merge pull request #106 from dstrain115/add_pylint_to_checks
Add pylint to CI for unitary
2 parents d0eae04 + 231ffec commit 6805da9

File tree

4 files changed

+109
-1
lines changed

4 files changed

+109
-1
lines changed

.github/workflows/pylint.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Pylint
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
pylint:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v2
10+
- uses: actions/setup-python@v1
11+
with:
12+
python-version: '3.10'
13+
architecture: 'x64'
14+
- name: Install Pylint
15+
run: |
16+
python -m pip install --upgrade pip
17+
pip install pylint
18+
- name: Pylint check
19+
run: dev_tools/pylint

dev_tools/.pylintrc

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
[MASTER]
2+
load-plugins=pylint.extensions.docstyle,pylint.extensions.docparams,pylint_copyright_checker
3+
max-line-length=88
4+
disable=all
5+
#ignore-paths=cirq-google/cirq_google/cloud/.*
6+
ignore-patterns=.*_pb2\.py
7+
output-format=colorized
8+
score=no
9+
reports=no
10+
enable=
11+
anomalous-backslash-in-string,
12+
assert-on-tuple,
13+
bad-indentation,
14+
bad-option-value,
15+
bad-reversed-sequence,
16+
bad-super-call,
17+
consider-merging-isinstance,
18+
continue-in-finally,
19+
dangerous-default-value,
20+
docstyle,
21+
duplicate-argument-name,
22+
expression-not-assigned,
23+
function-redefined,
24+
inconsistent-mro,
25+
init-is-generator,
26+
line-too-long,
27+
lost-exception,
28+
missing-kwoa,
29+
missing-param-doc,
30+
missing-raises-doc,
31+
mixed-line-endings,
32+
no-value-for-parameter,
33+
nonexistent-operator,
34+
not-in-loop,
35+
pointless-statement,
36+
redefined-builtin,
37+
return-arg-in-generator,
38+
return-in-init,
39+
return-outside-function,
40+
simplifiable-if-statement,
41+
singleton-comparison,
42+
syntax-error,
43+
too-many-function-args,
44+
trailing-whitespace,
45+
undefined-variable,
46+
unexpected-keyword-arg,
47+
unhashable-dict-key,
48+
unnecessary-pass,
49+
unreachable,
50+
unrecognized-inline-option,
51+
unused-import,
52+
unnecessary-semicolon,
53+
unused-variable,
54+
unused-wildcard-import,
55+
wildcard-import,
56+
wrong-import-order,
57+
wrong-import-position,
58+
yield-outside-function
59+
60+
# Ignore long lines containing urls or pylint directives.
61+
ignore-long-lines=^(.*#\w*pylint: disable.*|\s*(# )?[<\[\(]?https?://\S+[>\]\)]?)$
62+
63+
[TYPECHECK]
64+
65+
# List of members which are set dynamically and missed by pylint inference
66+
# system, and so shouldn't trigger E1101 when accessed. Python regular
67+
# expressions are accepted.
68+
generated-members=numpy.*
69+
70+
71+
#[IMPORTS]
72+
# Force import order to recognize a module as part of a third party library.
73+
#known-third-party=cirq,cirq_google,cirq_aqt,cirq_ionq

dev_tools/pylint

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/usr/bin/env bash
2+
3+
################################################################################
4+
# Runs pylint on the repository using a preconfigured .pylintrc file.
5+
#
6+
# Usage:
7+
# check/pylint [--flags for pylint]
8+
################################################################################
9+
10+
# Get the working directory to the repo root.
11+
cd "$(dirname "${BASH_SOURCE[0]}")"
12+
cd "$(git rev-parse --show-toplevel)"
13+
14+
# Add dev_tools to $PYTHONPATH so that pylint can find custom checkers
15+
env PYTHONPATH=dev_tools pylint --jobs=0 --rcfile=dev_tools/.pylintrc "$@" .

requirements.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ cirq-core>=0.15.0
22
cirq-google>=0.15.0
33
# When changing Cirq requirements be sure to update dev_tools/write-ci-requirements.py
44

5-
seaborn
65
ipython
76
black
7+
pylint
8+
pytest

0 commit comments

Comments
 (0)