Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

delete clang-format files and comments #14079

Merged
merged 2 commits into from
Dec 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
33 changes: 0 additions & 33 deletions .clang-format

This file was deleted.

14 changes: 0 additions & 14 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,20 +67,6 @@ Contributions are welcome! Here's how you can help:
might need more work in the future.
5. It uses protocols and formats which include the required compatibility.

### Important note about automated GitHub checks

When you submit a pull request, GitHub automatically runs checks on the Minetest
Engine combined with your changes. One of these checks is called 'cpp lint /
clang format', which checks code formatting. Because formatting for readability
requires human judgement this check often fails and often makes unsuitable
formatting requests which make code readability worse.

If this check fails, look at the details to check for any clear mistakes and
correct those. However, you should not apply everything ClangFormat requests.
Ignore requests that make code readability worse and any other clearly
unsuitable requests. Discuss in the pull request with a core developer about how
to progress.

## Issues

If you experience an issue, we would like to know the details - especially when
Expand Down
17 changes: 0 additions & 17 deletions .github/workflows/cpp_lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,6 @@ on:
- '.github/workflows/**.yml'

jobs:

# clang_format:
# runs-on: ubuntu-20.04
# steps:
# - uses: actions/checkout@v3
# - name: Install clang-format
# run: |
# sudo apt-get update
# sudo apt-get install -y clang-format-9
#
# - name: Run clang-format
# run: |
# source ./util/ci/clang-format.sh
# check_format
# env:
# CLANG_FORMAT: clang-format-9

clang_tidy:
runs-on: ubuntu-20.04
steps:
Expand Down
2 changes: 0 additions & 2 deletions src/client/activeobjectmgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ void ActiveObjectMgr::step(
}
}

// clang-format off
bool ActiveObjectMgr::registerObject(std::unique_ptr<ClientActiveObject> obj)
{
assert(obj); // Pre-condition
Expand Down Expand Up @@ -93,7 +92,6 @@ void ActiveObjectMgr::removeObject(u16 id)
obj->removeFromScene(true);
}

// clang-format on
void ActiveObjectMgr::getActiveObjects(const v3f &origin, f32 max_d,
std::vector<DistanceSortedActiveObject> &dest)
{
Expand Down
4 changes: 0 additions & 4 deletions src/client/meshgen/collector.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,15 @@ struct MeshCollector
// offset: offset added to vertices
MeshCollector(const v3f center_pos, v3f offset = v3f()) : m_center_pos(center_pos), offset(offset) {}

// clang-format off
void append(const TileSpec &material,
const video::S3DVertex *vertices, u32 numVertices,
const u16 *indices, u32 numIndices);
void append(const TileSpec &material,
const video::S3DVertex *vertices, u32 numVertices,
const u16 *indices, u32 numIndices,
v3f pos, video::SColor c, u8 light_source);
// clang-format on

private:
// clang-format off
void append(const TileLayer &material,
const video::S3DVertex *vertices, u32 numVertices,
const u16 *indices, u32 numIndices,
Expand All @@ -68,7 +65,6 @@ struct MeshCollector
const u16 *indices, u32 numIndices,
v3f pos, video::SColor c, u8 light_source,
u8 layernum, bool use_scale = false);
// clang-format on

PreMeshBuffer &findBuffer(const TileLayer &layer, u8 layernum, u32 numVertices);
};
4 changes: 0 additions & 4 deletions src/content/mods.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,8 @@ bool parseModContents(ModSpec &spec)
if (info.exists("depends")) {
mod_conf_has_depends = true;
std::string dep = info.get("depends");
// clang-format off
dep.erase(std::remove_if(dep.begin(), dep.end(),
static_cast<int (*)(int)>(&std::isspace)), dep.end());
// clang-format on
for (const auto &dependency : str_split(dep, ',')) {
spec.depends.insert(dependency);
}
Expand All @@ -120,10 +118,8 @@ bool parseModContents(ModSpec &spec)
if (info.exists("optional_depends")) {
mod_conf_has_depends = true;
std::string dep = info.get("optional_depends");
// clang-format off
dep.erase(std::remove_if(dep.begin(), dep.end(),
static_cast<int (*)(int)>(&std::isspace)), dep.end());
// clang-format on
for (const auto &dependency : str_split(dep, ',')) {
spec.optdepends.insert(dependency);
}
Expand Down
4 changes: 0 additions & 4 deletions src/gui/guiEditBox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,6 @@ bool GUIEditBox::processKey(const SEvent &event)

bool GUIEditBox::onKeyUp(const SEvent &event, s32 &mark_begin, s32 &mark_end)
{
// clang-format off
if (m_multiline || (m_word_wrap && m_broken_text.size() > 1)) {
s32 lineNo = getLineFromPos(m_cursor_pos);
s32 mb = (m_mark_begin == m_mark_end) ? m_cursor_pos :
Expand All @@ -481,13 +480,11 @@ bool GUIEditBox::onKeyUp(const SEvent &event, s32 &mark_begin, s32 &mark_end)
return true;
}

// clang-format on
return false;
}

bool GUIEditBox::onKeyDown(const SEvent &event, s32 &mark_begin, s32 &mark_end)
{
// clang-format off
if (m_multiline || (m_word_wrap && m_broken_text.size() > 1)) {
s32 lineNo = getLineFromPos(m_cursor_pos);
s32 mb = (m_mark_begin == m_mark_end) ? m_cursor_pos :
Expand All @@ -513,7 +510,6 @@ bool GUIEditBox::onKeyDown(const SEvent &event, s32 &mark_begin, s32 &mark_end)
return true;
}

// clang-format on
return false;
}

Expand Down
2 changes: 0 additions & 2 deletions src/gui/guiPasswordChange.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,14 +199,12 @@ bool GUIPasswordChange::processInput()
bool GUIPasswordChange::OnEvent(const SEvent &event)
{
if (event.EventType == EET_KEY_INPUT_EVENT) {
// clang-format off
if ((event.KeyInput.Key == KEY_ESCAPE ||
event.KeyInput.Key == KEY_CANCEL) &&
event.KeyInput.PressedDown) {
quitMenu();
return true;
}
// clang-format on
if (event.KeyInput.Key == KEY_RETURN && event.KeyInput.PressedDown) {
acceptInput();
if (processInput())
Expand Down
2 changes: 0 additions & 2 deletions src/gui/guiScrollBar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@ bool GUIScrollBar::OnEvent(const SEvent &event)
if (event.MouseInput.Event == EMIE_LMOUSE_LEFT_UP)
is_dragging = false;

// clang-format off
if (!dragged_by_slider) {
if (is_inside) {
dragged_by_slider = slider_rect.isPointInside(p);
Expand All @@ -167,7 +166,6 @@ bool GUIScrollBar::OnEvent(const SEvent &event)
return is_inside;
}
}
// clang-format on

const s32 new_pos = getPosFromMousePos(p);
const s32 old_pos = scroll_pos;
Expand Down
5 changes: 0 additions & 5 deletions src/gui/modalMenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "touchscreengui.h"
#endif

// clang-format off
GUIModalMenu::GUIModalMenu(gui::IGUIEnvironment* env, gui::IGUIElement* parent,
s32 id, IMenuManager *menumgr, bool remap_dbl_click) :
IGUIElement(gui::EGUIET_ELEMENT, env, parent, id,
Expand Down Expand Up @@ -57,7 +56,6 @@ GUIModalMenu::GUIModalMenu(gui::IGUIEnvironment* env, gui::IGUIElement* parent,
m_doubleclickdetect[0].pos = v2s32(0, 0);
m_doubleclickdetect[1].pos = v2s32(0, 0);
}
// clang-format on

GUIModalMenu::~GUIModalMenu()
{
Expand Down Expand Up @@ -110,7 +108,6 @@ void GUIModalMenu::quitMenu()
#endif
}

// clang-format off
bool GUIModalMenu::DoubleClickDetection(const SEvent &event)
{
/* The following code is for capturing double-clicks of the mouse button
Expand Down Expand Up @@ -160,7 +157,6 @@ bool GUIModalMenu::DoubleClickDetection(const SEvent &event)

return false;
}
// clang-format on

static bool isChild(gui::IGUIElement *tocheck, gui::IGUIElement *parent)
{
Expand Down Expand Up @@ -236,7 +232,6 @@ void GUIModalMenu::leave()
bool GUIModalMenu::preprocessEvent(const SEvent &event)
{
#ifdef __ANDROID__
// clang-format off
// display software keyboard when clicking edit boxes
if (event.EventType == EET_MOUSE_INPUT_EVENT &&
event.MouseInput.Event == EMIE_LMOUSE_PRESSED_DOWN) {
Expand Down
5 changes: 0 additions & 5 deletions src/irr_ptr.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,6 @@ class irr_ptr
}
};

// clang-format off
// ^ dislikes long lines

/** Constructs a shared pointer as a *secondary* reference to an object
*
* This function is intended to make a temporary reference to an object which
Expand Down Expand Up @@ -205,5 +202,3 @@ irr_ptr<T> make_irr(Args&&... args)
{
return irr_ptr<T>(new T(std::forward<Args>(args)...));
}

// clang-format on
2 changes: 0 additions & 2 deletions src/script/lua_api/l_camera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,6 @@ void LuaCamera::Register(lua_State *L)
registerClass(L, className, methods, metamethods);
}

// clang-format off
const char LuaCamera::className[] = "Camera";
const luaL_Reg LuaCamera::methods[] = {
luamethod(LuaCamera, set_camera_mode),
Expand All @@ -208,4 +207,3 @@ const luaL_Reg LuaCamera::methods[] = {

{0, 0}
};
// clang-format on
2 changes: 0 additions & 2 deletions src/script/lua_api/l_modchannels.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,10 @@ ModChannel *ModChannelRef::getobject(lua_State *L, ModChannelRef *ref)
return getGameDef(L)->getModChannel(ref->m_modchannel_name);
}

// clang-format off
const char ModChannelRef::className[] = "ModChannelRef";
const luaL_Reg ModChannelRef::methods[] = {
luamethod(ModChannelRef, leave),
luamethod(ModChannelRef, is_writeable),
luamethod(ModChannelRef, send_all),
{0, 0},
};
// clang-format on
2 changes: 0 additions & 2 deletions src/script/lua_api/l_playermeta.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ void PlayerMetaRef::Register(lua_State *L)
// lua_register(L, className, create_object);
}

// clang-format off
const char PlayerMetaRef::className[] = "PlayerMetaRef";
const luaL_Reg PlayerMetaRef::methods[] = {
luamethod(MetaDataRef, contains),
Expand All @@ -76,4 +75,3 @@ const luaL_Reg PlayerMetaRef::methods[] = {
luamethod(MetaDataRef, equals),
{0,0}
};
// clang-format on
2 changes: 0 additions & 2 deletions src/server/activeobjectmgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ void ActiveObjectMgr::step(
}
}

// clang-format off
bool ActiveObjectMgr::registerObject(std::unique_ptr<ServerActiveObject> obj)
{
assert(obj); // Pre-condition
Expand Down Expand Up @@ -126,7 +125,6 @@ void ActiveObjectMgr::removeObject(u16 id)
m_active_objects.erase(id); // `it` can be invalid now
}

// clang-format on
void ActiveObjectMgr::getObjectsInsideRadius(const v3f &pos, float radius,
std::vector<ServerActiveObject *> &result,
std::function<bool(ServerActiveObject *obj)> include_obj_cb)
Expand Down
2 changes: 0 additions & 2 deletions src/server/mods.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ ServerModManager::ServerModManager(const std::string &worldpath):
configuration.checkConflictsAndDeps();
}

// clang-format off
// This function cannot be currenctly easily tested but it should be ASAP
void ServerModManager::loadMods(ServerScripting *script)
{
Expand All @@ -75,7 +74,6 @@ void ServerModManager::loadMods(ServerScripting *script)
script->on_mods_loaded();
}

// clang-format on
const ModSpec *ServerModManager::getModSpec(const std::string &modname) const
{
for (const auto &mod : configuration.getMods()) {
Expand Down
2 changes: 0 additions & 2 deletions src/server/unit_sao.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ void UnitSAO::getBonePosition(const std::string &bone, v3f *position, v3f *rotat
}
}

// clang-format off
void UnitSAO::sendOutdatedData()
{
if (!m_armor_groups_sent) {
Expand Down Expand Up @@ -123,7 +122,6 @@ void UnitSAO::sendOutdatedData()
m_messages_out.emplace(getId(), true, generateUpdateAttachmentCommand());
}
}
// clang-format on

void UnitSAO::setAttachment(int parent_id, const std::string &bone, v3f position,
v3f rotation, bool force_visible)
Expand Down
2 changes: 0 additions & 2 deletions src/texture_override.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,11 @@ enum class OverrideTarget : override_t
SPECIAL_5 = 1 << 12,
SPECIAL_6 = 1 << 13,

// clang-format off
SIDES = LEFT | RIGHT | FRONT | BACK,
ALL_FACES = TOP | BOTTOM | SIDES,
ALL_SPECIAL = SPECIAL_1 | SPECIAL_2 | SPECIAL_3 | SPECIAL_4 | SPECIAL_5 | SPECIAL_6,
NODE_TARGETS = ALL_FACES | ALL_SPECIAL,
ITEM_TARGETS = INVENTORY | WIELD,
// clang-format on
};

struct TextureOverride
Expand Down
4 changes: 0 additions & 4 deletions src/util/ieee_float.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
// float, return the float.
f32 u32Tof32Slow(u32 i)
{
// clang-format off
int exp = (i >> 23) & 0xFF;
u32 sign = i & 0x80000000UL;
u32 imant = i & 0x7FFFFFUL;
Expand All @@ -56,7 +55,6 @@ f32 u32Tof32Slow(u32 i)

return sign ? -ldexpf((f32)(imant | 0x800000UL), exp - 150) :
ldexpf((f32)(imant | 0x800000UL), exp - 150);
// clang-format on
}

// Given a float, return an unsigned 32-bit integer representing the f32
Expand Down Expand Up @@ -94,7 +92,6 @@ u32 f32Tou32Slow(f32 f)
// - The endianness of f32s and integers must match.
FloatType getFloatSerializationType()
{
// clang-format off
const f32 cf = -22220490.f;
const u32 cu = 0xCBA98765UL;
if (std::numeric_limits<f32>::is_iec559 && sizeof(cf) == 4 &&
Expand Down Expand Up @@ -132,5 +129,4 @@ FloatType getFloatSerializationType()
}

return FLOATTYPE_SLOW;
// clang-format on
}