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

Comma violation is not being triggered for all cases if there are consecutive violations in the expression #872

Closed
sadefigu opened this issue Nov 9, 2016 · 1 comment
Labels
bug Unexpected and reproducible misbehavior.

Comments

@sadefigu
Copy link
Contributor

sadefigu commented Nov 9, 2016

PROBLEM

Some comma violations are being ignored by the comma rule. For example: var a = [1,2,3,4]
Instead of presenting violations for 1,2 2,3 3,4, it just presents the violations for 1,2 and 3,4

INVESTIGATION

The reg exp pattern being used for comma rule violations search for
NotSpace-Space-Comma-(Space Or NotSpace).

So, if we have an expression like
var a = [1,2,3,4]
it will be able to find the violations for 1,2 and 3,4, but it will not find the violation 2,3

This happens because the reg exp pattern will consume 1,2 and then, the remaining sequence to be consumed is ,3,4 which begins with a comma. The pattern does not comprise the case where the content being with the query, so, it will ignore the first comma violation and will consume 3,4

@norio-nomura norio-nomura added the bug Unexpected and reproducible misbehavior. label Nov 9, 2016
@jpsim
Copy link
Collaborator

jpsim commented Nov 25, 2016

Fixed in #876.

@jpsim jpsim closed this as completed Nov 25, 2016
norio-nomura added a commit that referenced this issue Nov 30, 2016
* commit 'ad019afd7124c07ef34fb22e6165976116202477':
  move #872 fix to appropriate changelog section
  closure_spacing accepts empty bodies with a space

# Conflicts:
#	Source/SwiftLintFramework/Rules/ClosureSpacingRule.swift
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Unexpected and reproducible misbehavior.
Projects
None yet
Development

No branches or pull requests

3 participants