Rule Request: Empty Quick Blocks
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
- Updated SwiftLint to the latest version
- I searched for existing GitHub issues
Rule Request
- Why should this rule be added?
When refactoring code it's common to comment out tests that also require refactoring and one might forget to uncomment and refactor these tests before submitting a new patch set to Code Review. In the last two weeks I caught this issue twice when reviewing code. The rule would have thrown a violation to the developer before they could submit the code to Code Review.
This rule would be similar to #2190, but for Quick blocks instead of XCTest methods.
- Provide several examples of what would and wouldn't trigger violations.
// triggers
beforeEach("too") {}
afterEach("too") {}
describe("too") {}
context("too") {}
it("too") {}
...
- Should the rule be configurable, if so what parameters should be configurable?
Severity only.
- Should the rule be opt-in or enabled by default? Why?
Opt-in would be fine.
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 from the issue's empty Quick block examples and compare them with the existing rule referenced as #2190. Done means an opt-in rule flags empty beforeEach, afterEach, describe, context, and it blocks, with severity configurable.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100