
Does code quality still matter when AI writes the code?
sig { override.returns(T.nilable(String)) }
以下正文同步自 Hacker News 最新,版权归原站所有,已转换为易读排版。
sig { override.returns(T.nilable(String)) }
Now Sorbet rejected the misspelled method because it did not override anything. Correcting the name to linter_command satisfies that contract. Sorbet's override checking documentation describes this behavior.
That changes what I'd ask an agent to do when adding Sorbet coverage. The first version was already strict and fully annotated. The missing information was that this method was meant to override the base class.
The same reasoning applies to the tooling around the method. If a quality check is required, a test should establish that the command runs and that its failure fails the job. An optional hook returning nothing is a poor place to hide that requirement.
I expected to find stronger evidence against very long files. Earlier coding tools could struggle with reading or rewriting them, and splitting a file is an obvious task to give an agent.
Our transcript search did not find explicit code-file size or truncation errors in the Claude file-read results it inspected. That is a narrow finding. It does not tell us whether relevant context was omitted, whether shell output was truncated, or whether the agent read the right section and misunderstood it.
It does mean this investigation failed to establish a useful cutoff such as "an agent cannot reliably work on a file over 1,000 lines."
Some large files contain substantial inline tests or long runs of declarations. Others contain several responsibilities that are difficult to change independently. I care much more about the second case, especially in code we change frequently.
One CI refactor illustrated the distinction well. The main generator file became much shorter, but the generator and its new modules contained more lines in total. Named responsibilities and executable checks made the structure more useful. Total line count would have described that change badly.
I still want smaller modules where they let an agent work on a piece of behavior without rediscovering the rest of the application. Clear inputs, outputs, and tests are a better reason to draw that boundary than a line limit.
We also ran jscpd to look for copied code. It found useful candidates, including shared transformations implemented separately for the browser and server. Those are worth investigating when both copies are supposed to obey the same rules.
But matching text is only one kind of duplication. Two implementations can use different languages and look nothing alike while encoding the same business rule. The field-dependency example is a more convincing reason to share behavior than a repository-wide duplication percentage.
There is also a cost to a shared helper that needs a growing collection of flags to preserve unrelated behavior. Before extracting one, I'd write down what its callers are actually meant to share.
We applied similar scrutiny to disabled RuboCop rules. Size and complexity warnings are useful places to start looking. They do not establish that every flagged method needs a refactor. A rule that exposes a silently swallowed tooling failure has a more direct connection to our correction cycles.
For a new rule, I would want a concrete explanation of which mistake it would prevent. Then we can fix the real findings in the area where we enable it and keep the check useful. Producing a large list of warnings is the easy part.
A controlled study by Priyansh Trivedi and Olivier Schmitt, both at SonarSource, compared cleaner and messier versions of six Java and Python repositories. Across 660 Claude Code trials using Sonnet 4.6, the cleaner versions used about 7% fewer input tokens and 9% fewer output tokens. The mean fraction of hidden tests passed did not improve.
The authors constructed the repository pairs and tasks, and the result concerns that model and setup. Still, it is useful counterevidence to the assumption that cleaner-looking code automatically makes an agent more likely to finish correctly.
Our own cases give us plausible improvements to try. They don't tell us how much time a general cleanup would save.
For DocSpring, my attention is often the constraint. I need to select work, clarify requirements, review changes, and perform QA. CI and deployment queues also affect when a change reaches users. An agent reading fewer tokens can be useful, but I can't translate that directly into hours saved or software shipped.
The proposed next step is a small, time-boxed pilot. Pick a frequently changed area with a known source of rework, improve its shared behavior or executable contracts, and track what happens to the next comparable changes.
正文由 探How 从来源站点 RSS 同步,内容未经改写;遇到排版缺失或需要图片、视频时请以原文为准。