clang-format: add a whitelist (#5459)

If file is in the whitelist, softfail, else hard failure

Some files are not in whitelist and marked as normal:
* src/content_mapnode.h
* src/cguittfont/xCGUITTFont.cpp
* src/gameparams.h
* src/profiler.cpp
This commit is contained in:
Loïc Blot 2017-03-27 15:33:15 +02:00 committed by GitHub
parent a9878a0da5
commit 4b05feaceb
2 changed files with 466 additions and 2 deletions

View File

@ -0,0 +1,455 @@
src/activeobject.h
src/ban.cpp
src/ban.h
src/camera.cpp
src/camera.h
src/cavegen.cpp
src/cavegen.h
src/cguittfont/CGUITTFont.cpp
src/cguittfont/CGUITTFont.h
src/cguittfont/irrUString.h
src/cguittfont/xCGUITTFont.h
src/chat.cpp
src/chat.h
src/chat_interface.h
src/client/clientlauncher.cpp
src/client/clientlauncher.h
src/client.cpp
src/clientenvironment.cpp
src/clientenvironment.h
src/client.h
src/clientiface.cpp
src/clientiface.h
src/client/inputhandler.h
src/client/joystick_controller.cpp
src/client/joystick_controller.h
src/client/keys.h
src/clientmap.cpp
src/clientmap.h
src/clientmedia.cpp
src/clientmedia.h
src/clientobject.cpp
src/clientobject.h
src/clientsimpleobject.h
src/client/tile.cpp
src/client/tile.h
src/clouds.cpp
src/clouds.h
src/collision.cpp
src/collision.h
src/config.h
src/constants.h
src/content_abm.cpp
src/content_abm.h
src/content_cao.cpp
src/content_cao.h
src/content_cso.cpp
src/content_cso.h
src/content_mapblock.cpp
src/content_mapblock.h
src/content_mapnode.cpp
src/content_nodemeta.cpp
src/content_nodemeta.h
src/content_sao.cpp
src/content_sao.h
src/convert_json.cpp
src/convert_json.h
src/craftdef.cpp
src/craftdef.h
src/database.cpp
src/database-dummy.cpp
src/database-dummy.h
src/database.h
src/database-leveldb.cpp
src/database-leveldb.h
src/database-postgresql.cpp
src/database-postgresql.h
src/database-redis.cpp
src/database-redis.h
src/database-sqlite3.cpp
src/database-sqlite3.h
src/daynightratio.h
src/debug.cpp
src/debug.h
src/defaultsettings.cpp
src/defaultsettings.h
src/drawscene.cpp
src/drawscene.h
src/dungeongen.cpp
src/dungeongen.h
src/emerge.cpp
src/emerge.h
src/environment.cpp
src/environment.h
src/event.h
src/event_manager.h
src/exceptions.h
src/filecache.cpp
src/filecache.h
src/filesys.cpp
src/filesys.h
src/fontengine.cpp
src/fontengine.h
src/game.cpp
src/gamedef.h
src/game.h
src/genericobject.cpp
src/genericobject.h
src/gettext.cpp
src/gettext.h
src/gettime.h
src/guiChatConsole.cpp
src/guiChatConsole.h
src/guiEngine.cpp
src/guiEngine.h
src/guiFileSelectMenu.cpp
src/guiFileSelectMenu.h
src/guiFormSpecMenu.cpp
src/guiFormSpecMenu.h
src/guiKeyChangeMenu.cpp
src/guiKeyChangeMenu.h
src/guiMainMenu.h
src/guiPasswordChange.cpp
src/guiPasswordChange.h
src/guiscalingfilter.cpp
src/guiscalingfilter.h
src/guiTable.cpp
src/guiTable.h
src/guiVolumeChange.cpp
src/guiVolumeChange.h
src/httpfetch.cpp
src/httpfetch.h
src/hud.cpp
src/hud.h
src/imagefilters.cpp
src/imagefilters.h
src/intlGUIEditBox.cpp
src/intlGUIEditBox.h
src/inventory.cpp
src/inventory.h
src/inventorymanager.cpp
src/inventorymanager.h
src/irr_aabb3d.h
src/irrlicht_changes/static_text.cpp
src/irrlicht_changes/static_text.h
src/irrlichttypes_bloated.h
src/irrlichttypes_extrabloated.h
src/irrlichttypes.h
src/irr_v2d.h
src/irr_v3d.h
src/itemdef.cpp
src/itemdef.h
src/itemgroup.h
src/itemstackmetadata.cpp
src/keycode.cpp
src/keycode.h
src/light.cpp
src/light.h
src/localplayer.cpp
src/localplayer.h
src/log.cpp
src/log.h
src/main.cpp
src/mainmenumanager.h
src/mapblock.cpp
src/mapblock.h
src/mapblock_mesh.cpp
src/mapblock_mesh.h
src/map.cpp
src/mapgen.cpp
src/mapgen_flat.cpp
src/mapgen_flat.h
src/mapgen_fractal.cpp
src/mapgen_fractal.h
src/mapgen.h
src/mapgen_singlenode.cpp
src/mapgen_singlenode.h
src/mapgen_v5.cpp
src/mapgen_v5.h
src/mapgen_v6.cpp
src/mapgen_v6.h
src/mapgen_v7.cpp
src/mapgen_v7.h
src/mapgen_valleys.cpp
src/mapgen_valleys.h
src/map.h
src/mapnode.cpp
src/mapnode.h
src/mapsector.cpp
src/mapsector.h
src/map_settings_manager.cpp
src/map_settings_manager.h
src/mesh.cpp
src/mesh.h
src/metadata.cpp
src/metadata.h
src/mg_biome.cpp
src/mg_biome.h
src/mg_decoration.cpp
src/mg_decoration.h
src/mg_ore.cpp
src/mg_ore.h
src/mg_schematic.cpp
src/mg_schematic.h
src/minimap.cpp
src/minimap.h
src/modalMenu.h
src/modifiedstate.h
src/mods.cpp
src/mods.h
src/nameidmapping.cpp
src/nameidmapping.h
src/network/clientopcodes.cpp
src/network/clientopcodes.h
src/network/clientpackethandler.cpp
src/network/connection.cpp
src/network/connection.h
src/network/networkpacket.cpp
src/network/networkpacket.h
src/network/networkprotocol.h
src/network/serveropcodes.cpp
src/network/serveropcodes.h
src/network/serverpackethandler.cpp
src/nodedef.cpp
src/nodedef.h
src/nodemetadata.cpp
src/nodemetadata.h
src/nodetimer.cpp
src/nodetimer.h
src/noise.cpp
src/noise.h
src/objdef.cpp
src/objdef.h
src/object_properties.cpp
src/object_properties.h
src/particles.cpp
src/particles.h
src/pathfinder.cpp
src/pathfinder.h
src/player.cpp
src/player.h
src/porting_android.cpp
src/porting_android.h
src/porting.cpp
src/porting.h
src/profiler.h
src/quicktune.cpp
src/quicktune.h
src/quicktune_shortcutter.h
src/raycast.cpp
src/raycast.h
src/reflowscan.cpp
src/reflowscan.h
src/remoteplayer.cpp
src/remoteplayer.h
src/rollback.cpp
src/rollback.h
src/rollback_interface.cpp
src/rollback_interface.h
src/script/clientscripting.cpp
src/script/clientscripting.h
src/script/common/c_content.cpp
src/script/common/c_content.h
src/script/common/c_converter.cpp
src/script/common/c_converter.h
src/script/common/c_internal.cpp
src/script/common/c_internal.h
src/script/common/c_types.cpp
src/script/common/c_types.h
src/script/cpp_api/s_async.cpp
src/script/cpp_api/s_async.h
src/script/cpp_api/s_base.cpp
src/script/cpp_api/s_base.h
src/script/cpp_api/s_client.cpp
src/script/cpp_api/s_client.h
src/script/cpp_api/s_entity.cpp
src/script/cpp_api/s_entity.h
src/script/cpp_api/s_env.cpp
src/script/cpp_api/s_env.h
src/script/cpp_api/s_internal.h
src/script/cpp_api/s_inventory.cpp
src/script/cpp_api/s_inventory.h
src/script/cpp_api/s_item.cpp
src/script/cpp_api/s_item.h
src/script/cpp_api/s_mainmenu.cpp
src/script/cpp_api/s_mainmenu.h
src/script/cpp_api/s_node.cpp
src/script/cpp_api/s_node.h
src/script/cpp_api/s_nodemeta.cpp
src/script/cpp_api/s_nodemeta.h
src/script/cpp_api/s_player.cpp
src/script/cpp_api/s_player.h
src/script/cpp_api/s_security.cpp
src/script/cpp_api/s_security.h
src/script/cpp_api/s_server.cpp
src/script/cpp_api/s_server.h
src/script/lua_api/l_areastore.cpp
src/script/lua_api/l_areastore.h
src/script/lua_api/l_base.cpp
src/script/lua_api/l_base.h
src/script/lua_api/l_client.cpp
src/script/lua_api/l_client.h
src/script/lua_api/l_craft.cpp
src/script/lua_api/l_craft.h
src/script/lua_api/l_env.cpp
src/script/lua_api/l_env.h
src/script/lua_api/l_http.cpp
src/script/lua_api/l_http.h
src/script/lua_api/l_internal.h
src/script/lua_api/l_inventory.cpp
src/script/lua_api/l_inventory.h
src/script/lua_api/l_item.cpp
src/script/lua_api/l_item.h
src/script/lua_api/l_itemstackmeta.cpp
src/script/lua_api/l_itemstackmeta.h
src/script/lua_api/l_mainmenu.cpp
src/script/lua_api/l_mainmenu.h
src/script/lua_api/l_mapgen.cpp
src/script/lua_api/l_mapgen.h
src/script/lua_api/l_metadata.cpp
src/script/lua_api/l_metadata.h
src/script/lua_api/l_minimap.cpp
src/script/lua_api/l_minimap.h
src/script/lua_api/l_nodemeta.cpp
src/script/lua_api/l_nodemeta.h
src/script/lua_api/l_nodetimer.cpp
src/script/lua_api/l_nodetimer.h
src/script/lua_api/l_noise.cpp
src/script/lua_api/l_noise.h
src/script/lua_api/l_object.cpp
src/script/lua_api/l_object.h
src/script/lua_api/l_particles.cpp
src/script/lua_api/l_particles.h
src/script/lua_api/l_rollback.cpp
src/script/lua_api/l_rollback.h
src/script/lua_api/l_server.cpp
src/script/lua_api/l_server.h
src/script/lua_api/l_settings.cpp
src/script/lua_api/l_settings.h
src/script/lua_api/l_sound.cpp
src/script/lua_api/l_sound.h
src/script/lua_api/l_storage.cpp
src/script/lua_api/l_storage.h
src/script/lua_api/l_util.cpp
src/script/lua_api/l_util.h
src/script/lua_api/l_vmanip.cpp
src/script/lua_api/l_vmanip.h
src/script/scripting_mainmenu.cpp
src/script/scripting_mainmenu.h
src/script/serverscripting.cpp
src/script/serverscripting.h
src/serialization.cpp
src/serialization.h
src/server.cpp
src/serverenvironment.cpp
src/serverenvironment.h
src/server.h
src/serverlist.cpp
src/serverlist.h
src/serverobject.cpp
src/serverobject.h
src/settings.cpp
src/settings.h
src/settings_translation_file.cpp
src/shader.cpp
src/shader.h
src/sky.cpp
src/sky.h
src/socket.cpp
src/socket.h
src/sound.cpp
src/sound.h
src/sound_openal.cpp
src/sound_openal.h
src/staticobject.cpp
src/staticobject.h
src/subgame.cpp
src/subgame.h
src/terminal_chat_console.cpp
src/terminal_chat_console.h
src/threading/atomic.h
src/threading/event.cpp
src/threading/event.h
src/threading/mutex_auto_lock.h
src/threading/mutex.cpp
src/threading/mutex.h
src/threading/semaphore.cpp
src/threading/semaphore.h
src/threading/thread.cpp
src/threading/thread.h
src/threads.h
src/tileanimation.cpp
src/tileanimation.h
src/tool.cpp
src/tool.h
src/touchscreengui.cpp
src/touchscreengui.h
src/treegen.cpp
src/treegen.h
src/unittest/test_areastore.cpp
src/unittest/test_collision.cpp
src/unittest/test_compression.cpp
src/unittest/test_connection.cpp
src/unittest/test.cpp
src/unittest/test_filepath.cpp
src/unittest/test.h
src/unittest/test_inventory.cpp
src/unittest/test_keycode.cpp
src/unittest/test_mapnode.cpp
src/unittest/test_map_settings_manager.cpp
src/unittest/test_nodedef.cpp
src/unittest/test_noderesolver.cpp
src/unittest/test_noise.cpp
src/unittest/test_objdef.cpp
src/unittest/test_player.cpp
src/unittest/test_profiler.cpp
src/unittest/test_random.cpp
src/unittest/test_schematic.cpp
src/unittest/test_serialization.cpp
src/unittest/test_settings.cpp
src/unittest/test_socket.cpp
src/unittest/test_threading.cpp
src/unittest/test_utilities.cpp
src/unittest/test_voxelalgorithms.cpp
src/unittest/test_voxelmanipulator.cpp
src/util/areastore.cpp
src/util/areastore.h
src/util/auth.cpp
src/util/auth.h
src/util/base64.cpp
src/util/base64.h
src/util/basic_macros.h
src/util/container.h
src/util/cpp11_container.h
src/util/directiontables.cpp
src/util/directiontables.h
src/util/enriched_string.cpp
src/util/enriched_string.h
src/util/hex.h
src/util/md32_common.h
src/util/numeric.cpp
src/util/numeric.h
src/util/pointedthing.cpp
src/util/pointedthing.h
src/util/pointer.h
src/util/serialize.cpp
src/util/serialize.h
src/util/sha1.cpp
src/util/sha1.h
src/util/sha2.h
src/util/srp.cpp
src/util/srp.h
src/util/strfnd.h
src/util/string.cpp
src/util/string.h
src/util/thread.h
src/util/timetaker.cpp
src/util/timetaker.h
src/version.cpp
src/version.h
src/voxelalgorithms.cpp
src/voxelalgorithms.h
src/voxel.cpp
src/voxel.h
src/wieldmesh.cpp
src/wieldmesh.h

View File

@ -6,6 +6,8 @@ needs_compile || exit 0
function perform_lint() {
echo "Performing LINT..."
CLANG_FORMAT=clang-format-3.9
CLANG_FORMAT_WHITELIST="util/travis/clang-format-whitelist.txt"
if [ "$TRAVIS_EVENT_TYPE" = "pull_request" ]; then
# Get list of every file modified in this pull request
files_to_lint="$(git diff --name-only --diff-filter=ACMRTUXB $TRAVIS_COMMIT_RANGE | grep '^src/[^.]*[.]\(cpp\|h\)$' | egrep -v '^src/(gmp|lua|jsoncpp)/' || true)"
@ -28,8 +30,13 @@ function perform_lint() {
else
printf ":\n%s\n" "$d"
fi
# Disable build failure at this moment as we need to have a complete MT source whitelist to check
fail=0
whitelisted=$(egrep -c "^${f}" "${CLANG_FORMAT_WHITELIST}")
# If file is not whitelisted, mark a failure
if [ ${whitelisted} -eq 0 ]; then
fail=1
fi
fi
done
@ -37,6 +44,8 @@ function perform_lint() {
echo "LINT reports failure."
exit 1
fi
echo "LINT OK"
}
if [[ "$LINT" == "1" ]]; then