Makefile 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. # Flexlay - A Generic 2D Game Editor
  2. # Copyright (C) 2018 Ingo Ruhnke <grumbel@gmail.com>
  3. #
  4. # This program is free software: you can redistribute it and/or modify
  5. # it under the terms of the GNU General Public License as published by
  6. # the Free Software Foundation, either version 3 of the License, or
  7. # (at your option) any later version.
  8. #
  9. # This program is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. # GNU General Public License for more details.
  13. #
  14. # You should have received a copy of the GNU General Public License
  15. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. SOURCES := $(wildcard flexlay/*.py flexlay/*/*.py supertux/*.py tests/*.py)
  17. default: flake mypy # test
  18. all: autopep flake test pylint
  19. autopep:
  20. autopep8 --max-line=120 --in-place --aggressive $(SOURCES)
  21. test:
  22. python3 -m unittest discover -v -s tests/
  23. mypy:
  24. mypy \
  25. --incremental \
  26. --ignore-missing-imports \
  27. --follow-imports skip \
  28. --warn-return-any \
  29. --warn-unused-ignores \
  30. --warn-incomplete-stub \
  31. --warn-redundant-casts \
  32. $(SOURCES)
  33. mypyverbose:
  34. export MYPYPATH=/usr/lib/python3/dist-packages/; \
  35. mypy \
  36. --incremental \
  37. --ignore-missing-imports \
  38. --follow-imports silent \
  39. --check-untyped-defs \
  40. --warn-return-any \
  41. --warn-unused-ignores \
  42. --warn-incomplete-stub \
  43. --warn-redundant-casts \
  44. $(SOURCES) | \
  45. grep -v ^/usr | \
  46. fgrep -v '"pyqtSignal" has no attribute' | \
  47. grep -v 'Callable.*has no attribute "connect' | \
  48. fgrep -v 'No overload variant of "QAction" matches argument types'
  49. # --disallow-any unimported,unannotated,decorated,explicit,generics \
  50. # --disallow-any unimported,expr,unannotated,decorated,explicit,generics \
  51. flake:
  52. flake8 --max-line-length=120 --ignore=N802,W504 $(SOURCES)
  53. PYLINT_TARGETS := $(addprefix .pylint/, $(SOURCES))
  54. $(PYLINT_TARGETS): .pylint/%.py: %.py
  55. mkdir -p $(dir $@)
  56. PYTHONPATH=. epylint3 $< --rcfile=.pylintrc --max-line-length=120 --extension-pkg-whitelist=PyQt5
  57. touch $@
  58. pylint: $(PYLINT_TARGETS)
  59. clean:
  60. rm -vrf .pylint/
  61. install:
  62. sudo -H pip3 install --force-reinstall --upgrade .
  63. .PHONY: autopep test flake pylint clean all default run
  64. .NOTPARALLEL: all
  65. # EOF #