realm / realm/SwiftLint

Add `ignore_first_metatype_parameter ` boolean option to `function_default_parameter_at_end`

Open
#6,881 0 comments 0 reactions 0 assignees View on GitHub

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
Feature or Enhancement Proposal

Please add a ignore_first_metatype_parameter boolean option to function_default_parameter_at_end that, when true, ignores the first metatype parameter (i.e. a parameter whose type is is *.Type; e.g., see this).

Metatype parameters with default arguments generally belong at the front of their parameter list due to English grammar, and they are frequent enough to warrant an ignore option.

Defaulting to false would mimic current behavior, but I bet it wouldn't be that bad to default to true, because that wouldn't generate false positives, and I doubt it would generate false negatives.

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

Locate the implementation and tests for the function_default_parameter_at_end rule, then inspect how its options and parameter types are handled. Add coverage for the ignore_first_metatype_parameter option, including its default behavior, and verify that a first *.Type parameter with a default argument is handled as specified.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.