mirror of https://github.com/zulip/zulip.git
lint: Add --skip arg to replace --no-gitlint/mypy.
Use --skip=gitlint,mypy instead of --no-gitlint/mypy.
This commit is contained in:
parent
426a222b7e
commit
6b73926e93
|
@ -6,7 +6,7 @@ echo "Test suite is running under $(python --version)."
|
||||||
set -e
|
set -e
|
||||||
set -x
|
set -x
|
||||||
|
|
||||||
./tools/lint --backend --no-gitlint --no-mypy # gitlint disabled because flaky
|
./tools/lint --backend --skip=gitlint,mypy # gitlint disabled because flaky
|
||||||
./tools/test-tools
|
./tools/test-tools
|
||||||
# We need to pass a parallel level to test-backend because CircleCI's
|
# We need to pass a parallel level to test-backend because CircleCI's
|
||||||
# docker setup means the auto-detection logic sees the ~36 processes
|
# docker setup means the auto-detection logic sees the ~36 processes
|
||||||
|
|
|
@ -5,7 +5,7 @@ source tools/ci/activate-venv
|
||||||
set -e
|
set -e
|
||||||
set -x
|
set -x
|
||||||
|
|
||||||
./tools/lint --frontend --no-gitlint # gitlint disabled because flaky
|
./tools/lint --frontend --skip=gitlint # gitlint disabled because flaky
|
||||||
|
|
||||||
# Run the node tests first, since they're fast and deterministic
|
# Run the node tests first, since they're fast and deterministic
|
||||||
./tools/test-js-with-node --coverage
|
./tools/test-js-with-node --coverage
|
||||||
|
|
10
tools/lint
10
tools/lint
|
@ -25,12 +25,6 @@ def run():
|
||||||
parser.add_argument('--full',
|
parser.add_argument('--full',
|
||||||
action='store_true',
|
action='store_true',
|
||||||
help='Check some things we typically ignore')
|
help='Check some things we typically ignore')
|
||||||
parser.add_argument('--no-gitlint',
|
|
||||||
action='store_true',
|
|
||||||
help='Disable gitlint')
|
|
||||||
parser.add_argument('--no-mypy',
|
|
||||||
action='store_true',
|
|
||||||
help='Disable mypy')
|
|
||||||
limited_tests_group = parser.add_mutually_exclusive_group()
|
limited_tests_group = parser.add_mutually_exclusive_group()
|
||||||
limited_tests_group.add_argument('--frontend',
|
limited_tests_group.add_argument('--frontend',
|
||||||
action='store_true',
|
action='store_true',
|
||||||
|
@ -96,14 +90,14 @@ def run():
|
||||||
linter_config.external_linter('templates', ['tools/check-templates'], ['handlebars', 'html'])
|
linter_config.external_linter('templates', ['tools/check-templates'], ['handlebars', 'html'])
|
||||||
linter_config.external_linter('swagger', ['node', 'tools/check-swagger'], ['yaml'])
|
linter_config.external_linter('swagger', ['node', 'tools/check-swagger'], ['yaml'])
|
||||||
linter_config.external_linter('shellcheck', ['shellcheck', '-x'], ['sh'])
|
linter_config.external_linter('shellcheck', ['shellcheck', '-x'], ['sh'])
|
||||||
if not args.no_mypy:
|
if 'mypy' not in args.skip:
|
||||||
command = ['tools/run-mypy']
|
command = ['tools/run-mypy']
|
||||||
if args.force:
|
if args.force:
|
||||||
command.append('--force')
|
command.append('--force')
|
||||||
linter_config.external_linter('mypy', command, ['py'], pass_targets=False)
|
linter_config.external_linter('mypy', command, ['py'], pass_targets=False)
|
||||||
|
|
||||||
# Disabled check for imperative mood until it is stabilized
|
# Disabled check for imperative mood until it is stabilized
|
||||||
if not args.no_gitlint:
|
if 'gitlint' not in args.skip:
|
||||||
linter_config.external_linter('commit_messages', ['tools/commit-message-lint'])
|
linter_config.external_linter('commit_messages', ['tools/commit-message-lint'])
|
||||||
|
|
||||||
@linter_config.lint
|
@linter_config.lint
|
||||||
|
|
|
@ -19,10 +19,10 @@ if [ ${#changed_files} -eq 0 ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$VIRTUAL_ENV" ] && command -v vagrant > /dev/null && [ -e .vagrant ]; then
|
if [ -z "$VIRTUAL_ENV" ] && command -v vagrant > /dev/null && [ -e .vagrant ]; then
|
||||||
vcmd="/srv/zulip/tools/lint --no-gitlint --force $(printf '%q ' "${changed_files[@]}") || true"
|
vcmd="/srv/zulip/tools/lint --skip=gitlint --force $(printf '%q ' "${changed_files[@]}") || true"
|
||||||
echo "Running lint using vagrant..."
|
echo "Running lint using vagrant..."
|
||||||
vagrant ssh -c "$vcmd"
|
vagrant ssh -c "$vcmd"
|
||||||
else
|
else
|
||||||
./tools/lint --no-gitlint --force "${changed_files[@]}" || true
|
./tools/lint --skip=gitlint --force "${changed_files[@]}" || true
|
||||||
fi
|
fi
|
||||||
exit 0
|
exit 0
|
||||||
|
|
|
@ -26,6 +26,14 @@ def add_default_linter_arguments(parser):
|
||||||
parser.add_argument('targets',
|
parser.add_argument('targets',
|
||||||
nargs='*',
|
nargs='*',
|
||||||
help='Specify directories to check')
|
help='Specify directories to check')
|
||||||
|
parser.add_argument('--skip',
|
||||||
|
default=[],
|
||||||
|
type=split_arg_into_list,
|
||||||
|
help='Specify linters to skip, eg: --skip=mypy,gitlint')
|
||||||
|
|
||||||
|
def split_arg_into_list(arg):
|
||||||
|
# type: (str) -> List[str]
|
||||||
|
return [linter for linter in arg.split(',')]
|
||||||
|
|
||||||
def run_parallel(lint_functions):
|
def run_parallel(lint_functions):
|
||||||
# type: (Dict[str, Callable[[], int]]) -> bool
|
# type: (Dict[str, Callable[[], int]]) -> bool
|
||||||
|
|
Loading…
Reference in New Issue