Repository: hyprwm/Hyprland
File: src/config/ConfigManager.cpp (C++)

Code before:
    bool       ignoreMods     = false;
    bool       multiKey       = false;
    bool       longPress      = false;
    bool       hasDescription = false;
    bool       dontInhibit    = false;
    const auto BINDARGS       = command.substr(4);

    for (auto const& arg : BINDARGS) {
        if (arg == 'l') {
            locked = true;
        } else if (arg == 'r') {
            release = true;
        } else if (arg == 'e') {
            repeat = true;
        } else if (arg == 'm') {
            mouse = true;
        } else if (arg == 'n') {
            nonConsuming = true;
        } else if (arg == 't') {
            transparent = true;
        } else if (arg == 'i') {
            ignoreMods = true;
        } else if (arg == 's') {
            multiKey = true;
		} else if (arg == 'o') {
			longPress = true;
        } else if (arg == 'd') {
            hasDescription = true;
        } else if (arg == 'p') {
            dontInhibit = true;
        } else {
            return "bind: invalid flag";
        }
    }

    if (release && repeat)
        return "flags r and e are mutually exclusive";

    if (mouse && (repeat || release || locked))
        return "flag m is exclusive";

    const int  numbArgs = hasDescription ? 5 : 4;
    const auto ARGS     = CVarList(value, numbArgs);

    const int  DESCR_OFFSET = hasDescription ? 1 : 0;
    if ((ARGS.size() < 3 && !mouse) || (ARGS.size() < 3 && mouse))
        return "bind: too few args";
    else if ((ARGS.size() > (size_t)4 + DESCR_OFFSET && !mouse) || (ARGS.size() > (size_t)3 + DESCR_OFFSET && mouse))
        return "bind: too many args";

    std::set<xkb_keysym_t> KEYSYMS;

Review comment (suggestion):
requires a check for incompatibilities. for example, long press + release makes no sense.

further down you'll see some checks that return an error

Code after:
    bool       locked         = false;
    bool       release        = false;
    bool       repeat         = false;
    bool       mouse          = false;
    bool       nonConsuming   = false;
    bool       transparent    = false;
    bool       ignoreMods     = false;
    bool       multiKey       = false;
    bool       longPress      = false;
    bool       hasDescription = false;
    bool       dontInhibit    = false;
    const auto BINDARGS       = command.substr(4);

    for (auto const& arg : BINDARGS) {
        if (arg == 'l') {
            locked = true;
        } else if (arg == 'r') {
            release = true;
        } else if (arg == 'e') {
            repeat = true;
        } else if (arg == 'm') {
            mouse = true;
        } else if (arg == 'n') {
            nonConsuming = true;
        } else if (arg == 't') {
            transparent = true;
        } else if (arg == 'i') {
            ignoreMods = true;
        } else if (arg == 's') {
            multiKey = true;
        } else if (arg == 'o') {
            longPress = true;
        } else if (arg == 'd') {
            hasDescription = true;
        } else if (arg == 'p') {
            dontInhibit = true;
        } else {
            return "bind: invalid flag";
        }
    }

    if ((longPress || release) && repeat)
        return "flags e is mutually exclusive with r and o";

    if (mouse && (repeat || release || locked))
        return "flag m is exclusive";

    const int  numbArgs = hasDescription ? 5 : 4;
    const auto ARGS     = CVarList(value, numbArgs);

    const int  DESCR_OFFSET = hasDescription ? 1 : 0;