2016-04-22 06:37:24 +08:00
|
|
|
#
|
|
|
|
# Copyright (C) 2016 The Android Open Source Project
|
|
|
|
#
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
# You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
|
|
|
#
|
|
|
|
|
|
|
|
# Most Android source files are not clang-tidy clean yet.
|
2016-07-27 05:27:03 +08:00
|
|
|
# Global tidy checks include only google*, performance*,
|
|
|
|
# and misc-macro-parentheses, but not google-readability*
|
|
|
|
# or google-runtime-references.
|
2016-04-22 06:37:24 +08:00
|
|
|
DEFAULT_GLOBAL_TIDY_CHECKS := \
|
2016-07-27 05:27:03 +08:00
|
|
|
-*,google*,performance*,misc-macro-parentheses \
|
|
|
|
,-google-readability*,-google-runtime-references
|
2016-04-22 06:37:24 +08:00
|
|
|
|
2016-05-12 04:39:48 +08:00
|
|
|
# Disable style rules usually not followed by external projects.
|
2016-04-22 06:37:24 +08:00
|
|
|
# Every word in DEFAULT_LOCAL_TIDY_CHECKS list has the following format:
|
|
|
|
# <local_path_prefix>:,<tidy-check-pattern>
|
|
|
|
# The tidy-check-patterns of all matching local_path_prefixes will be used.
|
|
|
|
# For example, external/google* projects will have:
|
|
|
|
# ,-google-build-using-namespace,-google-explicit-constructor
|
2016-05-12 04:39:48 +08:00
|
|
|
# ,-google-runtime-int,-misc-macro-parentheses,
|
|
|
|
# ,google-runtime-int,misc-macro-parentheses
|
|
|
|
# where google-runtime-int and misc-macro-parentheses are enabled at the end.
|
2016-04-22 06:37:24 +08:00
|
|
|
DEFAULT_LOCAL_TIDY_CHECKS := \
|
|
|
|
external/:,-google-build-using-namespace \
|
2016-04-30 06:16:59 +08:00
|
|
|
external/:,-google-explicit-constructor,-google-runtime-int \
|
2016-05-12 04:39:48 +08:00
|
|
|
external/:,-misc-macro-parentheses \
|
|
|
|
external/google:,google-runtime-int,misc-macro-parentheses \
|
2016-04-22 06:37:24 +08:00
|
|
|
external/webrtc/:,google-runtime-int \
|
2016-04-30 06:16:59 +08:00
|
|
|
hardware/qcom:,-google-build-using-namespace \
|
|
|
|
hardware/qcom:,-google-explicit-constructor,-google-runtime-int \
|
2016-07-21 01:08:51 +08:00
|
|
|
vendor/lge:,-google-build-using-namespace,-misc-macro-parentheses \
|
2016-04-30 06:16:59 +08:00
|
|
|
vendor/lge:,-google-explicit-constructor,-google-runtime-int \
|
2016-07-21 01:08:51 +08:00
|
|
|
vendor/widevine:,-google-build-using-namespace,-misc-macro-parentheses \
|
2016-04-30 06:16:59 +08:00
|
|
|
vendor/widevine:,-google-explicit-constructor,-google-runtime-int \
|
2016-04-22 06:37:24 +08:00
|
|
|
|
|
|
|
# Returns 2nd word of $(1) if $(2) has prefix of the 1st word of $(1).
|
|
|
|
define find_default_local_tidy_check2
|
|
|
|
$(if $(filter $(word 1,$(1))%,$(2)/),$(word 2,$(1)))
|
|
|
|
endef
|
|
|
|
|
|
|
|
# Returns 2nd part of $(1) if $(2) has prefix of the 1st part of $(1).
|
|
|
|
define find_default_local_tidy_check
|
|
|
|
$(call find_default_local_tidy_check2,$(subst :,$(space),$(1)),$(2))
|
|
|
|
endef
|
|
|
|
|
|
|
|
# Returns concatenated tidy check patterns from the
|
|
|
|
# DEFAULT_GLOBAL_TIDY_CHECKS and all matched patterns
|
|
|
|
# in DEFAULT_LOCAL_TIDY_CHECKS based on given directory path $(1).
|
|
|
|
define default_global_tidy_checks
|
|
|
|
$(subst $(space),, \
|
|
|
|
$(DEFAULT_GLOBAL_TIDY_CHECKS) \
|
|
|
|
$(foreach pattern,$(DEFAULT_LOCAL_TIDY_CHECKS), \
|
|
|
|
$(call find_default_local_tidy_check,$(pattern),$(1)) \
|
|
|
|
) \
|
|
|
|
)
|
|
|
|
endef
|