Add an `avoid_print` or similar rule
Nobody has claimed this yet.
- Dominant language
- Swift
- Stars
- 19.7k
- Forks
- 2.3k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 11
Description
New Issue Checklist
- I've Updated SwiftLint to the latest version.
- I've searched for existing GitHub issues.
Feature or Enhancement Proposal
Add an avoid_print or similar rule. It would warn whenever print(…) or similar functions are called.
It could be broadened to avoid_console_streams to also warn about using non-print functions that interact with console streams, not just the print functions.
This could prevent using print(…) functions or similar features instead of a logging system.
It would be nicest if it could actually determine the exact function being used, instead of just checking for calls to functions named print, in case user code defines its own print function overload or on a type instead of being global, but plain name matching could still be useful if more precise matching is unobtainable.
It could be made more generic as an avoid_listed_functions, and take a configurable list of function signatures.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by narrowing the proposal: decide whether the rule targets print(...) only, broader console streams, or configurable function signatures. Investigate whether SwiftLint can distinguish the exact called function from user-defined overloads, and define the expected warnings and completion criteria before implementation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100