realm / realm/SwiftLint

Override rules from `parent_config`

Open
#3,469 9 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

I have the config:

parent_config: https://github.com/sindresorhus/swiftlint-config/raw/723a1fa/.swiftlint.yml

In the parent config, I use only_rules to define the rules I want. I want to reuse the https://github.com/sindresorhus/swiftlint-config/raw/723a1fa/.swiftlint.yml config in many projects, but in some projects, I might want to add some extra rules, and maybe disable some. This is currently not possible. I think only_rules in a child config should be able to extend a only_rules in a parent config. This is possible in any other linter, like ESLint in the JavaScript ecosystem.

parent_config: https://github.com/sindresorhus/swiftlint-config/raw/723a1fa/.swiftlint.yml
only_rules:
  - attributes
disabled_rules:
  - todo

Results in:

SwiftLint Configuration Error: 'disabled_rules' or 'opt_in_rules' cannot be used in combination with 'only_rules' – Falling back to default configuration


// @fredpi

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 SwiftLint's configuration handling for parent_config, only_rules, and disabled_rules. Reproduce the reported configuration error, then verify that child rules can extend or disable rules from the parent configuration without falling back to the default configuration.

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
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.