mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
Run cpplint as part of our CI build
This will help ensure a consistent C++ coding style.
This commit is contained in:
3
brightray/.gitmodules
vendored
3
brightray/.gitmodules
vendored
@@ -4,3 +4,6 @@
|
||||
[submodule "vendor/gyp"]
|
||||
path = vendor/gyp
|
||||
url = https://github.com/svn2github/gyp
|
||||
[submodule "vendor/google-styleguide"]
|
||||
path = vendor/google-styleguide
|
||||
url = https://github.com/svn2github/sgss-mirror-google-styleguide
|
||||
|
||||
@@ -18,6 +18,7 @@ def main():
|
||||
|
||||
url = 'https://{0}.s3.amazonaws.com/libchromiumcontent'.format(os.environ['JANKY_ARTIFACTS_S3_BUCKET'])
|
||||
return (run_script('bootstrap', url) or
|
||||
run_script('cpplint') or
|
||||
run_script('build'))
|
||||
|
||||
|
||||
|
||||
36
brightray/script/cpplint
Executable file
36
brightray/script/cpplint
Executable file
@@ -0,0 +1,36 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import fnmatch
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
|
||||
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
|
||||
CPPLINT = os.path.join(SOURCE_ROOT, 'vendor', 'google-styleguide', 'trunk', 'cpplint', 'cpplint.py')
|
||||
|
||||
|
||||
def main():
|
||||
os.chdir(SOURCE_ROOT)
|
||||
files = list_files(['browser', 'common'],
|
||||
['*.cc', '*.mm', '*.h'])
|
||||
return cpplint(files)
|
||||
|
||||
|
||||
def list_files(directories, filters):
|
||||
matches = []
|
||||
for directory in directories:
|
||||
for root, _, filenames, in os.walk(directory):
|
||||
for f in filters:
|
||||
for filename in fnmatch.filter(filenames, f):
|
||||
matches.append(os.path.join(root, filename))
|
||||
return matches
|
||||
|
||||
|
||||
def cpplint(files):
|
||||
rules = '--filter=-build/header_guard'
|
||||
return subprocess.call([sys.executable, CPPLINT, rules] + files)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main())
|
||||
1
brightray/vendor/google-styleguide
vendored
Submodule
1
brightray/vendor/google-styleguide
vendored
Submodule
Submodule brightray/vendor/google-styleguide added at 8025f5495c
Reference in New Issue
Block a user