Repository navigation
chore(bigquery): sync bigquery ruff with the global config #19056
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,23 @@ | ||||||||||||
| # Copyright 2026 Google LLC | ||||||||||||
| # | ||||||||||||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||||||||||||
| # you may not use this file except in compliance with the License. | ||||||||||||
| # You may obtain a copy of the License at | ||||||||||||
| # | ||||||||||||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||||||||||||
| # | ||||||||||||
| # Unless required by applicable law or agreed to in writing, software | ||||||||||||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||||||||||||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||||||||||
| # See the License for the specific language governing permissions and | ||||||||||||
| # limitations under the License. | ||||||||||||
|
|
||||||||||||
| [build-system] | ||||||||||||
| requires = ["setuptools"] | ||||||||||||
| build-backend = "setuptools.build_meta" | ||||||||||||
|
|
||||||||||||
| [tool.ruff] | ||||||||||||
| line-length = 88 | ||||||||||||
|
Comment on lines
+19
to
+20
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Configuring
Suggested change
|
||||||||||||
|
|
||||||||||||
| [tool.ruff.lint] | ||||||||||||
| select = ["I"] | ||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| # Copyright 2026 Google LLC | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| [build-system] | ||
| requires = ["setuptools"] | ||
| build-backend = "setuptools.build_meta" | ||
|
|
||
| [tool.ruff] | ||
| line-length = 88 | ||
|
|
||
| [tool.ruff.lint] | ||
| select = ["I"] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,8 +28,6 @@ | |
|
|
||
| import nox | ||
|
|
||
| BLACK_VERSION = "black==23.7.0" | ||
| ISORT_VERSION = "isort==5.10.1" | ||
| RUFF_VERSION = "ruff==0.14.14" | ||
| LINT_PATHS = ["docs", "pandas_gbq", "tests", "noxfile.py", "setup.py"] | ||
|
|
||
|
|
@@ -151,7 +149,7 @@ def lint(session): | |
| "check", | ||
| "--select", | ||
| "I", | ||
| f"--target-version=py{UNIT_TEST_PYTHON_VERSIONS[0].replace('.', '')}", | ||
| f"--target-version=py{ALL_PYTHON[0].replace('.', '')}", | ||
| "--line-length=88", | ||
| *LINT_PATHS, | ||
| ) | ||
|
|
@@ -160,7 +158,7 @@ def lint(session): | |
| "ruff", | ||
| "format", | ||
| "--check", | ||
| f"--target-version=py{UNIT_TEST_PYTHON_VERSIONS[0].replace('.', '')}", | ||
| f"--target-version=py{ALL_PYTHON[0].replace('.', '')}", | ||
| "--line-length=88", | ||
| *LINT_PATHS, | ||
| ) | ||
|
|
@@ -170,10 +168,18 @@ def lint(session): | |
| @nox.session(python=DEFAULT_PYTHON_VERSION) | ||
| @_calculate_duration | ||
| def blacken(session): | ||
| """Run black. Format code to uniform standard.""" | ||
| session.install(BLACK_VERSION) | ||
| """(Deprecated) Legacy session. Please use 'nox -s format'.""" | ||
| session.log( | ||
| "WARNING: The 'blacken' session is deprecated and will be removed in a future release. Please use 'nox -s format' in the future." | ||
| ) | ||
|
|
||
| # Just run the ruff formatter (keeping legacy behavior of only formatting, not sorting imports) | ||
| session.install(RUFF_VERSION) | ||
| session.run( | ||
| "black", | ||
| "ruff", | ||
| "format", | ||
| f"--target-version=py{ALL_PYTHON[0].replace('.', '')}", | ||
| "--line-length=88", | ||
| *LINT_PATHS, | ||
| ) | ||
|
Comment on lines
178
to
184
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since session.run(
"ruff",
"format",
*LINT_PATHS,
) |
||
|
|
||
|
|
@@ -194,7 +200,7 @@ def format(session): | |
| "--select", | ||
| "I", | ||
| "--fix", | ||
| f"--target-version=py{UNIT_TEST_PYTHON_VERSIONS[0].replace('.', '')}", | ||
| f"--target-version=py{ALL_PYTHON[0].replace('.', '')}", | ||
| "--line-length=88", | ||
| *LINT_PATHS, | ||
| ) | ||
|
|
@@ -203,7 +209,7 @@ def format(session): | |
| session.run( | ||
| "ruff", | ||
| "format", | ||
| f"--target-version=py{UNIT_TEST_PYTHON_VERSIONS[0].replace('.', '')}", | ||
| f"--target-version=py{ALL_PYTHON[0].replace('.', '')}", | ||
| "--line-length=88", | ||
| *LINT_PATHS, | ||
| ) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| # Copyright 2026 Google LLC | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| [build-system] | ||
| requires = ["setuptools"] | ||
| build-backend = "setuptools.build_meta" | ||
|
|
||
| [tool.ruff] | ||
| line-length = 88 | ||
|
|
||
| [tool.ruff.lint] | ||
| select = ["I"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since
line-length = 88is already configured inpyproject.toml, andtarget-versioncan also be configured there (e.g.,target-version = "py38"), passing these options as command-line arguments innoxfile.pyis redundant. Relying onpyproject.tomlsimplifies thenoxfile.pyconfiguration and avoids package-specific variable name discrepancies (such asUNIT_TEST_PYTHON_VERSIONSvsALL_PYTHON).