hn.today

Deslop-please: an opinionated linter to remove sloppy code

github.com7 points0 comments
Screenshot of Deslop-please: an opinionated linter to remove sloppy code

Deslop-please is an opinionated code-structure linter, installable through Cargo, built around the principle that good software has deep modules and narrow interfaces. Rather than focus on formatting or isolated style rules, it identifies relationships that make code harder to understand and maintain: module-cycle flags dependencies that loop between modules; tangle detects tightly coupled layers even without a formal cycle; field-leak reports when code outside a type accesses its internal fields; and shallow-module points out modules whose callers must use too many of their functions. Its sample diagnostic traces repeated access to a run queue’s fields across scheduling modules, showing how the linter explains the spread of a problem.

The central argument is that these warnings express one design concern: implementation details expose too much complexity, forcing developers and coding agents to track more than they should. The suggested fixes therefore address patterns of use, not each reported access mechanically. For example, callers should use queue operations such as push, pop, and backlog rather than manipulate its fields; a shallow store can offer a few higher-level operations while hiding the rest. The README also illustrates reorganizing dependencies so responsibilities sit at the right abstraction layer. Although the tool provides commands to update and apply an allowlist, its guidance warns against simply suppressing findings. It recommends explaining the proposed structural change with a before-and-after diagram and includes instructions for teams to add this review process to their agent guidance.

Read on github.com0 comments on Hacker News

Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.

More in Programming

The daily digest

Today's best Hacker News stories, summarized and screenshotted, one email a day.