Browse Source

Merge branch 'travis-codepolicycheck-fix'

Fail 'make codepolicycheck' only in Travis test, not when developing.
pull/326/head
Sami Vaarala 9 years ago
parent
commit
53a6cf1f7c
  1. 3
      .travis.yml
  2. 21
      Makefile
  3. 4
      util/check_code_policy.py

3
.travis.yml

@ -7,6 +7,9 @@ before_install:
#compiler: #compiler:
# - clang # - clang
# - gcc # - gcc
env:
global:
- TRAVIS: 1 # affects e.g. codepolicycheck
script: script:
- make codepolicycheck - make codepolicycheck
- make apitest - make apitest

21
Makefile

@ -1044,9 +1044,16 @@ dist-site: tidy-site site
cp duktape-site-$(DUK_VERSION_FORMATTED).tar.xz duktape-site-$(DUK_VERSION_FORMATTED)-$(BUILD_DATETIME)-$(GIT_DESCRIBE).tar.xz cp duktape-site-$(DUK_VERSION_FORMATTED).tar.xz duktape-site-$(DUK_VERSION_FORMATTED)-$(BUILD_DATETIME)-$(GIT_DESCRIBE).tar.xz
rm -rf duktape-site-$(DUK_VERSION_FORMATTED) rm -rf duktape-site-$(DUK_VERSION_FORMATTED)
ifeq ($(TRAVIS),1)
CODEPOLICYOPTS=--fail-on-errors
else
CODEPOLICYOPTS=
endif
.PHONY: codepolicycheck .PHONY: codepolicycheck
codepolicycheck: codepolicycheck:
python util/check_code_policy.py \ python util/check_code_policy.py \
$(CODEPOLICYOPTS) \
--check-debug-log-calls \ --check-debug-log-calls \
--check-carriage-returns \ --check-carriage-returns \
--check-fixme \ --check-fixme \
@ -1059,8 +1066,9 @@ codepolicycheck:
--check-cpp-comment \ --check-cpp-comment \
--dump-vim-commands \ --dump-vim-commands \
src/*.c src/*.h src/*.h.in tests/api/*.c src/*.c src/*.h src/*.h.in tests/api/*.c
# Ecmascript tests Not yet FIXME pure; non-ASCII in some tests # Ecmascript tests: not yet FIXME pure; non-ASCII in some tests
python util/check_code_policy.py \ python util/check_code_policy.py \
$(CODEPOLICYOPTS) \
--check-debug-log-calls \ --check-debug-log-calls \
--check-carriage-returns \ --check-carriage-returns \
--check-no-symbol-visibility \ --check-no-symbol-visibility \
@ -1072,6 +1080,7 @@ codepolicycheck:
tests/ecmascript/*.js tests/ecmascript/*.js
# Examples may contain plain identifiers # Examples may contain plain identifiers
python util/check_code_policy.py \ python util/check_code_policy.py \
$(CODEPOLICYOPTS) \
--check-carriage-returns \ --check-carriage-returns \
--check-fixme \ --check-fixme \
--check-non-ascii \ --check-non-ascii \
@ -1081,6 +1090,16 @@ codepolicycheck:
--check-cpp-comment \ --check-cpp-comment \
--dump-vim-commands \ --dump-vim-commands \
examples/*/*.c examples/*/*.h examples/*/*.c examples/*/*.h
python util/check_code_policy.py \
$(CODEPOLICYOPTS) \
--check-carriage-returns \
--check-fixme \
--check-non-ascii \
--check-trailing-whitespace \
--check-mixed-indent \
--check-nonleading-tab \
--dump-vim-commands \
website/api/*.yaml website/api/*.html
.PHONY: codepolicycheckvim .PHONY: codepolicycheckvim
codepolicycheckvim: codepolicycheckvim:

4
util/check_code_policy.py

@ -383,6 +383,7 @@ def main():
parser.add_option('--check-mixed-indent', dest='check_mixed_indent', default=False, help='Check for mixed indent (space and tabs)') parser.add_option('--check-mixed-indent', dest='check_mixed_indent', default=False, help='Check for mixed indent (space and tabs)')
parser.add_option('--check-nonleading-tab', dest='check_nonleading_tab', default=False, help='Check for non-leading tab characters') parser.add_option('--check-nonleading-tab', dest='check_nonleading_tab', default=False, help='Check for non-leading tab characters')
parser.add_option('--check-cpp-comment', dest='check_cpp_comment', default=False, help='Check for c++ comments ("// ...")') parser.add_option('--check-cpp-comment', dest='check_cpp_comment', default=False, help='Check for c++ comments ("// ...")')
parser.add_option('--fail-on-errors', dest='fail_on_errors', default=False, help='Fail on errors (exit code != 0)')
(opts, args) = parser.parse_args() (opts, args) = parser.parse_args()
@ -437,7 +438,8 @@ def main():
print '' print ''
print('; '.join(cmds)) print('; '.join(cmds))
sys.exit(1) if opts.fail_on_errors:
sys.exit(1)
sys.exit(0) sys.exit(0)

Loading…
Cancel
Save