Release codedna v1.1.0 prose voice - #3
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ceb076640a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| return [] | ||
| messages = [] | ||
| for line in code_text_lines(lang, text): | ||
| for match in re.finditer(prefix + MESSAGE_LITERAL, line, re.I): |
There was a problem hiding this comment.
Exclude literals and inline comments from error-call matching
When source files contain code examples in string literals or trailing comments, code_text_lines yields the entire physical line and this regex searches inside those non-code regions. For example, both PROMPT = 'raise ValueError("Not real.")' and value = 1 # raise ValueError("Not real.") are reported as real errors; the newly added test fixtures make this happen when profiling this repository itself. Parse or mask lexical context before recognizing an actual error call so these samples do not corrupt the capitalization and punctuation statistics.
Useful? React with 👍 / 👎.
| return [] | ||
| messages = [] | ||
| for line in code_text_lines(lang, text): | ||
| for match in re.finditer(prefix + MESSAGE_LITERAL, line, re.I): |
There was a problem hiding this comment.
Keep JavaScript logger calls out of error-message samples
In JavaScript or TypeScript repositories using common calls such as logger.error("failed") or console.error("failed"), the case-insensitive match makes the bare Error alternative match the lowercase method name, even though no error is being constructed or thrown. Those log strings are therefore mixed into error_message_voice, defeating the new channel-specific profiling for affected repositories; constrain the JS/TS match to actual Error constructor calls without case-folding method names.
Useful? React with 👍 / 👎.
| for line in code_text_lines(lang, text): | ||
| for match in re.finditer(prefix + MESSAGE_LITERAL, line, re.I): |
There was a problem hiding this comment.
Recognize multiline literal error constructions
When an error constructor and its literal are formatted on separate lines, as in raise ValueError( followed by an indented string, iterating and matching one line at a time can never associate the prefix with the message. This is common for long formatted errors and causes genuine static messages to disappear from the reported voice metrics even though they are not dynamic; scan a comment-aware source span rather than isolated physical lines.
Useful? React with 👍 / 👎.
| if stripped.startswith(token): | ||
| value = clean_comment_text(stripped[len(token):]) | ||
| if value: |
There was a problem hiding this comment.
Include trailing comments in comment-voice measurements
For repositories that commonly place explanatory comments after code, such as value = load() # preserve cache order, this branch ignores the prose because it only accepts lines whose stripped text starts with the comment token. Consequently comment length, capitalization, person, and sentence-style percentages are computed from only standalone comments and can misrepresent the repository's actual voice; extract the trailing comment portion while respecting strings.
Useful? React with 👍 / 👎.
What changed
Impact
Generated profiles now describe the prose contributors should preserve as well as code conventions. The stats JSON adds
comment_voiceanderror_message_voiceobjects per language.Validation
python3 -m py_compile skill/scripts/codedna_stats.pypython3 -m py_compile skill/scripts/codedna_wire.pypython3 -m unittest discover -s tests(43 tests)quick_validate.py skillgit diff --checkShellCheck is installed and run by CI.