Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rule Request: Opt-in rule that top-level constants be prefixed by k #1907

Closed
2 tasks done
jpsim opened this issue Oct 17, 2017 · 1 comment
Closed
2 tasks done

Rule Request: Opt-in rule that top-level constants be prefixed by k #1907

jpsim opened this issue Oct 17, 2017 · 1 comment
Labels
rule-request Requests for a new rules.

Comments

@jpsim
Copy link
Collaborator

jpsim commented Oct 17, 2017

New Issue Checklist

Rule Request

1. Why should this rule be added? Share links to existing discussion about what
the community thinks about this.

Some codebases (i.e. Lyft) consistently require that top-level constants be named kVarName.

2. Provide several examples of what would and wouldn't trigger violations.

// Wouldn't trigger
private let kMarginSize = 20.0
public let kFeatureEnabled = false

struct MyStruct {
    let marginSize = 20.0
}

// Would trigger
private let marginSize = 20.0
public let featureEnabled = false

3. Should the rule be configurable, if so what parameters should be configurable?

We might want to make the prefix configurable (e.g. k vs a custom value). I think it'd be fine to do this without allowing configurability for the first version and only add it if people express an interest in it.

4. Should the rule be opt-in or enabled by default? Why?
See README.md for guidelines on when to mark a
rule as opt-in.

Should definitely be opt-in as this is a non-standard stylistic choice.

@jpsim jpsim added the rule-request Requests for a new rules. label Oct 17, 2017
ornithocoder added a commit to ornithocoder/personal-fork-swiftlint that referenced this issue Jan 5, 2018
@marcelofabri
Copy link
Collaborator

Implemented in #1991.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rule-request Requests for a new rules.
Projects
None yet
Development

No branches or pull requests

2 participants