Skip to content
Permalink
Browse files

LINT: Switch whitelist check from egrep to awk

Bonus: make CI happy with the last rules fix
  • Loading branch information
nerzhul committed Apr 6, 2017
1 parent 88b9b96 commit 3a90b78a037df3eb9098d4fddb1289ed8ee21329
Showing with 12 additions and 7 deletions.
  1. +2 −1 src/client/keys.h
  2. +1 −0 src/environment.cpp
  3. +2 −1 src/gameparams.h
  4. +2 −1 src/gettime.h
  5. +2 −2 src/script/lua_api/l_client.cpp
  6. +3 −2 util/travis/lint.sh
@@ -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"

0 comments on commit 3a90b78

Please sign in to comment.
You can’t perform that action at this time.