Skip to content

Commit

Permalink
stringtable: Skip usage lints when using --just
Browse files Browse the repository at this point in the history
  • Loading branch information
PabstMirror committed Mar 4, 2025
1 parent 3cc1193 commit 0e449eb
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 3 deletions.
3 changes: 3 additions & 0 deletions bin/src/commands/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ pub fn execute(cmd: &Command) -> Result<Report, Error> {
)?;
if !just.is_empty() {
ctx = ctx.filter(|a, _| just.contains(&a.name().to_lowercase()));
let runtime = ctx.config().runtime().clone().with_just(true);
let config = ctx.config().clone().with_runtime(runtime);
ctx = ctx.with_config(config);
}
let mut executor = executor(ctx, &cmd.build);

Expand Down
8 changes: 7 additions & 1 deletion bin/src/commands/dev.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ pub fn context(
.map(|s| s.to_lowercase())
.collect::<Vec<_>>();

let ctx = Context::new(
let mut ctx = Context::new(
Some("dev"),
if just.is_empty() {
crate::context::PreservePrevious::Remove
Expand Down Expand Up @@ -150,6 +150,12 @@ pub fn context(
.any(|e| (a.folder() + "/").starts_with(&format!("{e}/")))
});

if !just.is_empty() {
let runtime = ctx.config().runtime().clone().with_just(true);
let config = ctx.config().clone().with_runtime(runtime);
ctx = ctx.with_config(config);
}

for optional in optionals {
if !ctx.addons().iter().any(|a| a.name() == optional) {
return Err(Error::Addon(
Expand Down
11 changes: 11 additions & 0 deletions libs/common/src/config/project/hemtt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ impl HemttConfig {
pub struct RuntimeArguments {
is_release: bool,
is_pedantic: bool,
is_just: bool,
}

impl RuntimeArguments {
Expand All @@ -82,6 +83,16 @@ impl RuntimeArguments {
..self
}
}

#[must_use]
pub const fn is_just(&self) -> bool {
self.is_just
}

#[must_use]
pub const fn with_just(self, is_just: bool) -> Self {
Self { is_just, ..self }
}
}

#[allow(clippy::module_name_repetitions)]
Expand Down
9 changes: 7 additions & 2 deletions libs/stringtable/src/analyze/lints/l02_usage/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,15 @@ impl LintRunner<LintData> for Runner {
target: &Vec<Project>,
data: &LintData,
) -> Codes {
// Ignore if using `--just`
// leaving previous (missing_stringtables.txt...) untouched
if project.is_some_and(|p| p.runtime().is_just()) {
return Vec::new();
}
let mut codes: Codes = Vec::new();
let mut all = HashMap::new();
for project in target {
for (key, positions) in &project.keys {
for stringtable in target {
for (key, positions) in &stringtable.keys {
all.entry(key.to_lowercase())
.or_insert_with(Vec::new)
.extend(positions.clone());
Expand Down

0 comments on commit 0e449eb

Please sign in to comment.