realm / realm/SwiftLint

Add an `avoid_print` or similar rule

Open
#6,070 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

discussion
Dominant language
Swift
Stars
19.7k
Forks
2.3k
Avg merge
1d 1h
Merged PRs (30d)
11

Description

New Issue Checklist
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.