Skip to content

Commit 3a75a10

Browse files
committed
Add 'jbi lint' command
1 parent 647f136 commit 3a75a10

File tree

3 files changed

+30
-1
lines changed

3 files changed

+30
-1
lines changed

bin/lint.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ MYPY_CMD="$POETRY_RUN mypy jbi"
1818

1919
YAMLLINT_CMD="$POETRY_RUN yamllint -c .yamllint config/*.yaml"
2020

21+
ACTIONS_LINT_CMD="$POETRY_RUN jbi lint local && $POETRY_RUN jbi lint nonprod && $POETRY_RUN jbi lint prod"
22+
2123
all () {
2224
echo "running bandit"
2325
$BANDIT_CMD
@@ -31,6 +33,8 @@ all () {
3133
$MYPY_CMD
3234
echo "running yamllint"
3335
$YAMLLINT_CMD
36+
echo "running actions lint"
37+
$ACTIONS_LINT_CMD
3438
}
3539

3640
usage () {
@@ -43,6 +47,7 @@ usage () {
4347
echo " lint"
4448
echo " mypy"
4549
echo " yamllint"
50+
echo " actions"
4651
}
4752

4853
if [ -z "$1" ]; then
@@ -78,6 +83,9 @@ else
7883
"detect-secrets")
7984
$DETECT_SECRETS_CMD
8085
;;
86+
"actions")
87+
$ACTIONS_LINT_CMD
88+
;;
8189
*)
8290
usage
8391
;;

jbi/__main__.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import click
2+
3+
from jbi.configuration import get_actions
4+
5+
@click.group()
6+
def cli():
7+
pass
8+
9+
@cli.command()
10+
@click.argument("env", default="prod")
11+
def lint(env):
12+
click.echo(f"Linting: {env} configuration")
13+
14+
get_actions(env)
15+
click.secho("No issues found.", fg="green")
16+
17+
if __name__ == "__main__":
18+
cli()

pyproject.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[tool.poetry]
2-
name = "jira-bugzilla-integration"
2+
name = "jbi"
33
version = "0"
44
description = "jira-bugzilla-integration"
55
authors = ["@mozilla/jbi-core"]
@@ -22,6 +22,7 @@ pydantic-settings = "^2.7.1"
2222
pypandoc = "^1.15"
2323

2424
[tool.poetry.group.dev.dependencies]
25+
click = "^8.1.7"
2526
pre-commit = "^4.1.0"
2627
coverage = {extras = ["toml"], version = "^7.6"}
2728
mypy = "^1.14"
@@ -39,6 +40,8 @@ ruff = "^0.9.3"
3940
pytest-mock = "^3.14.0"
4041
pytest-asyncio = "^0.25.2"
4142

43+
[tool.poetry.scripts]
44+
jbi = "jbi.__main__:cli"
4245

4346
[build-system]
4447
requires = ["poetry-core>=1.0.0"]

0 commit comments

Comments
 (0)