realm / realm/SwiftLint

Rule Request: Empty Quick Blocks

Open
#2,202 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

New Issue Checklist
Rule Request
  1. 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.

  1. Provide several examples of what would and wouldn't trigger violations.
// triggers
beforeEach("too") {}
afterEach("too") {}
describe("too") {}
context("too") {}
it("too") {}
...
  1. Should the rule be configurable, if so what parameters should be configurable?

Severity only.

  1. Should the rule be opt-in or enabled by default? Why?

Opt-in would be fine.

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 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.