Skip to content

Add separate linters for Objective-C/Objective C++. #11

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

Merged
merged 1 commit into from
May 5, 2020

Conversation

davidaurelio
Copy link

This adds two extra linters that apply to Objective-C/C++ code.

I have added -fobjc-arc as compiler arg to make the __has_feature(objc_arc) preprocessor test pass. Automatic reference counting (arc) should be the default in most Objective-C projects these days.

It would have been cool to add support for module imports (@import CoreGraphics), but unfortunately this requires more extensive command line flags that might be machine specific. So I left it out.

@kaste
Copy link
Member

kaste commented May 4, 2020

Very nice.

I think we can omit "multiline = True" because we already compile the regex with that flag, and SublimeLinter should read the used flags.

I would not have extracted the default args to a pseudo constant. Do you think that's easier to read or modify? I usually read these linter classes as declarations. SublimeLinter doesn't allow inheritance here as well which is probably not a bad limitation. Feel free to leave it as is.

@davidaurelio
Copy link
Author

I think we can omit "multiline = True" because we already compile the regex with that flag, and SublimeLinter should read the used flags.

Sounds good, let me remove it.

I would not have extracted the default args to a pseudo constant. Do you think that's easier to read or modify?

I guess that’s more the reflex of de-duplicating. Let me inline it, I don’t feel strongly about it at all.

@davidaurelio
Copy link
Author

davidaurelio commented May 4, 2020

I will actually give the multiline change a quick try on my work code base tomorrow to make sure it works.

This adds two extra linters that apply to Objective-C/C++ code.

I have added `-fobjc-arc` as compiler arg to make the `__has_feature(objc_arc)` preprocessor test pass. Automatic reference counting (arc) should be the default in most Objective-C projects these days.

It would have been cool to add support for module imports (`@import CoreGraphics`), but unfortunately this requires more extensive command line flags that might be machine specific. So I left it out.
@davidaurelio
Copy link
Author

@kaste removing multiline = True stops errors from #include being flagged. You know better about the internals.

@kaste
Copy link
Member

kaste commented May 5, 2020

Oh, my bad. I misremembered it. We only set "multiline" automatically if "regex" is a string with inline flags. You know, these flags: (?m)foo.*. 🤷‍♀️

@kaste
Copy link
Member

kaste commented May 5, 2020

Can I pull and release, or do you want another minute?

@davidaurelio
Copy link
Author

Pull and release, please :-) I will have another look into how errors of included files are reported soon.

@kaste kaste merged commit 70b27ba into SublimeLinter:master May 5, 2020
@kaste
Copy link
Member

kaste commented May 5, 2020

Released as https://github.com/SublimeLinter/SublimeLinter-clang/releases/tag/2.2.0

@davidaurelio davidaurelio deleted the objc-support branch May 5, 2020 21:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants