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

space_before_paren has a false-positive #104

Open
kgrubb opened this issue Sep 18, 2019 · 1 comment
Open

space_before_paren has a false-positive #104

kgrubb opened this issue Sep 18, 2019 · 1 comment

Comments

@kgrubb
Copy link
Collaborator

kgrubb commented Sep 18, 2019

The regex for space_before_paren will catch pointer dereference operators and expect a space, which is probably not what we want.

Example situation: elementary/switchboard-plug-wacom#7

What we'd probably expect:

// pointer dereference, we don't really want a space here
X.Atom device_type = *((X.Atom*)data);
// multiplication operator, we do want a space here
var test = 2 * (3 + 1);

This is fairly tricky since * can be the multiplication operator which should include a space. Here's some examples with the current regex:
Screenshot from 2019-09-17 22-21-51


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@pantor
Copy link
Collaborator

pantor commented Sep 18, 2019

This case is really hard to find with a regex-based approach. Instead, the space-before-paren check should make use of the AST for that.

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

No branches or pull requests

2 participants