LINT: Switch whitelist check from egrep to awk

Bonus: make CI happy with the last rules fix
This commit is contained in:
Loïc Blot 2017-04-06 16:03:29 +02:00 committed by Loic Blot
parent 88b9b9652a
commit 3a90b78a03
No known key found for this signature in database
GPG Key ID: EFAA458E8C153987
6 changed files with 12 additions and 7 deletions

@ -25,7 +25,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
class KeyType
{
public:
enum T {
enum T
{
// Player movement
FORWARD,
BACKWARD,

@ -26,6 +26,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "daynightratio.h"
#include "emerge.h"
Environment::Environment(IGameDef *gamedef):
m_time_of_day_speed(0),
m_time_of_day(9000),

@ -24,7 +24,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
struct SubgameSpec;
struct GameParams {
struct GameParams
{
u16 socket_port;
std::string world_path;
SubgameSpec game_spec;

@ -31,7 +31,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
Normal build: main.cpp
Server build: servermain.cpp
*/
enum TimePrecision {
enum TimePrecision
{
PRECISION_SECONDS = 0,
PRECISION_MILLI,
PRECISION_MICRO,

@ -212,8 +212,8 @@ int ModApiClient::l_sound_play(lua_State *L)
if (!lua_isnil(L, -1)) {
v3f pos = read_v3f(L, -1) * BS;
lua_pop(L, 1);
handle =
sound->playSoundAt(spec.name, looped, gain * spec.gain, pos);
handle = sound->playSoundAt(
spec.name, looped, gain * spec.gain, pos);
lua_pushinteger(L, handle);
return 1;
}

@ -6,6 +6,7 @@ function perform_lint() {
else
CLANG_FORMAT=clang-format
fi
echo "LINT: Using binary $CLANG_FORMAT"
CLANG_FORMAT_WHITELIST="util/travis/clang-format-whitelist.txt"
if [ "$TRAVIS_EVENT_TYPE" = "pull_request" ]; then
@ -22,10 +23,10 @@ function perform_lint() {
d=$(diff -u "$f" <(${CLANG_FORMAT} "$f") || true)
if ! [ -z "$d" ]; then
whitelisted=$(egrep -c "^${f}" "${CLANG_FORMAT_WHITELIST}")
whitelisted=$(awk '$1 == "'$f'" { print 1 }' "$CLANG_FORMAT_WHITELIST")
# If file is not whitelisted, mark a failure
if [ ${whitelisted} -eq 0 ]; then
if [ -z ${whitelisted} ]; then
errorcount=$((errorcount+1))
printf "The file %s is not compliant with the coding style" "$f"