Skip to content

Commit 3d3e94c

Browse files
authored
chore: add type hint check (#840)
1 parent c7824ea commit 3d3e94c

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

synthtool/gcp/templates/python_samples/noxfile.py.j2

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ TEST_CONFIG = {
3939
# You can opt out from the test for specific Python versions.
4040
'ignored_versions': ["2.7"],
4141

42+
# Old samples are opted out of enforcing Python type hints
43+
# All new samples should feature them
44+
'enforce_type_hints': False,
45+
4246
# An envvar key for determining the project id to use. Change it
4347
# to 'BUILD_SPECIFIC_GCLOUD_PROJECT' if you want to opt in using a
4448
# build specific Cloud project. You can also use your own string
@@ -132,7 +136,10 @@ FLAKE8_COMMON_ARGS = [
132136

133137
@nox.session
134138
def lint(session):
135-
session.install("flake8", "flake8-import-order")
139+
if not TEST_CONFIG['enforce_type_hints']:
140+
session.install("flake8", "flake8-import-order")
141+
else:
142+
session.install("flake8", "flake8-import-order", "flake8-annotations")
136143

137144
local_names = _determine_local_import_names(".")
138145
args = FLAKE8_COMMON_ARGS + [

0 commit comments

Comments
 (0)