realm / realm/SwiftLint

`one_declaration_per_file`: ignore declarations less visible than a specified access level

Open
#5,931 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
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

one_declaration_per_file should accept a config key, tentatively named allow_visibility (ignore & exclude were not chosen), which makes the rule ignore declarations whose access level is less visible or equal to the specified value. e.g., the following will configure the rule to not be triggered for any extra declarations whose access level is fileprivate or private:

one_declaration_per_file:
  allow_visibility: fileprivate

This would be useful to ignore helper types that won't be visible to other code.

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

The issue does not name implementation files or tests. Start by locating the one_declaration_per_file rule and its configuration handling, then inspect existing rule tests for configuration patterns; done means the allow_visibility setting ignores declarations at or below the selected access level while preserving current behavior otherwise.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.