forked from mozilla-services/socorro
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlint.sh
executable file
·43 lines (34 loc) · 1.11 KB
/
lint.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/bash
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# Usage: bin/lint.sh [--fix]
#
# Runs linting and code fixing.
#
# Note: This should be called from inside a container.
set -euo pipefail
FILES="socorro-cmd docker socorro webapp bin"
PYTHON_VERSION=$(python --version)
if [[ "${1:-}" == "--fix" ]]; then
echo ">>> ruff fix (${PYTHON_VERSION})"
ruff format $FILES
ruff check --fix $FILES
else
echo ">>> ruff (${PYTHON_VERSION})"
ruff check $FILES
ruff format --check $FILES
echo ">>> license check (${PYTHON_VERSION})"
if [[ -d ".git" ]]; then
# If the .git directory exists, we can let license-check.py do
# git ls-files.
python bin/license-check.py
else
# The .git directory doesn't exist, so run it on all the Python
# files in the tree.
python bin/license-check.py .
fi
echo ">>> eslint (js)"
cd /app/webapp
/webapp-frontend-deps/node_modules/.bin/eslint .
fi