Skip to content
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

BigQuery: Run lint and black on samples/ directory #9081

Closed
tswast opened this issue Aug 22, 2019 · 2 comments · Fixed by #9277
Closed

BigQuery: Run lint and black on samples/ directory #9081

tswast opened this issue Aug 22, 2019 · 2 comments · Fixed by #9277
Assignees
Labels
api: bigquery Issues related to the BigQuery API. type: cleanup An internal cleanup or hygiene concern.

Comments

@tswast
Copy link
Contributor

tswast commented Aug 22, 2019

We should make sure our code samples are linted, too.

I think we'll get a few flake8 errors for unused imports. Since we always want to show from google.cloud import bigquery, we can make those lines into comments when they are otherwise unnecessary.

Also, I forget if we use the templated files for noxfile.py. This update may need to be made at the synthtool templates repo if so.

@tswast tswast added api: bigquery Issues related to the BigQuery API. type: cleanup An internal cleanup or hygiene concern. labels Aug 22, 2019
@plamut plamut self-assigned this Sep 16, 2019
@plamut
Copy link
Contributor

plamut commented Sep 17, 2019

It appears that snippets are already linted. Black already runs on them, while the flake8 check needs to be extended to the docs/samples directory:

diff --git a/bigquery/noxfile.py b/bigquery/noxfile.py
index 37611a5ce29..fc44db1c120 100644
--- a/bigquery/noxfile.py
+++ b/bigquery/noxfile.py
@@ -150,6 +150,7 @@ def lint(session):
     session.install("-e", ".")
     session.run("flake8", os.path.join("google", "cloud", "bigquery"))
     session.run("flake8", "tests")
+    session.run("flake8", os.path.join("docs", "samples"))
     session.run("flake8", os.path.join("docs", "snippets.py"))
     session.run("black", "--check", *BLACK_PATHS)

Noxfiles are auto-generated AFAIK, yes, thus the change needs to be made in the synthool repo (or wherever the files are generated).

@tswast
Copy link
Contributor Author

tswast commented Sep 23, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: bigquery Issues related to the BigQuery API. type: cleanup An internal cleanup or hygiene concern.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants