realm / realm/SwiftLint

Allow different name and message for existing rules

Open
#3,520 1 comment 2 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

I have been using SwiftLint to create a Style Guide checker and for this, I'm using existing rules and custom rules.
The custom rules allow setting a custom name and message which is great for defining the Guide topic, like so:

empty_line_before_closing_brace:
    name: "Style Guide: 2.1 New Line"
    included: ".*\\.swift" 
    regex: '\S\n\}'
    message: "All declarations must have an empty line before closing brace (URL for Guide topic)"
    severity: error

Although, the existing rules only allow to change the severity and set some properties for specific rules.

opt_in_rules:
  - explicit_acl # Style Guide: 2.2 Access Modifier

explicit_acl:
  severity: error

It would be great to be able to change the current name and message to explicitly refer to the Style Guide.

opt_in_rules:
  - explicit_acl # Style Guide: 2.2 Access Modifier

explicit_acl:
  severity: error
  name: "Style Guide: 2.2 Access Modifier"
  message: "All declarations must have explicitly Access Modifier (URL for Guide topic)"

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 tracing how SwiftLint reads configuration for existing rules and how custom rules expose their name and message. Compare the existing-rule options with the custom-rule configuration shown in the issue. Done means existing rules can accept per-rule name and message overrides while retaining their current severity and other properties.

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
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.