`one_declaration_per_file`: ignore declarations less visible than a specified access level
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
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
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
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