WIP refactor: inject bible rendering styles into textBlocks#65
WIP refactor: inject bible rendering styles into textBlocks#65davidfedor wants to merge 2 commits into
Conversation
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
@greptileai please review |
|
@greptileai please review, really. |
Greptile SummaryThis PR introduces a Key changes:
Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Caller
participant textBlocks
participant generateTextBlocks
participant StateIn
participant styles as styles: BibleVersionRenderingStyleInterpreting
participant handleNodeBlock
participant handleBlockChild
Caller->>textBlocks: textBlocks(reference, fonts, styles?)
textBlocks->>generateTextBlocks: generateTextBlocks(..., styles)
generateTextBlocks->>StateIn: StateIn(..., styles: styles)
generateTextBlocks->>handleNodeBlock: handleNodeBlock(stateIn, ...)
handleNodeBlock->>styles: stateIn.styles.interpretBlockClasses(classes, ...)
handleNodeBlock->>handleBlockChild: handleBlockChild(stateIn, ...)
handleBlockChild->>styles: stateIn.styles.interpretTextAttr(node, ...)
Last reviewed commit: 4c7834f |
| public func interpretTextAttr( | ||
| _ node: BibleTextNode, | ||
| stateIn: BibleVersionRendering.StateIn, | ||
| stateDown: inout BibleVersionRendering.StateDown, | ||
| stateUp: inout BibleVersionRendering.StateUp | ||
| ) |
There was a problem hiding this comment.
Redundant public modifier on protocol requirement
In Swift, protocol requirements inherit the access level of the enclosing protocol — you cannot (and should not) annotate individual requirements with an access modifier. Writing public func inside a public protocol generates a Swift compiler warning: "Redundant access modifier 'public', since the protocol is also declared 'public'".
More importantly, this declaration is inconsistent with interpretBlockClasses immediately above it, which has no access modifier. Both methods are effectively public since the protocol is public.
| public func interpretTextAttr( | |
| _ node: BibleTextNode, | |
| stateIn: BibleVersionRendering.StateIn, | |
| stateDown: inout BibleVersionRendering.StateDown, | |
| stateUp: inout BibleVersionRendering.StateUp | |
| ) | |
| func interpretTextAttr( | |
| _ node: BibleTextNode, | |
| stateIn: BibleVersionRendering.StateIn, | |
| stateDown: inout BibleVersionRendering.StateDown, | |
| stateUp: inout BibleVersionRendering.StateUp | |
| ) |
Motivation
Description
BibleVersionRenderingStyleInterpretingprotocol and convertBibleVersionRenderingStylesto a concrete, instantiablepublicimplementation with a public initializer.BibleVersionRendering.textBlocks(...)with astyles: any BibleVersionRenderingStyleInterpreting = BibleVersionRenderingStyles()parameter and thread it throughgenerateTextBlocks(...)andStateIn.BibleVersionRenderingStyles.interpretBlockClassesandinterpretTextAttrwith instance calls viastateIn.styles.interpretBlockClasses(...)andstateIn.styles.interpretTextAttr(...)so alternate interpreters can be injected.Testing
swift testand the test suite completed successfully (all tests passed).LINUX_SOURCEKIT_LIB_PATH=... swiftlint --strictand linting finished with no violations.Codex Task