Skip to content

Commit

Permalink
Several improvements
Browse files Browse the repository at this point in the history
- The preflight-summary GH workflow: don't post linter reports if they
  don't fit into the comment size limit
- Dockerfiles: remove pip's cache in `~/.cache/pip`
- Use `line length = 88 chars` for Pylint and Black
  • Loading branch information
Igor Sudak committed Apr 18, 2024
1 parent c68bf10 commit 7ad7bb5
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/preflight-summary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,13 @@ jobs:
cat {pylint,black,isort,bandit}-report.md > linter-reports.md 2>/dev/null || true
if [[ -s linter-reports.md ]]; then
printf "### Linter reports\n"
# Max size of comments on GitHub is 64KB. If the reports > 54KB, don't post them
if [[ $(stat --format=%s linter-reports.md) -gt 55296 ]]; then
printf "The reports are too big to be posted here.\n"
else
# Max size of comments on GitHub is 64KB. Don't post reports if they don't fit.
if awk '{sum += $1} END {exit sum > (62*1024)}' \
<<< $(stat --format=%s test-summary.md code-coverage-results.md linter-reports.md)
then
cat linter-reports.md
else
printf "The reports are too big to be posted here.\n"
fi
fi
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.celery
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,4 @@ RUN <<EOT
pip3 install -r celery.txt
EOT

RUN rm -f *.txt
RUN rm -rf *.txt ~/.cache/pip
6 changes: 3 additions & 3 deletions Dockerfile.scheduler
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM almalinux:9 as alts-scheduler
FROM almalinux:9-base as alts-scheduler

RUN <<EOT
set -ex
Expand All @@ -23,7 +23,7 @@ RUN <<EOT
set -ex
python3 -m ensurepip
pip3 install -r scheduler.txt
rm -f *.txt
rm -rf *.txt ~/.cache/pip
EOT

ADD --chmod=755 https://raw.githubusercontent.com/vishnubob/wait-for-it/master/wait-for-it.sh /
Expand All @@ -35,5 +35,5 @@ COPY requirements/tests.txt requirements-tests.txt
RUN <<EOT
set -ex
pip3 install -r requirements-tests.txt
rm requirements-tests.txt
rm -rf requirements-tests.txt ~/.cache/pip
EOT
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ profile = "black"
split_on_trailing_comma = true

[tool.black]
line-length = 120
line-length = 88
skip-string-normalization = true
# see https://black.readthedocs.io/en/stable/the_black_code_style/future_style.html#preview-style
preview = true
enable-unstable-feature = ["hug_parens_with_braces_and_square_brackets"]

[tool.pylint]
max-line-length = 120
max-line-length = 88

# Minimum line length for functions/classes that require docstrings
docstring-min-length = 50
Expand Down

0 comments on commit 7ad7bb5

Please sign in to comment.