realm / realm/SwiftLint

Parent config falsely reporting only_rules error when in child config

Open
#4,007 0 comments 0 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

New Issue Checklist
Describe the bug

So we've got a parent config that has only_rules. That parent config configured rules that they did not put in only_rules. The parent config is not one we can choose.

Our child config uses opt_in_rules to enable what the parent configured. However SwiftLint reports:

Found a configuration for 'class_delegate_protocol' rule, but it is not present on 'only_rules'.

Now this is a true statement but the rule is enabled AND the configuration is adhered to. So the warning is giving superfluous information and cluttering our Xcode warnings.

PARENT:

only_rules:
  - comma

colon:
  severity: error

CHILD:

parent_config: url-to-parent-config-over-https
opt_in_rules:
  - colon

Additional Context

  • I do not have easy access to merely change the parent config, as it's owned by a different team.

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

Reproduce the report with the shown parent_config, only_rules, and opt_in_rules YAML, then trace how SwiftLint combines parent and child configuration. Verify the behavior around the class_delegate_protocol warning and confirm that a child-enabled rule with inherited configuration no longer produces the superfluous only_rules error.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.