Skip to content

Commit b8fd218

Browse files
authored
config: filetype warnings (#847)
1 parent 63a9162 commit b8fd218

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+596
-193
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

book-gen/src/lints.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use hemtt_sqf::analyze::{
55
lints::s02_event_handlers::{
66
LintS02EventIncorrectCommand, LintS02EventInsufficientVersion, LintS02EventUnknown,
77
},
8-
SqfLintData, SQF_LINTS,
8+
LintData, SQF_LINTS,
99
};
1010
use hemtt_workspace::lint::{Lint, Lints};
1111
use mdbook::book::Chapter;
@@ -43,7 +43,7 @@ fn sqf(chapter: &mut Chapter) {
4343
.iter()
4444
.map(|l| (**l).clone())
4545
.chain({
46-
let lints: Lints<SqfLintData> = vec![
46+
let lints: Lints<LintData> = vec![
4747
Arc::new(Box::new(LintS02EventUnknown)),
4848
Arc::new(Box::new(LintS02EventIncorrectCommand)),
4949
Arc::new(Box::new(LintS02EventInsufficientVersion)),

libs/config/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ byteorder = { workspace = true }
2121
chumsky = { workspace = true }
2222
linkme = { workspace = true }
2323
lsp-types = { workspace = true }
24+
toml = { workspace = true }
2425
vfs = { workspace = true }
2526

2627
[dev-dependencies]

libs/config/src/analyze/lints/c01_invalid_value.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ use hemtt_workspace::{
66
reporting::{Code, Codes, Diagnostic, Processed},
77
};
88

9-
use crate::{analyze::SqfLintData, Item, Value};
9+
use crate::{analyze::LintData, Item, Value};
1010

1111
crate::analyze::lint!(LintC01InvalidValue);
1212

13-
impl Lint<SqfLintData> for LintC01InvalidValue {
13+
impl Lint<LintData> for LintC01InvalidValue {
1414
fn ident(&self) -> &'static str {
1515
"invalid_value"
1616
}
@@ -49,22 +49,22 @@ Arma configs only support Strings, Numbers, and Arrays. While other tools would
4949
LintConfig::error()
5050
}
5151

52-
fn runners(&self) -> Vec<Box<dyn AnyLintRunner<SqfLintData>>> {
52+
fn runners(&self) -> Vec<Box<dyn AnyLintRunner<LintData>>> {
5353
vec![Box::new(RunnerValue), Box::new(RunnerItem)]
5454
}
5555
}
5656

5757
struct RunnerValue;
5858

59-
impl LintRunner<SqfLintData> for RunnerValue {
59+
impl LintRunner<LintData> for RunnerValue {
6060
type Target = Value;
6161
fn run(
6262
&self,
6363
_project: Option<&ProjectConfig>,
6464
_config: &LintConfig,
6565
processed: Option<&Processed>,
6666
target: &Value,
67-
_data: &SqfLintData,
67+
_data: &LintData,
6868
) -> Codes {
6969
let Some(processed) = processed else {
7070
return vec![];
@@ -85,15 +85,15 @@ impl LintRunner<SqfLintData> for RunnerValue {
8585
}
8686

8787
struct RunnerItem;
88-
impl LintRunner<SqfLintData> for RunnerItem {
88+
impl LintRunner<LintData> for RunnerItem {
8989
type Target = Item;
9090
fn run(
9191
&self,
9292
_project: Option<&ProjectConfig>,
9393
_config: &LintConfig,
9494
processed: Option<&Processed>,
9595
target: &Item,
96-
_data: &SqfLintData,
96+
_data: &LintData,
9797
) -> Codes {
9898
let Some(processed) = processed else {
9999
return vec![];

libs/config/src/analyze/lints/c02_duplicate_property.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ use hemtt_workspace::{
66
reporting::{Code, Codes, Diagnostic, Label, Processed},
77
};
88

9-
use crate::{analyze::SqfLintData, Class, Config, Ident, Property};
9+
use crate::{analyze::LintData, Class, Config, Ident, Property};
1010

1111
crate::analyze::lint!(LintC02DuplicateProperty);
1212

13-
impl Lint<SqfLintData> for LintC02DuplicateProperty {
13+
impl Lint<LintData> for LintC02DuplicateProperty {
1414
fn ident(&self) -> &'static str {
1515
"duplicate_property"
1616
}
@@ -54,21 +54,21 @@ Properties on a class must be unique, regardless of the type of property.
5454
LintConfig::error()
5555
}
5656

57-
fn runners(&self) -> Vec<Box<dyn AnyLintRunner<SqfLintData>>> {
57+
fn runners(&self) -> Vec<Box<dyn AnyLintRunner<LintData>>> {
5858
vec![Box::new(Runner)]
5959
}
6060
}
6161

6262
struct Runner;
63-
impl LintRunner<SqfLintData> for Runner {
63+
impl LintRunner<LintData> for Runner {
6464
type Target = Config;
6565
fn run(
6666
&self,
6767
_project: Option<&ProjectConfig>,
6868
_config: &LintConfig,
6969
processed: Option<&Processed>,
7070
target: &Config,
71-
_data: &SqfLintData,
71+
_data: &LintData,
7272
) -> Codes {
7373
let Some(processed) = processed else {
7474
return vec![];

libs/config/src/analyze/lints/c03_duplicate_classes.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ use hemtt_workspace::{
66
reporting::{Code, Codes, Diagnostic, Label, Processed},
77
};
88

9-
use crate::{analyze::SqfLintData, Class, Config, Property};
9+
use crate::{analyze::LintData, Class, Config, Property};
1010

1111
crate::analyze::lint!(LintC03DuplicateClasses);
1212

13-
impl Lint<SqfLintData> for LintC03DuplicateClasses {
13+
impl Lint<LintData> for LintC03DuplicateClasses {
1414
fn ident(&self) -> &'static str {
1515
"duplicate_classes"
1616
}
@@ -58,21 +58,21 @@ Children classes can only be defined once in a class.
5858
LintConfig::error()
5959
}
6060

61-
fn runners(&self) -> Vec<Box<dyn AnyLintRunner<SqfLintData>>> {
61+
fn runners(&self) -> Vec<Box<dyn AnyLintRunner<LintData>>> {
6262
vec![Box::new(Runner)]
6363
}
6464
}
6565

6666
struct Runner;
67-
impl LintRunner<SqfLintData> for Runner {
67+
impl LintRunner<LintData> for Runner {
6868
type Target = Config;
6969
fn run(
7070
&self,
7171
_project: Option<&ProjectConfig>,
7272
_config: &LintConfig,
7373
processed: Option<&Processed>,
7474
target: &Config,
75-
_data: &SqfLintData,
75+
_data: &LintData,
7676
) -> Codes {
7777
let Some(processed) = processed else {
7878
return vec![];

libs/config/src/analyze/lints/c04_external_missing.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ use hemtt_workspace::{
66
reporting::{Code, Codes, Diagnostic, Processed},
77
};
88

9-
use crate::{analyze::SqfLintData, Class, Config, Property};
9+
use crate::{analyze::LintData, Class, Config, Property};
1010

1111
crate::analyze::lint!(LintC04ExternalMissing);
1212

13-
impl Lint<SqfLintData> for LintC04ExternalMissing {
13+
impl Lint<LintData> for LintC04ExternalMissing {
1414
fn ident(&self) -> &'static str {
1515
"external_missing"
1616
}
@@ -53,21 +53,21 @@ Read more about [class inheritance](https://community.bistudio.com/wiki/Class_In
5353
LintConfig::error()
5454
}
5555

56-
fn runners(&self) -> Vec<Box<dyn AnyLintRunner<SqfLintData>>> {
56+
fn runners(&self) -> Vec<Box<dyn AnyLintRunner<LintData>>> {
5757
vec![Box::new(Runner)]
5858
}
5959
}
6060

6161
struct Runner;
62-
impl LintRunner<SqfLintData> for Runner {
62+
impl LintRunner<LintData> for Runner {
6363
type Target = Config;
6464
fn run(
6565
&self,
6666
_project: Option<&ProjectConfig>,
6767
_config: &LintConfig,
6868
processed: Option<&Processed>,
6969
target: &Config,
70-
_data: &SqfLintData,
70+
_data: &LintData,
7171
) -> Vec<std::sync::Arc<dyn Code>> {
7272
let Some(processed) = processed else {
7373
return vec![];

libs/config/src/analyze/lints/c05_external_parent_case.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ use hemtt_workspace::{
66
reporting::{Code, Codes, Diagnostic, Label, Processed, Severity},
77
};
88

9-
use crate::{analyze::SqfLintData, Class, Property};
9+
use crate::{analyze::LintData, Class, Property};
1010

1111
crate::analyze::lint!(LintC05ExternalParentCase);
1212

13-
impl Lint<SqfLintData> for LintC05ExternalParentCase {
13+
impl Lint<LintData> for LintC05ExternalParentCase {
1414
fn ident(&self) -> &'static str {
1515
"external_parent_case"
1616
}
@@ -53,21 +53,21 @@ While Arma does not care about the case of class names, HEMTT wants you to have
5353
Severity::Help
5454
}
5555

56-
fn runners(&self) -> Vec<Box<dyn AnyLintRunner<SqfLintData>>> {
56+
fn runners(&self) -> Vec<Box<dyn AnyLintRunner<LintData>>> {
5757
vec![Box::new(Runner)]
5858
}
5959
}
6060

6161
struct Runner;
62-
impl LintRunner<SqfLintData> for Runner {
62+
impl LintRunner<LintData> for Runner {
6363
type Target = Class;
6464
fn run(
6565
&self,
6666
_project: Option<&ProjectConfig>,
6767
_config: &LintConfig,
6868
processed: Option<&Processed>,
6969
target: &Class,
70-
_data: &SqfLintData,
70+
_data: &LintData,
7171
) -> Vec<std::sync::Arc<dyn Code>> {
7272
let Some(processed) = processed else {
7373
return vec![];

libs/config/src/analyze/lints/c06_unexpected_array.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ use hemtt_workspace::{
66
reporting::{Code, Diagnostic, Label, Processed},
77
};
88

9-
use crate::{analyze::SqfLintData, Property, Value};
9+
use crate::{analyze::LintData, Property, Value};
1010

1111
crate::analyze::lint!(LintC06UnexpectedArray);
1212

13-
impl Lint<SqfLintData> for LintC06UnexpectedArray {
13+
impl Lint<LintData> for LintC06UnexpectedArray {
1414
fn ident(&self) -> &'static str {
1515
"unexpected_array"
1616
}
@@ -50,21 +50,21 @@ Arrays in Arma configs are denoted by `[]` after the property name.
5050
LintConfig::error()
5151
}
5252

53-
fn runners(&self) -> Vec<Box<dyn AnyLintRunner<SqfLintData>>> {
53+
fn runners(&self) -> Vec<Box<dyn AnyLintRunner<LintData>>> {
5454
vec![Box::new(Runner)]
5555
}
5656
}
5757

5858
struct Runner;
59-
impl LintRunner<SqfLintData> for Runner {
59+
impl LintRunner<LintData> for Runner {
6060
type Target = crate::Property;
6161
fn run(
6262
&self,
6363
_project: Option<&ProjectConfig>,
6464
_config: &LintConfig,
6565
processed: Option<&Processed>,
6666
target: &crate::Property,
67-
_data: &SqfLintData,
67+
_data: &LintData,
6868
) -> Vec<std::sync::Arc<dyn Code>> {
6969
let Some(processed) = processed else {
7070
return vec![];

libs/config/src/analyze/lints/c07_expected_array.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ use hemtt_workspace::{
66
reporting::{Code, Diagnostic, Label, Processed},
77
};
88

9-
use crate::{analyze::SqfLintData, Property, Value};
9+
use crate::{analyze::LintData, Property, Value};
1010

1111
crate::analyze::lint!(LintC07ExpectedArray);
1212

13-
impl Lint<SqfLintData> for LintC07ExpectedArray {
13+
impl Lint<LintData> for LintC07ExpectedArray {
1414
fn ident(&self) -> &'static str {
1515
"expected_array"
1616
}
@@ -50,21 +50,21 @@ Only properties that are arrays must have `[]` after the property name.
5050
LintConfig::error()
5151
}
5252

53-
fn runners(&self) -> Vec<Box<dyn AnyLintRunner<SqfLintData>>> {
53+
fn runners(&self) -> Vec<Box<dyn AnyLintRunner<LintData>>> {
5454
vec![Box::new(Runner)]
5555
}
5656
}
5757

5858
struct Runner;
59-
impl LintRunner<SqfLintData> for Runner {
59+
impl LintRunner<LintData> for Runner {
6060
type Target = crate::Property;
6161
fn run(
6262
&self,
6363
_project: Option<&ProjectConfig>,
6464
_config: &LintConfig,
6565
processed: Option<&Processed>,
6666
target: &crate::Property,
67-
_data: &SqfLintData,
67+
_data: &LintData,
6868
) -> Vec<std::sync::Arc<dyn Code>> {
6969
let Some(processed) = processed else {
7070
return vec![];

0 commit comments

Comments
 (0)