We currently need something like this in for example a Makefile:
PACKAGE_PATH=plone/
CHECK_PATH=setup.py $(PACKAGE_PATH)
LINT=docker run --rm -v "$(PWD)":/github/workspace plone/code-quality:1.0.1 check
lint:
# Would be nice to have a way to run all available checks, instead of specifying them here.
$(LINT) isort "$(CHECK_PATH)"
$(LINT) black "$(CHECK_PATH)"
$(LINT) flake8 "$(CHECK_PATH)"
$(LINT) pyroma .
$(LINT) zpretty "$(PACKAGE_PATH)"
And then in .github/workflows/code-analysis.yml you pass the same kinds of options/paths to the commands.
It would be nice if we can add some configuration in pyproject.toml and read it in docker-entrypoint.py:
import tomli
tomli.load(open("pyproject.toml", "rb"))
Configuration could be this:
[tool.plone.code-quality]
package_path = "plone/"
check_path= "setup.py plone"
# If no formatter or checker is given on the command line, run these:
formatters = ["isort", "black"]
checkers = ["black", "flake8"]
and/or this:
[tool.plone.code-quality.plugins]
isort = "setup.py plone"
# a list could work too:
black = ["setup.py", "plone"]
# disable this check:
flake8 = false
# this should be the default:
pyroma = "."
zpretty = "plone"
Result is like this:
{'tool': {'plone': {'code-quality': {
'check_path': 'setup.py plone',
'package_path': 'plone/',
'checkers': ['black', 'flake8'],
'formatters': ['isort', 'black'],
'plugins': {'black': ['setup.py', 'plone'],
'flake8': False,
'isort': 'setup.py plone',
'pyroma': '.',
'zpretty': 'plone'}}}}}
We currently need something like this in for example a
Makefile:And then in
.github/workflows/code-analysis.ymlyou pass the same kinds of options/paths to the commands.It would be nice if we can add some configuration in
pyproject.tomland read it indocker-entrypoint.py:Configuration could be this:
and/or this:
Result is like this: