blob: e8a69ef6424e7a15d133c93099688f2cd95d9320 [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 \
32 external/:,-google-explicit-constructor \
33 external/:,-google-runtime-int \
34 external/google:,google-runtime-int \
35 external/webrtc/:,google-runtime-int \
36
37# Returns 2nd word of $(1) if $(2) has prefix of the 1st word of $(1).
38define find_default_local_tidy_check2
39$(if $(filter $(word 1,$(1))%,$(2)/),$(word 2,$(1)))
40endef
41
42# Returns 2nd part of $(1) if $(2) has prefix of the 1st part of $(1).
43define find_default_local_tidy_check
44$(call find_default_local_tidy_check2,$(subst :,$(space),$(1)),$(2))
45endef
46
47# Returns concatenated tidy check patterns from the
48# DEFAULT_GLOBAL_TIDY_CHECKS and all matched patterns
49# in DEFAULT_LOCAL_TIDY_CHECKS based on given directory path $(1).
50define default_global_tidy_checks
51$(subst $(space),, \
52 $(DEFAULT_GLOBAL_TIDY_CHECKS) \
53 $(foreach pattern,$(DEFAULT_LOCAL_TIDY_CHECKS), \
54 $(call find_default_local_tidy_check,$(pattern),$(1)) \
55 ) \
56)
57endef