-
Notifications
You must be signed in to change notification settings - Fork 644
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
Macro-decorated properties are documented with the wrong name. #373
Comments
Re your BTW: Do you know if the latest version of GRMustache works with garbage collection? If not I think the project will need to be ARC-ified first. |
GRMustache is explicitly tested under GC, ARC-compatible, and does not require to be ARC-ified to integrate into any project. I've looked at appledoc sources. Here are the old APIs that you would need to migrate:
|
Is this still an issue with latest code? I merged pull request addressing some of output formatting problems. |
Yes, the issue is still here, using appledoc 2.1 (build 858), installed from the latest master branch (ba1083e) and |
The newly introduced support for enums are affected, too. The following code: /**
* The codes of a GRMustache-generated NSError
*
* @since v1.0
*/
typedef NS_ENUM(NSInteger, GRMustacheErrorCode) {
/**
* The error code for parse errors.
*
* @since v1.0
*/
GRMustacheErrorCodeParseError AVAILABLE_GRMUSTACHE_VERSION_6_0_AND_LATER,
/**
* The error code for not found templates and partials.
*
* @since v1.0
*/
GRMustacheErrorCodeTemplateNotFound AVAILABLE_GRMUSTACHE_VERSION_6_0_AND_LATER,
/**
* The error code for not rendering errors.
*
* @since v6.3
*/
GRMustacheErrorCodeRenderingError AVAILABLE_GRMUSTACHE_VERSION_6_3_AND_LATER,
} AVAILABLE_GRMUSTACHE_VERSION_6_0_AND_LATER; Is documented as (6 values in the enum instead of 3, and mangled doc strings): Definition typedef NS_ENUM(NSInteger, GRMustacheErrorCode ) {
GRMustacheErrorCodeParseError,
AVAILABLE_GRMUSTACHE_VERSION_6_0_AND_LATER,
GRMustacheErrorCodeTemplateNotFound,
AVAILABLE_GRMUSTACHE_VERSION_6_0_AND_LATER,
GRMustacheErrorCodeRenderingError,
AVAILABLE_GRMUSTACHE_VERSION_6_3_AND_LATER,
}; Constants
Availability v1.0 |
Note that enums with values are better handled: /**
* The types of Mustache tags
*
* @since v6.0
*/
typedef NS_ENUM(NSUInteger, GRMustacheTagType) {
/**
* The type for variable tags such as {{ name }}
*
* @since v6.0
*/
GRMustacheTagTypeVariable = 1 << 1 AVAILABLE_GRMUSTACHE_VERSION_6_0_AND_LATER,
/**
* The type for section tags such as {{# name }}...{{/}}
*
* @since v6.0
*/
GRMustacheTagTypeSection = 1 << 2 AVAILABLE_GRMUSTACHE_VERSION_6_0_AND_LATER,
/**
* The type for overridable section tags such as {{$ name }}...{{/}}
*
* @since v6.0
*/
GRMustacheTagTypeOverridableSection = 1 << 3 AVAILABLE_GRMUSTACHE_VERSION_6_0_AND_LATER,
/**
* The type for inverted section tags such as {{^ name }}...{{/}}
*
* @since v6.0
*/
GRMustacheTagTypeInvertedSection = 1 << 4 AVAILABLE_GRMUSTACHE_VERSION_6_0_AND_LATER,
} AVAILABLE_GRMUSTACHE_VERSION_6_0_AND_LATER; Is documented with 4 values, not 8, unlike the GRMustacheErrorCode enum above. Macros are still visible in the documentation, though. |
Yea, parsing is not exact in appledoc, I was looking into using clang, but it felt too exact for such needs. Will take a look once I finish my current work. |
I'll pick this one up, if you don't mind, since i'm the one responsible... (The issues with the macro mismatch) |
Sure, go ahead |
Any suggestions on how to detect macros without having to parse all include/import statements? Can i safely assume all uppercase is a macro? What about parametrised macros? If this is the case, a simple check would do to 'eat away' the capiltalized tokens |
I'd assume that all macros are stuff that can be ignored after the longest documentation item has been identified: After - (void)blah:(int)a foo:(int)b MACRO; After the last @property (nonatomic,copy) int(^name)(int arg) __attribute__((deprecated)); After enum foo {
name1 MACRO,
name2 = value MACRO,
} MACRO; What do you think? This technique would avoid dangerous assumptions like uppercase macros. |
and
(I know this is not valid, but it's just an example). Furthermore, the MACRO can appear literally anywhere. Somebody might use a macro to define a block notation instead of a typedef like so
In which case the parser will be totally lost. I think we can safely skip documenting such horrid definitions. Another thing is feasability. We could either come up with a bulletproof parser taking us 50 days to write and test, or simply filter out the CAPS elements. |
Not an easy job, you're right. |
Should the MACRO directives persist in the documentation? I am now able to parse the NS_ENUM declarations by filtering the all uppercase words. Sample:
This will result in the documented:
I added a method to the parser called 'consumeMacro' perhaps i can reuse it for the method declarations (changes pushed to my fork) |
I think it's a valid assumption for most cases. |
That last push #381 fixed the behavior for NS_ENUM that was just introduced, but I didn't dare touching the other parsing code. |
Cool, is this fixed then, can I close the issue? |
No, the push only fixed macros for NS_ENUM, not for properties as in the original poster request |
Hi,
This issue is as side effect of CocoaPods/CocoaPods#1204.
The following method, declared at https://github.com/groue/GRMustache/blob/v6.7.4/src/classes/GRMustacheConfiguration.h#L157:
Is outputted by appledoc as (see for instance http://cocoadocs.org/docsets/GRMustache/6.7.4/Classes/GRMustacheConfiguration.html#//api/name/AVAILABLE_GRMUSTACHE_VERSION_6_4_AND_LATER):
The property has, unfortunately, lost its name (and the macro should not appear in the doc).
http://github.com/groue/GRMustache actually uses those macros to decorate:
I use them to be able to keep alive the tests for deprecated but not-yet removed methods, without getting any warning - they are quite useful, actually.
Thanks for the good work 😄 (BTW the latest GRMustache is really faster than the one you are using, you may consider upgrading)
The text was updated successfully, but these errors were encountered: