Skip to content

Commit a0bc2fd

Browse files
chore: new lint job
1 parent 8167936 commit a0bc2fd

File tree

3 files changed

+54
-36
lines changed

3 files changed

+54
-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: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
from __future__ import absolute_import
2+
import os
3+
import nox
4+
5+
BLACK_PATHS = ["iam_groups_authn"]
6+
7+
if os.path.exists("samples"):
8+
BLACK_PATHS.append("samples")
9+
10+
11+
@nox.session
12+
def lint(session):
13+
"""Run linters.
14+
Returns a failure if the linters find linting errors or sufficiently
15+
serious code quality issues.
16+
"""
17+
session.install("-r", "requirements-test.txt")
18+
session.install("-r", "requirements.txt")
19+
session.run("black", "--check", *BLACK_PATHS)

0 commit comments

Comments
 (0)