function_body_length - Add Configuration To Ignore Switch/Case statements
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
- Updated SwiftLint to the latest version
- I searched for existing GitHub issues
New rule request
Similar to how cyclomatic_complexity allows for ignoring case statements - https://realm.github.io/SwiftLint/cyclomatic_complexity.html, looking for an option on function_body_length to do the same.
We have an enum with 27 different errors, and a method that converts the error codes into a human readable string, but that involves calling into NSLocalizedString - which is 5 lines for ever call.
It's not horrible to have to do a "swiftlint:disable" just for that function, but I was hoping the justification for cyclomatic_complexity would apply to function_body_length, just so we don't need to disable in cases where there isn't a cleaner way to break apart a large method.
-Thanks!
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the cyclomatic_complexity rule and its documented option for ignoring case statements, then compare that behavior with function_body_length. Confirm the requested configuration can exclude Switch/Case statements from the function-body length calculation and that the option is documented consistently.
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
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100