mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 11:18:54 -05:00
Stop using git ls-files *.py for style check (#4040)
This commit is contained in:
parent
c251804162
commit
07e480ff7a
8
Makefile
8
Makefile
@ -1,12 +1,14 @@
|
|||||||
PYTHON ?= python3.8
|
PYTHON ?= python3.8
|
||||||
|
|
||||||
|
ROOT_DIR:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
|
||||||
|
|
||||||
# Python Code Style
|
# Python Code Style
|
||||||
reformat:
|
reformat:
|
||||||
$(PYTHON) -m black `git ls-files "*.py"`
|
$(PYTHON) -m black $(ROOT_DIR)
|
||||||
stylecheck:
|
stylecheck:
|
||||||
$(PYTHON) -m black --check `git ls-files "*.py"`
|
$(PYTHON) -m black --check $(ROOT_DIR)
|
||||||
stylediff:
|
stylediff:
|
||||||
$(PYTHON) -m black --check --diff `git ls-files "*.py"`
|
$(PYTHON) -m black --check --diff $(ROOT_DIR)
|
||||||
|
|
||||||
# Translations
|
# Translations
|
||||||
gettext:
|
gettext:
|
||||||
|
|||||||
12
make.bat
12
make.bat
@ -5,24 +5,18 @@ if [%1] == [] goto help
|
|||||||
REM This allows us to expand variables at execution
|
REM This allows us to expand variables at execution
|
||||||
setlocal ENABLEDELAYEDEXPANSION
|
setlocal ENABLEDELAYEDEXPANSION
|
||||||
|
|
||||||
REM This will set PYFILES as a list of tracked .py files
|
|
||||||
set PYFILES=
|
|
||||||
for /F "tokens=* USEBACKQ" %%A in (`git ls-files "*.py"`) do (
|
|
||||||
set PYFILES=!PYFILES! %%A
|
|
||||||
)
|
|
||||||
|
|
||||||
goto %1
|
goto %1
|
||||||
|
|
||||||
:reformat
|
:reformat
|
||||||
black !PYFILES!
|
black "%~dp0."
|
||||||
exit /B %ERRORLEVEL%
|
exit /B %ERRORLEVEL%
|
||||||
|
|
||||||
:stylecheck
|
:stylecheck
|
||||||
black --check !PYFILES!
|
black --check "%~dp0."
|
||||||
exit /B %ERRORLEVEL%
|
exit /B %ERRORLEVEL%
|
||||||
|
|
||||||
:stylediff
|
:stylediff
|
||||||
black --check --diff !PYFILES!
|
black --check --diff "%~dp0."
|
||||||
exit /B %ERRORLEVEL%
|
exit /B %ERRORLEVEL%
|
||||||
|
|
||||||
:newenv
|
:newenv
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user