On 24 Jun 2024, at 17:52, Ales Musil via discuss wrote:
> Hi, > > I would like to propose a universal coding style using clang-format [0]. > I've put together the config file that is matching the current coding style > as closely as possible [1]. I've tried it on some random pieces of code > that we have in the OVN codebase and there are some instances where it > doesn't much 1:1 (down below). The idea would be to add this into CI and > run this only on diff so we don't have to modify old code. Let me know what > you think and if it would be acceptable. In the end we can have a style and > let some pieces of code diverge on that. I like the idea as it makes the maintainer’s live easier, as some might slip through, and we can always ignore a specific warning if some other style is used in the whole file. If it’s a directory you can override the parent config file. > Before: > ctl_error(ctx, "Same routing policy already existed on the " > "logical router %s.", ctx->argv[1]); > > After: > > ctl_error(ctx, > "Same routing policy already existed on the logical " > "router %s.", > ctx->argv[1]); This might be something to get use too, or ignore (in GitHub), as almost all code will continue filling up the next line(s). > Before: > return (out_port != VIGP_CONTROL_PATH > ? alpheus_output_port(dp, skb, out_port) > : alpheus_output_control(dp, skb, fwd_save_skb(skb), > VIGR_ACTION)); > > After: > return ( > out_port != VIGP_CONTROL_PATH > ? alpheus_output_port(dp, skb, out_port) > : alpheus_output_control(dp, skb, fwd_save_skb(skb), VIGR_ACTION)); I assume this is a none problem, as you do not need the outer parenthesis on return. Or is this for general match with parenthesis? > Thanks, > Ales > > > [0] https://gist.github.com/almusil/d9fc05c9e9ab6cef9448e123b49c351e > [1] https://docs.ovn.org/en/stable/internals/contributing/coding-style.html > > -- > > Ales Musil > > Senior Software Engineer - OVN Core > > Red Hat EMEA <https://www.redhat.com> > > amu...@redhat.com > <https://red.ht/sig> > _______________________________________________ > discuss mailing list > disc...@openvswitch.org > https://mail.openvswitch.org/mailman/listinfo/ovs-discuss _______________________________________________ discuss mailing list disc...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-discuss