Skip to content

Commit 4d63663

Browse files
committed
BREAKING: Update to the latest ZLS master
Rule runners now use `zlinter.rules.RunError` for extendability and coverage of IO related errors
1 parent 4f38f5c commit 4d63663

28 files changed

+33
-31
lines changed

build.zig.zon

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
.zls = .{
88
// Update with `zig fetch --save git+https://github.com/zigtools/zls#master`
99
// IF changed THEN update .github/coverage.yml
10-
.url = "git+https://github.com/zigtools/zls?ref=master#d03b99209afcae2169912986b2f4c677fca279c9",
11-
.hash = "zls-0.16.0-dev-rmm5fu5GJQBnXt4idjOYx7p4104rd3Ji-daO8a-7Gx6e",
10+
.url = "git+https://github.com/zigtools/zls?ref=master#be4ddd69067e1fd62644d9a999b17adffd8766c2",
11+
.hash = "zls-0.16.0-dev-rmm5flNfJQA26cb4HX9zW4379iE2lPGPDZD0qdh_VXMA",
1212
},
1313
},
1414
.paths = .{

integration_tests/src/no_cats.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ fn run(
2020
doc: *const zlinter.session.LintDocument,
2121
gpa: std.mem.Allocator,
2222
options: zlinter.rules.RunOptions,
23-
) error{OutOfMemory}!?zlinter.results.LintResult {
23+
) zlinter.rules.RunError!?zlinter.results.LintResult {
2424
const config = options.getConfig(Config);
2525
if (config.severity == .off) return null;
2626

src/lib/rules.zig

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ pub const LintRule = struct {
77
doc: *const session.LintDocument,
88
gpa: std.mem.Allocator,
99
options: RunOptions,
10-
) error{OutOfMemory}!?results.LintResult,
10+
) RunError!?results.LintResult,
1111
};
1212

1313
pub const RunOptions = struct {
@@ -19,6 +19,8 @@ pub const RunOptions = struct {
1919
}
2020
};
2121

22+
pub const RunError = std.mem.Allocator.Error || std.Io.Cancelable;
23+
2224
/// Rules the modify the execution of rules.
2325
pub const RuleOptions = struct {}; // zlinter-disable-current-line
2426

src/lib/session.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ pub const LintContext = struct {
256256
buffer[0..size],
257257
);
258258

259-
const handle = self.document_store.getOrLoadHandle(uri) orelse return error.HandleError;
259+
const handle = (try self.document_store.getOrLoadHandle(uri)) orelse return error.HandleError;
260260

261261
var src_comments = try comments.allocParse(handle.tree.source, gpa);
262262
errdefer src_comments.deinit(gpa);

src/rules/declaration_naming.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ fn run(
9494
doc: *const zlinter.session.LintDocument,
9595
gpa: std.mem.Allocator,
9696
options: zlinter.rules.RunOptions,
97-
) error{OutOfMemory}!?zlinter.results.LintResult {
97+
) zlinter.rules.RunError!?zlinter.results.LintResult {
9898
const config = options.getConfig(Config);
9999

100100
var lint_problems = std.ArrayList(zlinter.results.LintProblem).empty;

src/rules/field_naming.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ fn run(
145145
doc: *const zlinter.session.LintDocument,
146146
gpa: std.mem.Allocator,
147147
options: zlinter.rules.RunOptions,
148-
) error{OutOfMemory}!?zlinter.results.LintResult {
148+
) zlinter.rules.RunError!?zlinter.results.LintResult {
149149
const config = options.getConfig(Config);
150150

151151
var lint_problems: std.ArrayList(zlinter.results.LintProblem) = .empty;

src/rules/field_ordering.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ fn run(
5252
doc: *const zlinter.session.LintDocument,
5353
gpa: std.mem.Allocator,
5454
options: zlinter.rules.RunOptions,
55-
) error{OutOfMemory}!?zlinter.results.LintResult {
55+
) zlinter.rules.RunError!?zlinter.results.LintResult {
5656
const config = options.getConfig(Config);
5757

5858
var lint_problems = std.ArrayList(zlinter.results.LintProblem).empty;

src/rules/file_naming.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ fn run(
3333
doc: *const zlinter.session.LintDocument,
3434
gpa: std.mem.Allocator,
3535
options: zlinter.rules.RunOptions,
36-
) error{OutOfMemory}!?zlinter.results.LintResult {
36+
) zlinter.rules.RunError!?zlinter.results.LintResult {
3737
const config = options.getConfig(Config);
3838

3939
const message, const severity = msg: {

src/rules/function_naming.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ fn run(
6969
doc: *const zlinter.session.LintDocument,
7070
gpa: std.mem.Allocator,
7171
options: zlinter.rules.RunOptions,
72-
) error{OutOfMemory}!?zlinter.results.LintResult {
72+
) zlinter.rules.RunError!?zlinter.results.LintResult {
7373
const config = options.getConfig(Config);
7474

7575
var lint_problems = std.ArrayList(zlinter.results.LintProblem).empty;

src/rules/import_ordering.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ fn run(
5858
doc: *const zlinter.session.LintDocument,
5959
gpa: std.mem.Allocator,
6060
options: zlinter.rules.RunOptions,
61-
) error{OutOfMemory}!?zlinter.results.LintResult {
61+
) zlinter.rules.RunError!?zlinter.results.LintResult {
6262
const config = options.getConfig(Config);
6363
if (config.severity == .off) return null;
6464

0 commit comments

Comments
 (0)