Skip to content

Commit

Permalink
LINT: Switch whitelist check from egrep to awk
Browse files Browse the repository at this point in the history
Bonus: make CI happy with the last rules fix
  • Loading branch information
nerzhul committed Apr 6, 2017
1 parent 88b9b96 commit 3a90b78
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 7 deletions.
3 changes: 2 additions & 1 deletion src/client/keys.h
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions src/environment.cpp
Expand Up @@ -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),
Expand Down
3 changes: 2 additions & 1 deletion src/gameparams.h
Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion src/gettime.h
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions src/script/lua_api/l_client.cpp
Expand Up @@ -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;
}
Expand Down
5 changes: 3 additions & 2 deletions util/travis/lint.sh
Expand Up @@ -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
Expand All @@ -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"
Expand Down

0 comments on commit 3a90b78

Please sign in to comment.