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

#2423 - Fix EmptyCountRule for binary, octal and hexadecimal integer literals #2430

Merged
merged 3 commits into from
Oct 2, 2018

Conversation

abdulowork
Copy link
Contributor

As per #2423

  • Added condition to empty_count regex to check whether 0 ends the word or represents a 0 as a binary, decimal or hex

@SwiftLintBot
Copy link

12 Messages
📖 Linting Aerial with this PR took 0.56s vs 0.51s on master (9% slower)
📖 Linting Alamofire with this PR took 4.22s vs 3.74s on master (12% slower)
📖 Linting Firefox with this PR took 16.02s vs 14.62s on master (9% slower)
📖 Linting Kickstarter with this PR took 25.34s vs 24.09s on master (5% slower)
📖 Linting Moya with this PR took 2.43s vs 2.2s on master (10% slower)
📖 Linting Nimble with this PR took 2.45s vs 2.06s on master (18% slower)
📖 Linting Quick with this PR took 0.74s vs 0.65s on master (13% slower)
📖 Linting Realm with this PR took 4.06s vs 3.66s on master (10% slower)
📖 Linting SourceKitten with this PR took 1.38s vs 1.23s on master (12% slower)
📖 Linting Sourcery with this PR took 5.48s vs 5.19s on master (5% slower)
📖 Linting Swift with this PR took 32.72s vs 29.76s on master (9% slower)
📖 Linting WordPress with this PR took 21.98s vs 18.66s on master (17% slower)

Generated by 🚫 Danger

"↓count == 0\n"
]
)

public func validate(file: File) -> [StyleViolation] {
let pattern = "\\bcount\\s*(==|!=|<|<=|>|>=)\\s*0"
let pattern = "\\bcount\\s*(==|!=|<|<=|>|>=)\\s*0(\\b|([box][0_]+\\b){1})"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought box was a special keyword or something, took me a while to realize it's just the three letters that are allowed 😅

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hahaha, same

@marcelofabri marcelofabri merged commit 34f513a into realm:master Oct 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants