Skip to content

Commit 3bffb27

Browse files
committed
null entry
1 parent 82b1c0e commit 3bffb27

File tree

2 files changed

+20
-19
lines changed

2 files changed

+20
-19
lines changed

src/main.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,11 @@ struct Args {
6161
project_root: PathBuf,
6262

6363
/// Walk type
64-
#[arg(long, default_value = "jwalk")]
64+
#[arg(long, default_value = "ignore")]
6565
walk_type: String,
6666

6767
/// Entry processor type
68-
#[arg(long, default_value = "parallel")]
68+
#[arg(long, default_value = "serial")]
6969
entry_processor_type: String,
7070
}
7171

@@ -124,12 +124,12 @@ fn cli() -> Result<(), Error> {
124124

125125
let config = serde_yaml::from_reader(config_file).change_context(Error::Io)?;
126126
let walk_type = match args.walk_type.as_str() {
127-
"jwalk" => WalkType::JWalk,
128-
_ => WalkType::Ignore,
127+
"ignore" => WalkType::Ignore,
128+
_ => WalkType::JWalk,
129129
};
130130
let entry_processor_type = match args.entry_processor_type.as_str() {
131-
"parallel" => EntryProcessorType::Parallel,
132-
_ => EntryProcessorType::Serial,
131+
"serial" => EntryProcessorType::Serial,
132+
_ => EntryProcessorType::Parallel,
133133
};
134134

135135
dbg!(&walk_type, &entry_processor_type);

src/project_builder.rs

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ enum EntryType {
2525
JavascriptPackage(AbsolutePath, RelativePath),
2626
CodeownerFile(AbsolutePath, RelativePath),
2727
TeamFile(AbsolutePath, RelativePath),
28-
PossiblyOwnedFile(AbsolutePath, RelativePath),
28+
OwnedFile(AbsolutePath, RelativePath),
29+
NullEntry(),
2930
}
3031

3132
#[derive(Debug)]
@@ -142,7 +143,12 @@ impl<'a> ProjectBuilder<'a> {
142143
_ if matches_globs(&relative_path, &self.config.team_file_glob) => {
143144
Ok(EntryType::TeamFile(absolute_path.to_owned(), relative_path.to_owned()))
144145
}
145-
_ => Ok(EntryType::PossiblyOwnedFile(absolute_path.to_owned(), relative_path.to_owned())),
146+
_ if matches_globs(&relative_path, &self.config.owned_globs)
147+
&& !matches_globs(&relative_path, &self.config.unowned_globs) =>
148+
{
149+
Ok(EntryType::OwnedFile(absolute_path.to_owned(), relative_path.to_owned()))
150+
}
151+
_ => Ok(EntryType::NullEntry()),
146152
}
147153
}
148154
}
@@ -164,11 +170,8 @@ impl<'a> ProjectBuilder<'a> {
164170
let mut owned_files_vec = Vec::new();
165171
for entry_type in entry_types {
166172
match entry_type {
167-
EntryType::PossiblyOwnedFile(absolute_path, relative_path) => {
168-
if matches_globs(&relative_path, &self.config.owned_globs) && !matches_globs(&relative_path, &self.config.unowned_globs)
169-
{
170-
owned_files_vec.push(absolute_path);
171-
}
173+
EntryType::OwnedFile(absolute_path, _relative_path) => {
174+
owned_files_vec.push(absolute_path);
172175
}
173176
EntryType::Directory(absolute_path, relative_path) => {
174177
if relative_path.parent() == Some(Path::new(&self.config.vendored_gems_path)) {
@@ -217,6 +220,7 @@ impl<'a> ProjectBuilder<'a> {
217220
avoid_ownership: deserializer.github.do_not_add_to_codeowners_file,
218221
});
219222
}
223+
EntryType::NullEntry() => {}
220224
}
221225
}
222226
let owned_files = owned_files(owned_files_vec);
@@ -240,12 +244,8 @@ impl<'a> ProjectBuilder<'a> {
240244
|| (Vec::new(), Vec::new(), Vec::new(), Vec::new(), Vec::new()),
241245
|(mut owned_paths, mut pkgs, mut gems, mut codeowners, mut team_files), entry_type| {
242246
match entry_type {
243-
EntryType::PossiblyOwnedFile(absolute_path, relative_path) => {
244-
if matches_globs(&relative_path, &self.config.owned_globs)
245-
&& !matches_globs(&relative_path, &self.config.unowned_globs)
246-
{
247-
owned_paths.push(absolute_path);
248-
}
247+
EntryType::OwnedFile(absolute_path, _relative_path) => {
248+
owned_paths.push(absolute_path);
249249
}
250250
EntryType::Directory(absolute_path, relative_path) => {
251251
if relative_path.parent() == Some(Path::new(&self.config.vendored_gems_path)) {
@@ -294,6 +294,7 @@ impl<'a> ProjectBuilder<'a> {
294294
avoid_ownership: deserializer.github.do_not_add_to_codeowners_file,
295295
});
296296
}
297+
EntryType::NullEntry() => {}
297298
}
298299
(owned_paths, pkgs, gems, codeowners, team_files)
299300
},

0 commit comments

Comments
 (0)