Skip to content

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

Closed

Description

@tswast

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.

Activity

  1. added
    api: bigqueryIssues related to the BigQuery API.
    type: cleanupAn internal cleanup or hygiene concern.
    on Aug 22, 2019
  2. self-assigned this
    on Sep 16, 2019
  3. plamut commented on Sep 17, 2019

    @plamut
    Contributor

    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).

  4. tswast commented on Sep 23, 2019

    @tswast
    ContributorAuthor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

api: bigqueryIssues related to the BigQuery API.type: cleanupAn internal cleanup or hygiene concern.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions