Commit 6e4c8f68 authored by Iustin Pop's avatar Iustin Pop
Browse files

Enable hlint in lint and reorganise this target



Currently, the lint target does a sequential: pep8, pylint, pylint on
the QA sources. hlint is run only when explicitly requested.

This patch reorganises the lint target by:

- splitting the current lint target into separate pylint (slow),
  pylint-qa (fast), pep8 (fast) targets
- making lint itself depend on the above plus hlint
- both pep8 and hlint are optional, based on whether the said binaries
  were detected at configure time

make -j is slightly faster after this patch (1m18s → 1m7s).
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
parent b59092f7
......@@ -1314,24 +1314,40 @@ PEP8_IGNORE = E111,E261,E501
# For excluding pep8 expects filenames only, not whole paths
PEP8_EXCLUDE = $(subst $(space),$(comma),$(strip $(notdir $(BUILT_PYTHON_SOURCES))))
LINT_TARGETS = pylint pylint-qa
if HAS_PEP8
LINT_TARGETS += pep8
endif
if HAS_HLINT
LINT_TARGETS += hlint
endif
.PHONY: lint
lint: $(BUILT_SOURCES)
lint: $(LINT_TARGETS)
.PHONY: pylint
pylint: $(BUILT_SOURCES)
@test -n "$(PYLINT)" || { echo 'pylint' not found during configure; exit 1; }
if test -z "$(PEP8)"; then \
echo '"pep8" not found during configure' >&2; \
else \
$(PEP8) --repeat --ignore='$(PEP8_IGNORE)' --exclude='$(PEP8_EXCLUDE)' \
$(pep8_python_code); \
fi
$(PYLINT) $(LINT_OPTS) $(lint_python_code)
.PHONY: pylint-qa
pylint-qa: $(BUILT_SOURCES)
@test -n "$(PYLINT)" || { echo 'pylint' not found during configure; exit 1; }
cd $(top_srcdir)/qa && \
PYTHONPATH=$(abs_top_srcdir) $(PYLINT) $(LINT_OPTS) \
--rcfile ../pylintrc $(patsubst qa/%.py,%,$(qa_scripts))
.PHONY: pep8
pep8: $(BUILT_SOURCES)
@test -n "$(PEP8)" || { echo 'pep8' not found during configure; exit 1; }
$(PEP8) --ignore='$(PEP8_IGNORE)' --exclude='$(PEP8_EXCLUDE)' \
--repeat $(pep8_python_code)
.PHONY: hlint
hlint: $(HS_BUILT_SRCS) htools/lint-hints.hs
@test -n "$(HLINT)" || { echo 'hlint' not found during configure; exit 1; }
if tty -s; then C="-c"; else C=""; fi; \
hlint --report=doc/hs-lint.html --cross $$C \
$(HLINT) --report=doc/hs-lint.html --cross $$C \
--ignore "Use first" \
--ignore "Use comparing" \
--ignore "Use on" \
......
......@@ -387,6 +387,7 @@ if test -z "$PEP8"
then
AC_MSG_WARN([pep8 not found, checking code will not be complete])
fi
AM_CONDITIONAL([HAS_PEP8], [test "$PEP8"])
# Check for socat
AC_ARG_VAR(SOCAT, [socat path])
......@@ -518,6 +519,14 @@ if test "$HADDOCK" && test "$HSCOLOUR"; then
fi
AC_SUBST(HTOOLS_APIDOC)
# Check for hlint
HLINT=no
AC_ARG_VAR(HLINT, [hlint path])
AC_PATH_PROG(HLINT, [hlint], [])
if test -z "$HLINT"; then
AC_MSG_WARN([hlint not found, checking code will not be possible])
fi
fi # end if enable_htools, define automake conditions
if test "$HTOOLS" != "yes" && test "$HS_CONFD" = "True"; then
......@@ -528,6 +537,7 @@ fi
AM_CONDITIONAL([WANT_HTOOLS], [test x$HTOOLS = xyes])
AM_CONDITIONAL([WANT_HTOOLSTESTS], [test "x$GHC_PKG_QUICKCHECK" != x])
AM_CONDITIONAL([WANT_HTOOLSAPIDOC], [test x$HTOOLS_APIDOC = xyes])
AM_CONDITIONAL([HAS_HLINT], [test "$HLINT"])
# Check for fakeroot
AC_ARG_VAR(FAKEROOT_PATH, [fakeroot path])
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment