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 -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
|
||||
# We need to pass a parallel level to test-backend because CircleCI's
|
||||
# docker setup means the auto-detection logic sees the ~36 processes
|
||||
|
|
|
@ -5,7 +5,7 @@ source tools/ci/activate-venv
|
|||
set -e
|
||||
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
|
||||
./tools/test-js-with-node --coverage
|
||||
|
|
10
tools/lint
10
tools/lint
|
@ -25,12 +25,6 @@ def run():
|
|||
parser.add_argument('--full',
|
||||
action='store_true',
|
||||
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.add_argument('--frontend',
|
||||
action='store_true',
|
||||
|
@ -96,14 +90,14 @@ def run():
|
|||
linter_config.external_linter('templates', ['tools/check-templates'], ['handlebars', 'html'])
|
||||
linter_config.external_linter('swagger', ['node', 'tools/check-swagger'], ['yaml'])
|
||||
linter_config.external_linter('shellcheck', ['shellcheck', '-x'], ['sh'])
|
||||
if not args.no_mypy:
|
||||
if 'mypy' not in args.skip:
|
||||
command = ['tools/run-mypy']
|
||||
if args.force:
|
||||
command.append('--force')
|
||||
linter_config.external_linter('mypy', command, ['py'], pass_targets=False)
|
||||
|
||||
# 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.lint
|
||||
|
|
|
@ -19,10 +19,10 @@ if [ ${#changed_files} -eq 0 ]; then
|
|||
fi
|
||||
|
||||
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..."
|
||||
vagrant ssh -c "$vcmd"
|
||||
else
|
||||
./tools/lint --no-gitlint --force "${changed_files[@]}" || true
|
||||
./tools/lint --skip=gitlint --force "${changed_files[@]}" || true
|
||||
fi
|
||||
exit 0
|
||||
|
|
|
@ -26,6 +26,14 @@ def add_default_linter_arguments(parser):
|
|||
parser.add_argument('targets',
|
||||
nargs='*',
|
||||
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):
|
||||
# type: (Dict[str, Callable[[], int]]) -> bool
|
||||
|
|
Loading…
Reference in New Issue