Skip to content

Commit 2d85dee

Browse files
authored
fix: only format samples if the directory exists (#2466)
1 parent dd87c33 commit 2d85dee

File tree

8 files changed

+41
-9
lines changed

8 files changed

+41
-9
lines changed

gapic/templates/noxfile.py.j2

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,15 @@ BLACK_VERSION = "black[jupyter]==23.7.0"
1616
ISORT_VERSION = "isort==5.11.0"
1717

1818
{% if api.naming.module_namespace %}
19-
LINT_PATHS = ["docs", "{{ api.naming.module_namespace[0] }}", "samples", "tests", "noxfile.py", "setup.py"]
19+
LINT_PATHS = ["docs", "{{ api.naming.module_namespace[0] }}", "tests", "noxfile.py", "setup.py"]
2020
{% else %}
21-
LINT_PATHS = ["docs", "{{ api.naming.versioned_module_name }}", "samples", "tests", "noxfile.py", "setup.py"]
21+
LINT_PATHS = ["docs", "{{ api.naming.versioned_module_name }}", "tests", "noxfile.py", "setup.py"]
2222
{% endif %}
2323

24+
# Add samples to the list of directories to format if the directory exists.
25+
if os.path.isdir("samples"):
26+
LINT_PATHS.append("samples")
27+
2428
ALL_PYTHON = [
2529
"3.7",
2630
"3.8",

tests/integration/goldens/asset/noxfile.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,11 @@
2626
BLACK_VERSION = "black[jupyter]==23.7.0"
2727
ISORT_VERSION = "isort==5.11.0"
2828

29-
LINT_PATHS = ["docs", "google", "samples", "tests", "noxfile.py", "setup.py"]
29+
LINT_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"]
30+
31+
# Add samples to the list of directories to format if the directory exists.
32+
if os.path.isdir("samples"):
33+
LINT_PATHS.append("samples")
3034

3135
ALL_PYTHON = [
3236
"3.7",

tests/integration/goldens/credentials/noxfile.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,11 @@
2626
BLACK_VERSION = "black[jupyter]==23.7.0"
2727
ISORT_VERSION = "isort==5.11.0"
2828

29-
LINT_PATHS = ["docs", "google", "samples", "tests", "noxfile.py", "setup.py"]
29+
LINT_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"]
30+
31+
# Add samples to the list of directories to format if the directory exists.
32+
if os.path.isdir("samples"):
33+
LINT_PATHS.append("samples")
3034

3135
ALL_PYTHON = [
3236
"3.7",

tests/integration/goldens/eventarc/noxfile.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,11 @@
2626
BLACK_VERSION = "black[jupyter]==23.7.0"
2727
ISORT_VERSION = "isort==5.11.0"
2828

29-
LINT_PATHS = ["docs", "google", "samples", "tests", "noxfile.py", "setup.py"]
29+
LINT_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"]
30+
31+
# Add samples to the list of directories to format if the directory exists.
32+
if os.path.isdir("samples"):
33+
LINT_PATHS.append("samples")
3034

3135
ALL_PYTHON = [
3236
"3.7",

tests/integration/goldens/logging/noxfile.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,11 @@
2626
BLACK_VERSION = "black[jupyter]==23.7.0"
2727
ISORT_VERSION = "isort==5.11.0"
2828

29-
LINT_PATHS = ["docs", "google", "samples", "tests", "noxfile.py", "setup.py"]
29+
LINT_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"]
30+
31+
# Add samples to the list of directories to format if the directory exists.
32+
if os.path.isdir("samples"):
33+
LINT_PATHS.append("samples")
3034

3135
ALL_PYTHON = [
3236
"3.7",

tests/integration/goldens/logging_internal/noxfile.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,11 @@
2626
BLACK_VERSION = "black[jupyter]==23.7.0"
2727
ISORT_VERSION = "isort==5.11.0"
2828

29-
LINT_PATHS = ["docs", "google", "samples", "tests", "noxfile.py", "setup.py"]
29+
LINT_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"]
30+
31+
# Add samples to the list of directories to format if the directory exists.
32+
if os.path.isdir("samples"):
33+
LINT_PATHS.append("samples")
3034

3135
ALL_PYTHON = [
3236
"3.7",

tests/integration/goldens/redis/noxfile.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,11 @@
2626
BLACK_VERSION = "black[jupyter]==23.7.0"
2727
ISORT_VERSION = "isort==5.11.0"
2828

29-
LINT_PATHS = ["docs", "google", "samples", "tests", "noxfile.py", "setup.py"]
29+
LINT_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"]
30+
31+
# Add samples to the list of directories to format if the directory exists.
32+
if os.path.isdir("samples"):
33+
LINT_PATHS.append("samples")
3034

3135
ALL_PYTHON = [
3236
"3.7",

tests/integration/goldens/redis_selective/noxfile.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,11 @@
2626
BLACK_VERSION = "black[jupyter]==23.7.0"
2727
ISORT_VERSION = "isort==5.11.0"
2828

29-
LINT_PATHS = ["docs", "google", "samples", "tests", "noxfile.py", "setup.py"]
29+
LINT_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"]
30+
31+
# Add samples to the list of directories to format if the directory exists.
32+
if os.path.isdir("samples"):
33+
LINT_PATHS.append("samples")
3034

3135
ALL_PYTHON = [
3236
"3.7",

0 commit comments

Comments
 (0)