Add .mm extension to coding style check#1871
Conversation
|
Note that the coding style check for this PR won't pass because of the old iOS POC code, which is normal, but also proves that the proposed change works. |
|
Team, I found the inplace edit option of clang-format (-i). Is it possible to use it to auto-correct style? |
|
Didn't notice there's
We have considered automated fixing of the style (#1702), but due to different constraints agreed to not go for it at the moment. |
|
Ok. Thanks for the comment. No, .mm files can't have a .cpp extension as far as I know (they wouldn't be detected as objective c++ then --> no apple specific code available if we have a .cpp file). On the automated formatting, I'd agree. But that can be a follow up PR. |
also fine, just better merge it directly after this PR then. Otherwise someone forking this repo in between might get a style violation for the non-compliant |
|
It looks like in many places the expected style isn't being applied. I'm not sure why. If you look through the reformatting diff output, it's not right, I don't think. Maybe not only do the mm files need checking, the correct style needs selecting? |
|
@pljones could you show an example where it’s not right? |
|
Possibly just me wanting even more space than the standard -- It results in lines like this: If that were a C-like cast, there would be much more spacing. This bit I'd also have expected even more blank line deletion (i.e. inside the method): I'd also expect spacing inside the type casts |
|
I see, if there can be a better style for objective-c, then we should apply that.
I suspect it's the same now for C++ code, not just .mm files. |
|
just found there's a few configuration options explicitly for Objective-C
we could customize them in our style definition in case we are not happy with the defaults |
|
It seems to be possible to detect ObjC (using |
|
Example of what it's not touched that I don't like: I'd rather this were ... but of course I've no idea if that syntactically viable ObjC... |
|
@emlynmac this is another one for you ;-). Is the code @pljones mentioned valid Objective C? |
This looks more like a personal preference around white-space. Valid code compiles, which I don't see an issue with here. In terms of the code, the first version is much clearer to an Obj-C person than the second, i.e.
is preferred, or if you prefer smaller lines: |
This isn't about code validity, it's about style compliance. The whole of the Jamulus code base complies with a style guide which very, very few C++ developers would be comfortable with. But we live with it for the time being. I think I'd rather say we'll make a separate style for Objective C that clang-format can check against, rather than try to have the same style applied to both, if it's not going to be adjusted to fit. |
ann0see
left a comment
There was a problem hiding this comment.
What’s missing here? Can we merge this for the next release?
Although |
|
Concerning the comment by @pljones : I already stated that I'd prefer to stick to apple not Jamulus code style. |
|
Any updates here? |
Review of jamulussoftware#1865 by @pljones revealed .mm extension was not checked.
|
Ok. Rebased this. |
|
It works and I think it should be ok. Merging on this base. |
|
CHANGELOG: Internal: Check coding style on macOS/iOS code files (.mm extension) |
* Add .mm extension to coding style check Review of jamulussoftware#1865 by @pljones revealed .mm extension was not checked. * .clang-format for ObjC * Apply clang-format to sound.mm * Apply clang format on all .mm files Co-authored-by: ann0see <[email protected]>
Review of #1865 by @pljones revealed .mm extension was not checked.