mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
ci(clint): remove check for include order
Uncrustify and clang-format are already both excellent at ordering includes; this isn't something we need to check for ourselves. Also remove the section on include order in the dev-style documentation.
This commit is contained in:
parent
adf967331f
commit
3bd7246f5a
@ -48,22 +48,6 @@ The format of the symbol name should be `NVIM_<DIRECTORY>_<FILE>_H`.
|
|||||||
<
|
<
|
||||||
|
|
||||||
|
|
||||||
Names and Order of Includes ~
|
|
||||||
|
|
||||||
Use standard order for readability and to avoid hidden dependencies: C
|
|
||||||
library, other libraries' `.h`, your project's `.h`.
|
|
||||||
|
|
||||||
In foo.c order your includes as follows:
|
|
||||||
|
|
||||||
1. C system files.
|
|
||||||
2. Other libraries' `.h` files.
|
|
||||||
3. Your project's `.h` files.
|
|
||||||
|
|
||||||
Exception: sometimes, system-specific code needs conditional includes.
|
|
||||||
Such code can put conditional includes after other includes. Of course,
|
|
||||||
keep your system-specific code small and localized.
|
|
||||||
|
|
||||||
|
|
||||||
Constants ~
|
Constants ~
|
||||||
|
|
||||||
Do not use macros to define constants in headers.
|
Do not use macros to define constants in headers.
|
||||||
|
38
src/clint.py
38
src/clint.py
@ -175,7 +175,6 @@ _ERROR_CATEGORIES = [
|
|||||||
'build/header_guard',
|
'build/header_guard',
|
||||||
'build/include',
|
'build/include',
|
||||||
'build/include_alpha',
|
'build/include_alpha',
|
||||||
'build/include_order',
|
|
||||||
'build/printf_format',
|
'build/printf_format',
|
||||||
'build/storage_class',
|
'build/storage_class',
|
||||||
'build/useless_fattr',
|
'build/useless_fattr',
|
||||||
@ -2919,20 +2918,6 @@ def CheckStyle(filename, clean_lines, linenum, file_extension, error):
|
|||||||
_RE_PATTERN_INCLUDE = re.compile(r'^\s*#\s*include\s*([<"])([^>"]*)[>"].*$')
|
_RE_PATTERN_INCLUDE = re.compile(r'^\s*#\s*include\s*([<"])([^>"]*)[>"].*$')
|
||||||
|
|
||||||
|
|
||||||
def _ClassifyInclude(is_system):
|
|
||||||
"""Figures out what kind of header 'include' is.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
is_system: True if the #include used <> rather than "".
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
One of the _XXX_HEADER constants.
|
|
||||||
"""
|
|
||||||
if is_system:
|
|
||||||
return _C_SYS_HEADER
|
|
||||||
return _OTHER_HEADER
|
|
||||||
|
|
||||||
|
|
||||||
def CheckIncludeLine(filename, clean_lines, linenum, include_state, error):
|
def CheckIncludeLine(filename, clean_lines, linenum, include_state, error):
|
||||||
"""Check rules that are applicable to #include lines.
|
"""Check rules that are applicable to #include lines.
|
||||||
|
|
||||||
@ -2963,29 +2948,6 @@ def CheckIncludeLine(filename, clean_lines, linenum, include_state, error):
|
|||||||
error(filename, linenum, 'build/include', 4,
|
error(filename, linenum, 'build/include', 4,
|
||||||
'"%s" already included at %s:%s' %
|
'"%s" already included at %s:%s' %
|
||||||
(include, filename, include_state[include]))
|
(include, filename, include_state[include]))
|
||||||
else:
|
|
||||||
include_state[include] = linenum
|
|
||||||
|
|
||||||
# We want to ensure that headers appear in the right order:
|
|
||||||
# 1) for foo.cc, foo.h (preferred location)
|
|
||||||
# 2) c system files
|
|
||||||
# 3) cpp system files
|
|
||||||
# 4) for foo.cc, foo.h (deprecated location)
|
|
||||||
# 5) other google headers
|
|
||||||
#
|
|
||||||
# We classify each include statement as one of those 5 types
|
|
||||||
# using a number of techniques. The include_state object keeps
|
|
||||||
# track of the highest type seen, and complains if we see a
|
|
||||||
# lower type after that.
|
|
||||||
error_message = include_state.CheckNextIncludeOrder(
|
|
||||||
_ClassifyInclude(is_system))
|
|
||||||
if error_message:
|
|
||||||
error(filename, linenum, 'build/include_order', 4,
|
|
||||||
'%s. Should be: c system, c++ system, other.'
|
|
||||||
% error_message)
|
|
||||||
canonical_include = include_state.CanonicalizeAlphabeticalOrder(
|
|
||||||
include)
|
|
||||||
include_state.SetLastHeader(canonical_include)
|
|
||||||
|
|
||||||
|
|
||||||
def _GetTextInside(text, start_pattern):
|
def _GetTextInside(text, start_pattern):
|
||||||
|
Loading…
Reference in New Issue
Block a user