Skip to content
This repository has been archived by the owner on Nov 14, 2023. It is now read-only.

Commit

Permalink
Stop creating linter report files in CI (cvat-ai#6560)
Browse files Browse the repository at this point in the history
Currently, when one of the linters reports a problem, if you want to see
what that problem is, you have to do the following:

1. Click on the "Details" link in the PR.
2. Click "Summary".
3. Click the artifact (also, depending on the browser, choose where to
save it).
4. Open the downloaded file (which is an archive).
5. Open the report file from the archive.
6. Delete the archive after you're done.

That is far too much hassle, and all it gives you is a slightly fancier-
looking report (and sometimes not even that, like in the case of black).

So just remove all the report building and uploading. Now the above
procedure is reduced to:

1. Click "Details".
2. Expand the appropriate build step.
  • Loading branch information
SpecLad authored and mikhail-treskin committed Oct 25, 2023
1 parent a7f3860 commit 1fd59a8
Show file tree
Hide file tree
Showing 9 changed files with 8 additions and 117 deletions.
10 changes: 1 addition & 9 deletions .github/workflows/bandit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,11 @@ jobs:
. .env/bin/activate
pip install -U pip wheel setuptools
pip install bandit
mkdir -p bandit_report
echo "Bandit version: "$(bandit --version | head -1)
echo "The files will be checked: "$(echo $CHANGED_FILES)
bandit -a file --ini .bandit -f html -o ./bandit_report/bandit_checks.html $CHANGED_FILES
bandit -a file --ini .bandit $CHANGED_FILES
deactivate
else
echo "No files with the \"py\" extension found"
fi
- name: Upload artifacts
if: failure()
uses: actions/upload-artifact@v3.1.1
with:
name: bandit_report
path: bandit_report
10 changes: 1 addition & 9 deletions .github/workflows/black.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,23 +33,15 @@ jobs:
. .env/bin/activate
pip install -U pip wheel setuptools
pip install $(egrep "black.*" ./cvat-cli/requirements/development.txt)
mkdir -p black_report
echo "Black version: "$(black --version)
echo "The dirs will be checked: $UPDATED_DIRS"
EXIT_CODE=0
for DIR in $UPDATED_DIRS; do
black --check --diff $DIR >> ./black_report/black_checks.txt || EXIT_CODE=$(($? | $EXIT_CODE)) || true
black --check --diff $DIR || EXIT_CODE=$(($? | $EXIT_CODE)) || true
done
deactivate
exit $EXIT_CODE
else
echo "No files with the \"py\" extension found"
fi
- name: Upload artifacts
if: failure()
uses: actions/upload-artifact@v3.1.1
with:
name: black_report
path: black_report
11 changes: 1 addition & 10 deletions .github/workflows/eslint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,8 @@ jobs:
run: |
yarn install --frozen-lockfile
(cd tests && yarn install --frozen-lockfile)
yarn add eslint-detailed-reporter -D -W
- name: Run checks
run: |
echo "ESLint version: "$(yarn run -s eslint --version)
mkdir -p eslint_report
yarn run eslint . -f node_modules/eslint-detailed-reporter/lib/detailed.js -o ./eslint_report/eslint_checks.html
- name: Upload artifacts
if: failure()
uses: actions/upload-artifact@v3.1.1
with:
name: eslint_report
path: eslint_report
yarn run eslint .
20 changes: 1 addition & 19 deletions .github/workflows/hadolint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,26 +23,8 @@ jobs:
curl -sL -o $HADOLINT "https://github.com/hadolint/hadolint/releases/download/v$HADOLINT_VER/hadolint-Linux-x86_64" && chmod 700 $HADOLINT
echo "HadoLint version: "$($HADOLINT --version)
echo "The files will be checked: "$(echo $CHANGED_FILES)
mkdir -p hadolint_report
$HADOLINT --no-fail --format json $CHANGED_FILES > ./hadolint_report/hadolint_report.json
GET_VERIFICATION_LEVEL=$(cat ./hadolint_report/hadolint_report.json | jq -r '.[] | .level')
for LINE in $GET_VERIFICATION_LEVEL; do
if [[ $LINE =~ $VERIFICATION_LEVEL ]]; then
pip install json2html
python ./tests/json_to_html.py ./hadolint_report/hadolint_report.json
exit 1
else
exit 0
fi
done
$HADOLINT -t $VERIFICATION_LEVEL $CHANGED_FILES
else
echo "No files with the \"Dockerfile*\" name found"
fi
- name: Upload artifacts
if: failure()
uses: actions/upload-artifact@v3.1.1
with:
name: hadolint_report
path: hadolint_report
10 changes: 1 addition & 9 deletions .github/workflows/isort.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,15 @@ jobs:
. .env/bin/activate
pip install -U pip wheel setuptools
pip install $(egrep "isort.*" ./cvat-cli/requirements/development.txt)
mkdir -p isort_report
echo "isort version: $(isort --version-number)"
echo "The dirs will be checked: $UPDATED_DIRS"
EXIT_CODE=0
for DIR in $UPDATED_DIRS; do
isort --check $DIR >> ./isort_report/isort_checks.txt || EXIT_CODE=$(($? | $EXIT_CODE)) || true
isort --check $DIR || EXIT_CODE=$(($? | $EXIT_CODE)) || true
done
deactivate
exit $EXIT_CODE
else
echo "No files with the \"py\" extension found"
fi
- name: Upload artifacts
if: failure()
uses: actions/upload-artifact@v3.1.1
with:
name: isort_report
path: isort_report
13 changes: 1 addition & 12 deletions .github/workflows/pylint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,13 @@ jobs:
python3 -m venv .env
. .env/bin/activate
pip install -U pip wheel setuptools
pip install pylint-json2html
pip install $(egrep "pylint.*==.*" ./cvat/requirements/development.txt)
pip install $(egrep "django==.*" ./cvat/requirements/base.txt)
mkdir -p pylint_report
echo "Pylint version: "$(pylint --version | head -1)
echo "The files will be checked: "$(echo $CHANGED_FILES)
pylint $CHANGED_FILES --output-format=json > ./pylint_report/pylint_checks.json || EXIT_CODE=$(echo $?) || true
pylint-json2html -o ./pylint_report/pylint_checks.html ./pylint_report/pylint_checks.json
pylint $CHANGED_FILES
deactivate
exit $EXIT_CODE
else
echo "No files with the \"py\" extension found"
fi
- name: Upload artifacts
if: failure()
uses: actions/upload-artifact@v3.1.1
with:
name: pylint_report
path: pylint_report
16 changes: 1 addition & 15 deletions .github/workflows/remark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,6 @@ jobs:
- name: Run checks
run: |
yarn install --frozen-lockfile
mkdir -p remark_report
echo "Remark version: "`npx remark --version`
npx remark --quiet --report json --no-stdout -i .remarkignore . 2> ./remark_report/remark_report.json
get_report=`cat ./remark_report/remark_report.json | jq -r '.[] | select(.messages | length > 0)'`
if [[ ! -z ${get_report} ]]; then
pip install json2html
python ./tests/json_to_html.py ./remark_report/remark_report.json
exit 1
fi
- name: Upload artifacts
if: failure()
uses: actions/upload-artifact@v3.1.1
with:
name: remark_report
path: remark_report
npx remark --quiet --frail -i .remarkignore .
13 changes: 1 addition & 12 deletions .github/workflows/stylelint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,10 @@ jobs:
if [[ ! -z $CHANGED_FILES ]]; then
yarn install --frozen-lockfile
mkdir -p stylelint_report
echo "StyleLint version: "$(npx stylelint --version)
echo "The files will be checked: "$(echo $CHANGED_FILES)
npx stylelint --formatter json --output-file ./stylelint_report/stylelint_report.json $CHANGED_FILES || EXIT_CODE=$(echo $?) || true
pip install json2html
python ./tests/json_to_html.py ./stylelint_report/stylelint_report.json
exit $EXIT_CODE
npx stylelint $CHANGED_FILES
else
echo "No files with the \"css|scss\" extension found"
fi
- name: Upload artifacts
if: failure()
uses: actions/upload-artifact@v3.1.1
with:
name: stylelint_report
path: stylelint_report
22 changes: 0 additions & 22 deletions tests/json_to_html.py

This file was deleted.

0 comments on commit 1fd59a8

Please sign in to comment.