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
jpsim opened this Issue Oct 17, 2017 · 1 comment

Comments

Projects
None yet
2 participants
@jpsim
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 label Oct 17, 2017

ornithocoder added a commit to ornithocoder/personal-fork-swiftlint that referenced this issue Jan 5, 2018

@marcelofabri

This comment has been minimized.

Show comment
Hide comment
@marcelofabri

marcelofabri Jan 5, 2018

Collaborator

Implemented in #1991.

Collaborator

marcelofabri commented Jan 5, 2018

Implemented in #1991.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment