Today we can disable and enable rules on the fly using comments like // swiftlint:enable rule_identifier.
It would be quite useful to also be able to change some rules' parameters via comments as well, especially to locally extend some limits without entirely disable that rule.
For example, one might have configured the file_length rule in its .swiftlint.yml to trigger a warning after 400 lines. But then for a specific file which happens to be like 480 lines, they want to allow going a little over the limit for that specific case.
They could // swiftlint:disable file_length but doing that means that if in the future the file grows to 1000 lines, it won't warn anymore.
It would be way better to be able to set a new limit of 500 for this file instead of disabling the rule.
We could imagine multiple syntaxes for that comment, like:
// swiftlint:param rule_identifier value
// swiftlint:rule_identifier value
But some rules might be able to configure more than just the warning/error level, so maybe we should come up with a more explicit syntax, like:
// swiftlint:rule_identifier warning:value error:value2
// swiftlint:trailing_whitespace ignores_empty_lines:true
Today we can disable and enable rules on the fly using comments like
// swiftlint:enable rule_identifier.It would be quite useful to also be able to change some rules' parameters via comments as well, especially to locally extend some limits without entirely disable that rule.
For example, one might have configured the
file_lengthrule in its.swiftlint.ymlto trigger a warning after 400 lines. But then for a specific file which happens to be like 480 lines, they want to allow going a little over the limit for that specific case.They could
// swiftlint:disable file_lengthbut doing that means that if in the future the file grows to 1000 lines, it won't warn anymore.It would be way better to be able to set a new limit of 500 for this file instead of disabling the rule.
We could imagine multiple syntaxes for that comment, like:
But some rules might be able to configure more than just the warning/error level, so maybe we should come up with a more explicit syntax, like: