Skip to content

Commit 403b2cf

Browse files
authored
Merge pull request #60 from GoogleCloudPlatform/update-lint
chore: new lint job
2 parents 8167936 + e26b219 commit 403b2cf

File tree

4 files changed

+69
-36
lines changed

4 files changed

+69
-36
lines changed

.github/workflows/formatter.yml

Lines changed: 0 additions & 36 deletions
This file was deleted.

.github/workflows/lint.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Copyright 2022 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
name: Lint
16+
on: [pull_request]
17+
18+
jobs:
19+
build:
20+
name: Run lint
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Setup Python
24+
uses: actions/setup-python@v3
25+
with:
26+
python-version: "3.9"
27+
28+
- name: Install nox
29+
run: pip install nox
30+
31+
- name: Checkout code
32+
uses: actions/checkout@v3
33+
34+
- name: Run nox lint session
35+
run: nox --sessions lint

noxfile.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Copyright 2022 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
from __future__ import absolute_import
16+
import os
17+
import nox
18+
19+
BLACK_PATHS = ["iam_groups_authn"]
20+
21+
if os.path.exists("samples"):
22+
BLACK_PATHS.append("samples")
23+
24+
25+
@nox.session
26+
def lint(session):
27+
"""Run linters.
28+
Returns a failure if the linters find linting errors or sufficiently
29+
serious code quality issues.
30+
"""
31+
session.install("-r", "requirements-test.txt")
32+
session.install("-r", "requirements.txt")
33+
session.run("black", "--check", *BLACK_PATHS)

requirements-test.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ google-api-python-client==2.19.1
99
cloud-sql-python-connector==0.4.1
1010
google-cloud-logging==2.6.0
1111
aiohttp==3.8.0
12+
black==22.3.0

0 commit comments

Comments
 (0)