blob: e61b87852726d0cccf1fc7eb4596218b71186525 [file] [log] [blame]
Chih-Hung Hsieh460171a2016-04-21 15:37:24 -07001#
2# Copyright (C) 2016 The Android Open Source Project
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16
17# Most Android source files are not clang-tidy clean yet.
18# Global tidy checks include only google* minus google-readability*.
19DEFAULT_GLOBAL_TIDY_CHECKS := \
20 -*,google*,-google-readability*
21
22# Disable google style rules usually not followed by external projects.
23# Every word in DEFAULT_LOCAL_TIDY_CHECKS list has the following format:
24# <local_path_prefix>:,<tidy-check-pattern>
25# The tidy-check-patterns of all matching local_path_prefixes will be used.
26# For example, external/google* projects will have:
27# ,-google-build-using-namespace,-google-explicit-constructor
28# ,-google-runtime-int,google-runtime-int
29# where google-runtime-int is enabled at the end.
30DEFAULT_LOCAL_TIDY_CHECKS := \
31 external/:,-google-build-using-namespace \
Chih-Hung Hsieh30f86e42016-04-29 15:16:59 -070032 external/:,-google-explicit-constructor,-google-runtime-int \
Chih-Hung Hsieh460171a2016-04-21 15:37:24 -070033 external/google:,google-runtime-int \
34 external/webrtc/:,google-runtime-int \
Chih-Hung Hsieh30f86e42016-04-29 15:16:59 -070035 hardware/qcom:,-google-build-using-namespace \
36 hardware/qcom:,-google-explicit-constructor,-google-runtime-int \
37 vendor/lge:,-google-build-using-namespace \
38 vendor/lge:,-google-explicit-constructor,-google-runtime-int \
39 vendor/widevine:,-google-build-using-namespace \
40 vendor/widevine:,-google-explicit-constructor,-google-runtime-int \
Chih-Hung Hsieh460171a2016-04-21 15:37:24 -070041
42# Returns 2nd word of $(1) if $(2) has prefix of the 1st word of $(1).
43define find_default_local_tidy_check2
44$(if $(filter $(word 1,$(1))%,$(2)/),$(word 2,$(1)))
45endef
46
47# Returns 2nd part of $(1) if $(2) has prefix of the 1st part of $(1).
48define find_default_local_tidy_check
49$(call find_default_local_tidy_check2,$(subst :,$(space),$(1)),$(2))
50endef
51
52# Returns concatenated tidy check patterns from the
53# DEFAULT_GLOBAL_TIDY_CHECKS and all matched patterns
54# in DEFAULT_LOCAL_TIDY_CHECKS based on given directory path $(1).
55define default_global_tidy_checks
56$(subst $(space),, \
57 $(DEFAULT_GLOBAL_TIDY_CHECKS) \
58 $(foreach pattern,$(DEFAULT_LOCAL_TIDY_CHECKS), \
59 $(call find_default_local_tidy_check,$(pattern),$(1)) \
60 ) \
61)
62endef