vala-lint icon indicating copy to clipboard operation
vala-lint copied to clipboard

Ignore linting in regex expressions

Open ryonakano opened this issue 4 years ago • 1 comments

It seems like linting is ignored in strings:

// This code does not raise any error in vala-lint
var regex = new Regex ("^(xkb|m17n):(\\w+)");

However, if you use regex directly, vala-lint raise "space-before-paren" error:

// This code raise "space-before-paren" error in vala-lint
var regex = /^(xkb|m17n):(\w+)/;

You need to disable linting in the line to fix this, but I feel it's not smart:

var regex = /^(xkb|m17n):(\w+)/; // vala-lint=space-before-paren

It would be great if linting is disabled in regex expressions.


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

ryonakano avatar Nov 02 '20 23:11 ryonakano

This is still a major problem with the Vala linter.

It needs to completely ignore the entirety of Regexp literals, everything between the / / markers!

We just had a project whose if (/^NAME="\s*(.+?)\s*"/m.match (distro_info, 0, out m)) was subtly broken by being "fixed" by vala-lint to if (/^NAME = "\s*(.+?)\s*"/m.match (distro_info, 0, out m))

Arcitec avatar Sep 22 '24 18:09 Arcitec