Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

config: filetype warnings #847

Merged
merged 4 commits into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions book-gen/src/lints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use hemtt_sqf::analyze::{
lints::s02_event_handlers::{
LintS02EventIncorrectCommand, LintS02EventInsufficientVersion, LintS02EventUnknown,
},
SqfLintData, SQF_LINTS,
LintData, SQF_LINTS,
};
use hemtt_workspace::lint::{Lint, Lints};
use mdbook::book::Chapter;
Expand Down Expand Up @@ -43,7 +43,7 @@ fn sqf(chapter: &mut Chapter) {
.iter()
.map(|l| (**l).clone())
.chain({
let lints: Lints<SqfLintData> = vec![
let lints: Lints<LintData> = vec![
Arc::new(Box::new(LintS02EventUnknown)),
Arc::new(Box::new(LintS02EventIncorrectCommand)),
Arc::new(Box::new(LintS02EventInsufficientVersion)),
Expand Down
1 change: 1 addition & 0 deletions libs/config/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ byteorder = { workspace = true }
chumsky = { workspace = true }
linkme = { workspace = true }
lsp-types = { workspace = true }
toml = { workspace = true }
vfs = { workspace = true }

[dev-dependencies]
Expand Down
14 changes: 7 additions & 7 deletions libs/config/src/analyze/lints/c01_invalid_value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ use hemtt_workspace::{
reporting::{Code, Codes, Diagnostic, Processed},
};

use crate::{analyze::SqfLintData, Item, Value};
use crate::{analyze::LintData, Item, Value};

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

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

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

struct RunnerValue;

impl LintRunner<SqfLintData> for RunnerValue {
impl LintRunner<LintData> for RunnerValue {
type Target = Value;
fn run(
&self,
_project: Option<&ProjectConfig>,
_config: &LintConfig,
processed: Option<&Processed>,
target: &Value,
_data: &SqfLintData,
_data: &LintData,
) -> Codes {
let Some(processed) = processed else {
return vec![];
Expand All @@ -85,15 +85,15 @@ impl LintRunner<SqfLintData> for RunnerValue {
}

struct RunnerItem;
impl LintRunner<SqfLintData> for RunnerItem {
impl LintRunner<LintData> for RunnerItem {
type Target = Item;
fn run(
&self,
_project: Option<&ProjectConfig>,
_config: &LintConfig,
processed: Option<&Processed>,
target: &Item,
_data: &SqfLintData,
_data: &LintData,
) -> Codes {
let Some(processed) = processed else {
return vec![];
Expand Down
10 changes: 5 additions & 5 deletions libs/config/src/analyze/lints/c02_duplicate_property.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ use hemtt_workspace::{
reporting::{Code, Codes, Diagnostic, Label, Processed},
};

use crate::{analyze::SqfLintData, Class, Config, Ident, Property};
use crate::{analyze::LintData, Class, Config, Ident, Property};

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

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

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

struct Runner;
impl LintRunner<SqfLintData> for Runner {
impl LintRunner<LintData> for Runner {
type Target = Config;
fn run(
&self,
_project: Option<&ProjectConfig>,
_config: &LintConfig,
processed: Option<&Processed>,
target: &Config,
_data: &SqfLintData,
_data: &LintData,
) -> Codes {
let Some(processed) = processed else {
return vec![];
Expand Down
10 changes: 5 additions & 5 deletions libs/config/src/analyze/lints/c03_duplicate_classes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ use hemtt_workspace::{
reporting::{Code, Codes, Diagnostic, Label, Processed},
};

use crate::{analyze::SqfLintData, Class, Config, Property};
use crate::{analyze::LintData, Class, Config, Property};

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

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

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

struct Runner;
impl LintRunner<SqfLintData> for Runner {
impl LintRunner<LintData> for Runner {
type Target = Config;
fn run(
&self,
_project: Option<&ProjectConfig>,
_config: &LintConfig,
processed: Option<&Processed>,
target: &Config,
_data: &SqfLintData,
_data: &LintData,
) -> Codes {
let Some(processed) = processed else {
return vec![];
Expand Down
10 changes: 5 additions & 5 deletions libs/config/src/analyze/lints/c04_external_missing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ use hemtt_workspace::{
reporting::{Code, Codes, Diagnostic, Processed},
};

use crate::{analyze::SqfLintData, Class, Config, Property};
use crate::{analyze::LintData, Class, Config, Property};

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

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

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

struct Runner;
impl LintRunner<SqfLintData> for Runner {
impl LintRunner<LintData> for Runner {
type Target = Config;
fn run(
&self,
_project: Option<&ProjectConfig>,
_config: &LintConfig,
processed: Option<&Processed>,
target: &Config,
_data: &SqfLintData,
_data: &LintData,
) -> Vec<std::sync::Arc<dyn Code>> {
let Some(processed) = processed else {
return vec![];
Expand Down
10 changes: 5 additions & 5 deletions libs/config/src/analyze/lints/c05_external_parent_case.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ use hemtt_workspace::{
reporting::{Code, Codes, Diagnostic, Label, Processed, Severity},
};

use crate::{analyze::SqfLintData, Class, Property};
use crate::{analyze::LintData, Class, Property};

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

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

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

struct Runner;
impl LintRunner<SqfLintData> for Runner {
impl LintRunner<LintData> for Runner {
type Target = Class;
fn run(
&self,
_project: Option<&ProjectConfig>,
_config: &LintConfig,
processed: Option<&Processed>,
target: &Class,
_data: &SqfLintData,
_data: &LintData,
) -> Vec<std::sync::Arc<dyn Code>> {
let Some(processed) = processed else {
return vec![];
Expand Down
10 changes: 5 additions & 5 deletions libs/config/src/analyze/lints/c06_unexpected_array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ use hemtt_workspace::{
reporting::{Code, Diagnostic, Label, Processed},
};

use crate::{analyze::SqfLintData, Property, Value};
use crate::{analyze::LintData, Property, Value};

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

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

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

struct Runner;
impl LintRunner<SqfLintData> for Runner {
impl LintRunner<LintData> for Runner {
type Target = crate::Property;
fn run(
&self,
_project: Option<&ProjectConfig>,
_config: &LintConfig,
processed: Option<&Processed>,
target: &crate::Property,
_data: &SqfLintData,
_data: &LintData,
) -> Vec<std::sync::Arc<dyn Code>> {
let Some(processed) = processed else {
return vec![];
Expand Down
10 changes: 5 additions & 5 deletions libs/config/src/analyze/lints/c07_expected_array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ use hemtt_workspace::{
reporting::{Code, Diagnostic, Label, Processed},
};

use crate::{analyze::SqfLintData, Property, Value};
use crate::{analyze::LintData, Property, Value};

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

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

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

struct Runner;
impl LintRunner<SqfLintData> for Runner {
impl LintRunner<LintData> for Runner {
type Target = crate::Property;
fn run(
&self,
_project: Option<&ProjectConfig>,
_config: &LintConfig,
processed: Option<&Processed>,
target: &crate::Property,
_data: &SqfLintData,
_data: &LintData,
) -> Vec<std::sync::Arc<dyn Code>> {
let Some(processed) = processed else {
return vec![];
Expand Down
10 changes: 5 additions & 5 deletions libs/config/src/analyze/lints/c08_missing_semicolon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ use hemtt_workspace::{
reporting::{diagnostic::Yellow, Code, Diagnostic, Processed},
};

use crate::{analyze::SqfLintData, Property};
use crate::{analyze::LintData, Property};

crate::analyze::lint!(LintC08MissingSemicolon);

impl Lint<SqfLintData> for LintC08MissingSemicolon {
impl Lint<LintData> for LintC08MissingSemicolon {
fn ident(&self) -> &'static str {
"missing_semicolon"
}
Expand Down Expand Up @@ -64,22 +64,22 @@ All properties must end with a semicolon, including classes.
LintConfig::error()
}

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

struct Runner;

impl LintRunner<SqfLintData> for Runner {
impl LintRunner<LintData> for Runner {
type Target = crate::Property;
fn run(
&self,
_project: Option<&ProjectConfig>,
_config: &LintConfig,
processed: Option<&Processed>,
target: &crate::Property,
_data: &SqfLintData,
_data: &LintData,
) -> Vec<std::sync::Arc<dyn Code>> {
let Some(processed) = processed else {
return vec![];
Expand Down
Loading
Loading