| 本节按用户要求使用英文(见右列)。 |
TODO (2026-11-22, session of the SonarCloud naming rename, branch rename/sonar-s100 pushed to feat/cross-platform-components, PR #788). Context: SonarCloud reports 919 Swift naming findings on PR #788 (swift:S100 743, S115 146, S116 16, S117 11, S101 3). The owner decided (see the TODO row above) to rename Swift names and keep every Objective-C selector through @objc(oldSelector). Prompt (verbatim): "do the rename on #788 now". Update (2026-11-23): buckets c and d done under decision B, see the rows below. |
|
Requirement (English). Rename the Swift names flagged by SonarCloud without changing any Objective-C selector and without changing any public Swift API. Scheme: types keep CYL; members of our own types lose the prefix (cyl_foo to foo, or cylFoo when foo would clash); members added in extensions of system types become cylFoo; constants and globals become lowerCamelCase or static members; locals and parameters lowerCamelCase. Bucket a: private / fileprivate / internal and not visible to Objective-C, renamed freely. Bucket b: internal but visible to the Objective-C runtime, renamed with an explicit @objc(oldSelector). Buckets c and d (public and open names) are NOT part of this run (the owner has not decided on forwards). Names owned by another session (CYLTabBarItemAnimation/**, LottieSwift/*, CYLAnimatedItemResources.swift, CYLAnimationEngineSwiftTests.swift, the podspec and Package.swift) are skipped. (Superseded on 2026-11-23: the owner decided option B and buckets c and d are done, see the rows below.) |
|
Baselines. (1) Runtime selector dump: CYLTabBarControllerTests/CYLSelectorDumpTests.m writes every selector of the CYL classes, of the classes with cyl… / swizzling_… methods and of the CYL protocols to CYL_SELECTOR_DUMP_PATH (xcodebuild: TEST_RUNNER_CYL_SELECTOR_DUMP_PATH; skipped without it); the file must be byte-identical before and after every rename batch. (2) The public .swiftinterface of both frameworks (BUILD_LIBRARY_FOR_DISTRIBUTION): every public declaration of the baseline must still exist. |
|
Rubric. 100 = buckets a and b renamed (40 points), selector and interface baselines identical (15), buckets c and d decided and done (30), SonarCloud re-scan shows only the accepted names (15). 60 = buckets a and b renamed with the baselines identical and the unit tests, demos, analyzer and pod lint passing. Score now: 51 / 100 (see the progress row). |
|
Progress (2026-11-22, buckets a and b done, c and d not started). Bucket a: 178 private / internal names that Objective-C does not see renamed (own types lose cyl_ / CYL; extensions of system types, globals and constants become cylFoo); bucket b: 43 internal names that the Objective-C runtime sees renamed with an explicit @objc(oldSelector) (17 had a bare @objc or dynamic). Verified on each bucket: the runtime selector dump is byte-identical to the baseline (3 496 lines), every public declaration of both baseline .swiftinterface files still exists (690 and 96), 216 unit tests with 0 failures (3 skipped: the dump test without its variable and two older skips; the tests of the base commit count 215), Example-Swift and Example-GIF (FlatDesign) build, xcodebuild analyze shows the same 4 warnings as before the rename (none new), pod lib lint --quick passes on both podspecs. Skipped (listed per finding in the session scratchpad): 671 public / open names (buckets c and d, awaiting the owner's decision on forwards), 3 type names (swift:S101), 1 test helper owned by another session (CYLAnimationEngineSwiftTests.swift), and 23 internal / private names that share their base name with a public or protocol API overload (cyl_tabBarController, cyl_showBadgeValue, cyl_getActualBadgeSuperView, cyl_index, cyl_viewController, the CYLTabBarConfigurationProviding conformers, cyl_title, cyl_pushOrPop, cyl_badgeLayerControls, URL): they need a signature-aware call-site rename. Score: 51 / 100 = 36 of 40 (a + b: 221 of 244 names) + 15 (baselines identical) + 0 (c, d) + 0 (re-scan after CI). TODO: the 23 overload names; buckets c and d; SonarCloud re-scan of PR #788. |
|
Decision B (owner, 2026-11-22): rename, keep a deprecated forward. Public names are renamed to the analyzers' lowerCamelCase patterns; every old public Swift name stays as a deprecated Swift-only forward in a separate file under a folder named Deprecated/, and those folders are excluded from SonarCloud analysis (sonar.exclusions in .sonarcloud.properties). The forwards are removed at the next major version. Rule for a renamed member: the new declaration keeps the exact Objective-C name through an explicit @objc(oldSelector) where the member is visible to Objective-C (the selector dump stays identical) and keeps its documentation comment; the old Swift name is re-declared in Deprecated/ as @available(*, deprecated, renamed: "newName(label:)") @nonobjc public func oldName(...) -> R { newName(...) } (no @objc on a forward, properties forward get / set, constants forward public let CYLX = cylX), with a short bilingual doc block. New names: members added to extensions (of system types and of our types) become cylFoo; members of our own types lose the prefix when the plain name is free (reloadTabButtons); global functions and constants become cylFoo (CYLScreenWidth() to cylScreenWidth(), CYLTabBarItemTitle to cylTabBarItemTitle, Notification.Name.CYLTabBarLoginStateDidChange to .cylTabBarLoginStateDidChange); @_cdecl("…") C names never change. Name clashes: a global constant whose new name equals a member function name is hidden inside that type, so the internal member is renamed (cylTabBarItemTitleColorValue(), cylTabBarContentView(), cylHandleFlatDesignTabBarItemDidChange(_:)), or, where the member is public API, the constant gets the suffix Value (cylPlusButtonWidthValue); twelve @nonobjc wrappers whose cylFoo twin already existed became the forward of that twin. Call sites in the library, tests, examples, README.md and the Swift samples of docs/ use the new names, so no deprecation warning remains. The folders: CYLTabBarController/Swift/Deprecated/, CYLTabBarController/CYLBadgeView/Swift/Deprecated/, CYLTabBarController/CYLUtils/Swift/Deprecated/, CYLTabBarController/CYLFlatDesignTabBar/CYLFlatDesignTabBar-ObjectiveC/Swift/Deprecated/ (43 files, one per extended type or source file, named <Type>+<Area>DeprecatedNames.swift; the area keeps the file names unique, because Swift rejects two files with the same name in a module). Build systems: the CocoaPods Core subspec lists Swift/Deprecated/*.swift explicitly (Swift/*.swift is not recursive), the other subspecs use ** globs, SwiftPM reads whole folders, the Xcode project has the 43 files in four Deprecated groups and in the framework target. |
|
Progress (2026-11-23, buckets c and d done). Bucket c: 498 names (505 declarations: 374 functions, 124 constants, 7 properties) renamed, among them the 23 internal names that shared a base name with a public overload (renamed signature-aware, by the full name with its argument labels, not by the base name); 490 deprecated forwards in 43 files (12 of them are the former @nonobjc wrappers moved to Deprecated/); two parameter-only findings (URLs, URL, swift:S117) renamed without any API change; the label in_AnimationRepeatTimes of cyl_badge_once_fade became inAnimationRepeatTimes (forwards keep the old label). One Objective-C-visible member needed a new explicit @objc(oldSelector); the rest already had one. Verified: the runtime selector dump is byte-identical to the baseline (3 496 lines); every one of the 684 public declarations of the baseline CYLTabBarController interface and the 96 of CYLAnimatedItem still exists (the old names as deprecated forwards), and the new names exist; the @_cdecl strings are unchanged (84 diff lines, all pairs); 216 unit tests, 0 failures (3 skipped as before); Example-Swift and Example-GIF (FlatDesign) build with 0 deprecation warnings from renamed names and compile the Deprecated files from the pods; xcodebuild analyze shows the same 4 warnings as before; pod lib lint --quick passes. |
|
Bucket d, left unchanged (accepted in SonarCloud by the owner; 98 names, 188 declarations, plus 3 type names and 1 test helper). Reason open (63 names): an open member may be overridden by client subclasses, renaming breaks the override and a forward cannot redirect an override: cyl_appliesCenterYOffsetWithoutTitle, cyl_applyTabBarTheme(_:), cyl_userInterfaceStyle(for:) (an optional CYLTabBarTheme requirement, released in 1.100.0; added to this list 2026-12-05), cyl_badgeLayerControls(), cyl_boundsSize(), cyl_boundsWidthOffset(), cyl_control(withTabBarItemIdentifier:), cyl_defaultTabBarItemIdentifier(for:), cyl_didInitialize(), cyl_fullHeight(), cyl_getTureLottieSizeValue(_:fromNormalImage:), cyl_getURL(from:), cyl_hasDarkLottie(forLottieURL:), cyl_hasDarkLottieURLs(), cyl_index(ofTabBarItemIdentifier:), cyl_interceptLoginIfNeeded(for:), cyl_isCustomActionTab(_:), cyl_isLoginRequired(for:), cyl_lottieDarkColors(forLottieURL:), cyl_lottieURL(_:for:), cyl_normalizedConfiguration(_:), cyl_performCustomTabActionIfNeeded(for:), cyl_pickerLanguages(), cyl_platterContentView(with:), cyl_platterContentView, cyl_platterContentViews(), cyl_platterDestOutView(), cyl_platterLiquidLensClearGlassView(), cyl_platterLiquidLensView(), cyl_platterLiquidLensViewContentView(), cyl_platterLiquidLensViewSubViews(), cyl_platterPortalView(with:), cyl_platterPortalViews(), cyl_platterSelectedContentView(), cyl_platterSelectedContentView(with:), cyl_platterSelectedContentViewWithoutPlusButtton(with:), cyl_platterSelectedContentViews(), cyl_platterSelectedContentViewsWithoutPlusButton(), cyl_platterView(with:), cyl_platterView, cyl_platterViews(), cyl_platterVisualProviderFloatingSelectedContentView(), cyl_playAllTabBarItemAnimations(), cyl_playTabButtonAnimation(for:), cyl_playTabButtonTapFeedback(), cyl_plusButton(with:title:selectedTitle:selectedTitleColor:), cyl_register(attributes:action:context:), cyl_registerDarkLottieURL(_:forLottieURL:), cyl_registerLottieDarkColors(_:forLottieURL:), cyl_selectTabBarItem(withIdentifier:), cyl_selectedIndex(forIndexIgnoringPlusButton:), cyl_setNeedsTitleAlignment(), cyl_setTabBar(_:), cyl_showBadgeValue(_:animationTypeValue:), cyl_showsTitleInTabBarItem(), cyl_simulateHideOnScrollForTesting(), cyl_switchToAdjacentTab(withStep:animated:), cyl_tabBarItemAnimationSizeValue(_:fromNormalImage:), cyl_tabBarSubviews(), cyl_tabBar, cyl_themeDidChange(by:identifier:theme:), cyl_title(), cyl_updateTitle(_:image:selectedImage:), cyl_viewController(withTabBarItemIdentifier:). Reason open and protocol (9): cyl_playBadgeChangedAnimation(withTabButton:iconView:badgeView:), cyl_playDehighlightAnimation(withTabButton:iconView:titleLabel:), cyl_playDeselectAnimation(withTabButton:iconView:titleLabel:), cyl_playHighlightAnimation(withTabButton:iconView:titleLabel:), cyl_playReselectAnimation(withTabButton:iconView:titleLabel:), cyl_playSelectAnimation(withTabButton:iconView:titleLabel:), cyl_resetTabButton(_:iconView:titleLabel:), cyl_tabBarAppearance(for:), cyl_tabBarItemsAttributes(for:). Reason protocol requirement (20; the requirements of the public protocols CYLBadgeProtocol, CYLTabBarTheme, CYLTabBarControllerDelegate, CYLTabButtonAnimation and UINavigationControllerExtensionDelegate that apps implement, and our witnesses of them, which must keep the name): cyl_clearBadge(), cyl_customize(_:), cyl_getActualBadgeSuperView(), cyl_isPauseBadge(), cyl_isReady(), cyl_isShowBadge(), cyl_perform(_:), cyl_perform(_:with:), cyl_perform(_:with:with:), cyl_plusButtonAttributes(for:), cyl_resumeBadge(), cyl_showBadge(), cyl_showBadgeValue(_:animationType:), cyl_tabBarController(_:didLoadPage:forPlaceholder:at:), cylflatdesign_navigationController(_:didBeginTransitionFrom:to:operation:), cylflatdesign_navigationController(_:didEndTransitionFrom:to:operation:cancelled:), cylflatdesign_navigationController(_:didUpdateInteractiveFrom:to:percentComplete:), cylflatdesign_navigationController(_:didUpdateInteractiveFrom:to:popGestureRecognizer:), cylflatdesign_navigationController(_:navigationBarDidChangeHeight:), cylflatdesign_navigationController(_:willEndTransitionFrom:to:operation:cancelled:). Reason Objective-C protocol selector (1): cyl_tabBarController(_:didSelectControl:) (CYLTabBarControllerDelegate). Reason module boundary (5): the CYLAnimation…EntryPoint functions live in the CYLAnimatedItem module (CYLUtils/Swift/CYLAnimationKeyLookup.swift), whose files are listed explicitly in Package.swift and excluded in the CYLUtils subspec; a Deprecated/ forward there would not be compiled, and Package.swift / CYLAnimatedItem.podspec belong to another session: CYLAnimationAttributesValueEntryPoint(_:_:), CYLAnimationFileExtensionsOfTypeEntryPoint(_:), CYLAnimationKnownTypesEntryPoint(), CYLAnimationSubspecOfTypeEntryPoint(_:), CYLAnimationTypeOfFileEntryPoint(_:_:). Type names (swift:S101, 3): _CYLFlatDesignTabBarParallaxOverlayView, _CYLFlatDesignUITabBarControllerTransitionContext, _CYLFlatDesignUITabBarControllerTransitionAnimator (class names the Objective-C runtime and apps use). Test helper owned by another session: XCTAssertEqual in CYLAnimationEngineSwiftTests.swift. Properties that SonarCloud does not flag (computed cyl_… properties of extensions) were left as they are. The full list with the declarations: bucket-d.txt of the session scratchpad (the same names). |
|
Score (2026-11-23): 85 / 100 = 40 (buckets a, b and the 23 overload names: all 244 names) + 30 (buckets c and d decided and done) + 15 (selector and interface baselines identical) + 0 (the SonarCloud re-scan of PR #788 runs in CI after the push). TODO: SonarCloud re-scan of PR #788: the open naming findings must be only the bucket d names above (the Deprecated/ folders are excluded); remove the forwards and the exclusion at the next major version; rule text for the cyl-naming skill / AGENTS.md is on PR #823. |
|
Second Sonar pass on PR #788 (2026-11-23, Mac-CYLTabBarController 小程序开发, branch feat/cross-platform-components); user prompt: "继续修复该静态分析问题,并让advisor给出合适的命名规范,如有必要可以修改instructions和skills中的描述,避免新增代码继续让类似静态分析问题出现" (English: keep fixing the static analysis issues, have the advisor give a suitable naming convention, and change the instructions and skills where needed so new code does not bring the same issues back). Scan of f51057a7: 235 open (185 swift:S100, 18 S1075, 6 S107, 5 S1172, 5 S1133, 3 S101, 2 S116, python 8, kotlin 3, one each S2961, S2094). Fixed here: S1172 x5 (options _, _ for unused parameters), S100 x6 (XCTAssertEqual test helper now assertAccuratelyEqual; five CYLAnimation…EntryPoint Swift names now cylAnimation…EntryPoint, C names unchanged), Kotlin x3 and Python x6 (commit 98befc42). Left, with the reason: about 180 S100 and 2 S116 are bucket d (open members, public protocol requirements; accepted in the SonarCloud UI by the owner, not by code), 3 S101 are public _CYL… type names (renaming needs deprecated type aliases), S2961 is the released .default, S2094 an empty marker class, S107 x6 and S1075 x18 (demo URLs) need API or owner decisions, S1133 x5 are our own deprecated forwards. Rule written: docs/instructions/code.md (Swift names follow SonarCloud) and the cyl-naming skill (table, names that stay, check command). TODO (owner): accept bucket d, the S1075 demo URLs and the S1133 forwards in the SonarCloud UI; decide S107 (group parameters into a struct, a public API change) and the _CYL… type names. |