Sublime Forum

Cannot get my `file_regex` to match

#1

Dear group,

using ST4 build 4199 under Ubuntu Linux, my project file looks like this:

{
	"folders":
	[
		{
			"path": "..",
			"folder_exclude_patterns": ["__pycache__", ".venv", ".ruff_cache"]
		}
	],

    "build_systems":
    [
        {
            "name": "ruff check",
            "working_dir": "$folder",
            "shell_cmd": "source ./.venv/bin/activate && ruff check",
            "file_regex": "(\\w+\\.py):(\\d+):(\\d+)",
            "quiet": true,
        },
    ],
}

When I run the “ruff check” build, the output is like this:

SIM103 Return the condition `(date.today() - d).days < 3` directly
  --> backup.py:21:5
   |
19 |           return True
20 |
...

However, the file_regex doesn’t match and whatever I try, I cannot make it match.

Can someone please give me a hint?

0 Likes

#2

Maybe it is anchored implicitly or something? Does adding \\s+-->\\s+ beforehand make any difference?

Also if you have subfolders this approach would need tweaking

0 Likes

#3

No, unfortunately not.

(Also, I’m not sure if I can start with a smallest possible regex for testing, then work from there? :thinking: )

Because of the \\w+? Yes, I’m aware of that.

0 Likes