Code Style
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 384
- Forks
- 101
- PR merge metrics
- No merged PRs in 30d
Description
Per README:
Follow the existing coding style
There are many different styles throughout the headers, even ignoring vendor headers (e.g. openssl).
I believe there should be a more unified, and explicit style.
Examples of different existing styles
-
Availability attribution:
- SpringBoard/SBApplication.h uses
NS_AVAILABLE_IOS, andNS_DEPRECATED_IOS - BatteryCenter/BCBatteryDevice.h uses
API_AVAILABLE(I don't see instances of the equivalentAPI_DEPRECATEDin this repo)
- SpringBoard/SBApplication.h uses
-
External declarations:
- Preferences/PSSpecifier.h uses
__BEGIN_DECLS - GraphicsServices/GSCapability.h uses the
#if __cplusplus \\ extern "C" { \\ #endifidiom (mostly equivalent to__BEGIN_DECLS) - Flipswitch/FSSwitchState.h uses
extern, without any C++ linkage indicator. - I didn't see any instances of it, but Apple's SDKs also use
OBJC_EXTERNandFOUNDATION_EXTERN
- Preferences/PSSpecifier.h uses
-
Property attributes (
ObjCSpaceAfterProperty):- BaseBoard/BSProcessHandle.h uses
@property (attributes) type; - SpringBoard/SBAppSwitcherPeopleDataSource.h uses
@property(attributes) type
- BaseBoard/BSProcessHandle.h uses
Style discussions are sometimes criticized, because developers have different opinions on how code should be formatted, however I mention these three because I've seen issues arise in due to these in particular.
Availability attributions are important, especially for projects such as this one, where private system APIs are sometimes documented. Deciding on an attribution system allows developers to contribute more easily and effectively.
External declarations must be accurate when using C++, to avoid linking errors. Theos used to create ObjC++ source files by default. A unified extern marking system would avoid issues such as FSSwitchState.h missing a C++ linker hint.
Property attributes are very strongly a style choice, but I mention it due to #21 changing these property declarations. It could be bothersome, if someone felt compelled to change them back, or if new changes are made with no property trailing space, and someone else goes to change those.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Review the README and the cited headers, including SpringBoard/SBApplication.h, BatteryCenter/BCBatteryDevice.h, Preferences/PSSpecifier.h, GraphicsServices/GSCapability.h, Flipswitch/FSSwitchState.h, and BaseBoard/BSProcessHandle.h. Define an explicit, unified convention for availability attributions, external declarations, and property spacing; done means the project has an agreed style that resolves these examples.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, objective-c
- Domain
- developer-experience
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100