Skip to content

Commit 456e04a

Browse files
tact1m4n3Copper280z
authored andcommitted
linter: Skip deleted files (ZigEmbeddedGroup#590)
1 parent 07cdf32 commit 456e04a

4 files changed

Lines changed: 5 additions & 92 deletions

File tree

.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727

2828
- name: Run linter
2929
run: |
30-
FILES=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | grep '\.zig$')
30+
FILES=$(git diff --name-only --diff-filter=d ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | grep '\.zig$')
3131
echo changed files: $FILES
3232
./tools/linter/zig-out/bin/linter $FILES > lint_results.json
3333

tools/linter/build.zig.zon

Lines changed: 3 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -1,86 +1,12 @@
11
.{
2-
// This is the default name used by packages depending on this one. For
3-
// example, when a user runs `zig fetch --save <url>`, this field is used
4-
// as the key in the `dependencies` table. Although the user can choose a
5-
// different name, most users will stick with this provided value.
6-
//
7-
// It is redundant to include "zig" in this name because it is already
8-
// within the Zig package namespace.
9-
.name = .linter,
10-
11-
// This is a [Semantic Version](https://semver.org/).
12-
// In a future version of Zig it will be used for package deduplication.
2+
.name = .mz_tools_linter,
133
.version = "0.0.0",
14-
15-
// Together with name, this represents a globally unique package
16-
// identifier. This field is generated by the Zig toolchain when the
17-
// package is first created, and then *never changes*. This allows
18-
// unambiguous detection of one package being an updated version of
19-
// another.
20-
//
21-
// When forking a Zig project, this id should be regenerated (delete the
22-
// field and run `zig build`) if the upstream project is still maintained.
23-
// Otherwise, the fork is *hostile*, attempting to take control over the
24-
// original project's identity. Thus it is recommended to leave the comment
25-
// on the following line intact, so that it shows up in code reviews that
26-
// modify the field.
27-
.fingerprint = 0x7456b4f0ac0d96c2, // Changing this has security and trust implications.
28-
29-
// Tracks the earliest Zig version that the package considers to be a
30-
// supported use case.
4+
.fingerprint = 0x334c50d4d1fddc14,
315
.minimum_zig_version = "0.14.1",
32-
33-
// This field is optional.
34-
// Each dependency must either provide a `url` and `hash`, or a `path`.
35-
// `zig build --fetch` can be used to fetch all dependencies of a package, recursively.
36-
// Once all dependencies are fetched, `zig build` no longer requires
37-
// internet connectivity.
38-
.dependencies = .{
39-
// See `zig fetch --save <url>` for a command-line interface for adding dependencies.
40-
//.example = .{
41-
// // When updating this field to a new URL, be sure to delete the corresponding
42-
// // `hash`, otherwise you are communicating that you expect to find the old hash at
43-
// // the new URL. If the contents of a URL change this will result in a hash mismatch
44-
// // which will prevent zig from using it.
45-
// .url = "https://example.com/foo.tar.gz",
46-
//
47-
// // This is computed from the file contents of the directory of files that is
48-
// // obtained after fetching `url` and applying the inclusion rules given by
49-
// // `paths`.
50-
// //
51-
// // This field is the source of truth; packages do not come from a `url`; they
52-
// // come from a `hash`. `url` is just one of many possible mirrors for how to
53-
// // obtain a package matching this `hash`.
54-
// //
55-
// // Uses the [multihash](https://multiformats.io/multihash/) format.
56-
// .hash = "...",
57-
//
58-
// // When this is provided, the package is found in a directory relative to the
59-
// // build root. In this case the package's hash is irrelevant and therefore not
60-
// // computed. This field and `url` are mutually exclusive.
61-
// .path = "foo",
62-
//
63-
// // When this is set to `true`, a package is declared to be lazily
64-
// // fetched. This makes the dependency only get fetched if it is
65-
// // actually used.
66-
// .lazy = false,
67-
//},
68-
},
69-
70-
// Specifies the set of files and directories that are included in this package.
71-
// Only files and directories listed here are included in the `hash` that
72-
// is computed for this package. Only files listed here will remain on disk
73-
// when using the zig package manager. As a rule of thumb, one should list
74-
// files required for compilation plus any license(s).
75-
// Paths are relative to the build root. Use the empty string (`""`) to refer to
76-
// the build root itself.
77-
// A directory listed here means that all files within, recursively, are included.
6+
.dependencies = .{},
787
.paths = .{
798
"build.zig",
809
"build.zig.zon",
8110
"src",
82-
// For example...
83-
//"LICENSE",
84-
//"README.md",
8511
},
8612
}

tools/linter/src/main.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const Issue = struct {
55
};
66

77
pub fn main() !void {
8-
var debug_allocator = std.heap.DebugAllocator(.{}){};
8+
var debug_allocator: std.heap.DebugAllocator(.{}) = .init;
99
defer _ = debug_allocator.deinit();
1010

1111
var arena = std.heap.ArenaAllocator.init(debug_allocator.allocator());

tools/linter/src/root.zig

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)