mirror of
https://github.com/WhatsApp/erlang-language-platform.git
synced 2025-12-23 12:26:48 +00:00
BE: remove disabling DiagnosticCode::MissingCompileWarnMissingSpec in tests
Summary: Now that the diagnostic is explicitly enabled, this is no longer needed. Reviewed By: jcpetruzza Differential Revision: D59323094 fbshipit-source-id: e37f5cf660a6826b6554e5a12933ece0600ec878
This commit is contained in:
parent
ac9103b1ff
commit
db2cdef659
11 changed files with 23 additions and 59 deletions
|
|
@ -155,7 +155,6 @@ impl Project {
|
|||
..Default::default()
|
||||
},
|
||||
);
|
||||
config.ignore_diagnostic(DiagnosticCode::MissingCompileWarnMissingSpec);
|
||||
config.ignore_diagnostic(DiagnosticCode::UndefinedFunction);
|
||||
|
||||
let handle = thread::spawn(|| {
|
||||
|
|
|
|||
|
|
@ -555,7 +555,6 @@ mod tests {
|
|||
fn check_adhoc_function_match(match_spec: &Vec<Vec<FunctionMatch>>, fixture: &str) {
|
||||
check_diagnostics_with_config(
|
||||
DiagnosticsConfig::default()
|
||||
.disable(DiagnosticCode::MissingCompileWarnMissingSpec)
|
||||
.disable(DiagnosticCode::CrossNodeEval)
|
||||
.disable(DiagnosticCode::UndefinedFunction)
|
||||
.set_ad_hoc_semantic_diagnostics(vec![&|acc, sema, file_id, _ext| {
|
||||
|
|
@ -573,7 +572,6 @@ mod tests {
|
|||
) {
|
||||
check_fix_with_config(
|
||||
DiagnosticsConfig::default()
|
||||
.disable(DiagnosticCode::MissingCompileWarnMissingSpec)
|
||||
.disable(DiagnosticCode::CrossNodeEval)
|
||||
.disable(DiagnosticCode::UndefinedFunction)
|
||||
.set_ad_hoc_semantic_diagnostics(vec![&|acc, sema, file_id, _ext| {
|
||||
|
|
|
|||
|
|
@ -483,6 +483,11 @@ impl<'a> DiagnosticsConfig<'a> {
|
|||
self
|
||||
}
|
||||
|
||||
pub fn enable(mut self, code: DiagnosticCode) -> DiagnosticsConfig<'a> {
|
||||
self.enabled.insert(code);
|
||||
self
|
||||
}
|
||||
|
||||
pub fn disable(mut self, code: DiagnosticCode) -> DiagnosticsConfig<'a> {
|
||||
self.disabled.insert(code);
|
||||
self
|
||||
|
|
@ -1800,7 +1805,6 @@ baz(1)->4.
|
|||
file_id,
|
||||
)
|
||||
}])
|
||||
.disable(DiagnosticCode::MissingCompileWarnMissingSpec)
|
||||
.disable(DiagnosticCode::UndefinedFunction);
|
||||
check_diagnostics_with_config(
|
||||
DiagnosticsConfig {
|
||||
|
|
@ -2000,8 +2004,7 @@ baz(1)->4.
|
|||
labeled_undefined_errors,
|
||||
};
|
||||
|
||||
let config =
|
||||
DiagnosticsConfig::default().disable(DiagnosticCode::MissingCompileWarnMissingSpec);
|
||||
let config = DiagnosticsConfig::default();
|
||||
check_diagnostics_with_config_and_extra(
|
||||
config,
|
||||
&extra_diags,
|
||||
|
|
|
|||
|
|
@ -238,16 +238,12 @@ fn check_valid_application(
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::diagnostics::DiagnosticCode;
|
||||
use crate::diagnostics::DiagnosticsConfig;
|
||||
use crate::tests::check_diagnostics_with_config;
|
||||
|
||||
#[track_caller]
|
||||
pub(crate) fn check_diagnostics(ra_fixture: &str) {
|
||||
let mut config = DiagnosticsConfig::default();
|
||||
config
|
||||
.disabled
|
||||
.insert(DiagnosticCode::MissingCompileWarnMissingSpec);
|
||||
let config = DiagnosticsConfig::default();
|
||||
check_diagnostics_with_config(config, ra_fixture)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -115,9 +115,7 @@ mod tests {
|
|||
|
||||
#[track_caller]
|
||||
pub(crate) fn check_diagnostics(fixture: &str) {
|
||||
let config = DiagnosticsConfig::default()
|
||||
.disable(DiagnosticCode::MissingCompileWarnMissingSpec)
|
||||
.disable(DiagnosticCode::UndefinedFunction);
|
||||
let config = DiagnosticsConfig::default().disable(DiagnosticCode::UndefinedFunction);
|
||||
check_diagnostics_with_config(config, fixture)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -363,7 +363,6 @@ mod tests {
|
|||
#[track_caller]
|
||||
fn check_diagnostics(ra_fixture: &str) {
|
||||
let config = DiagnosticsConfig::default()
|
||||
.disable(DiagnosticCode::MissingCompileWarnMissingSpec)
|
||||
.disable(DiagnosticCode::Unexpected("unexpected_semi".to_string()))
|
||||
.disable(DiagnosticCode::Unexpected("unexpected_dot".to_string()));
|
||||
check_diagnostics_with_config(config, ra_fixture)
|
||||
|
|
@ -372,7 +371,6 @@ mod tests {
|
|||
#[track_caller]
|
||||
fn check_fix(fixture_before: &str, fixture_after: Expect) {
|
||||
let config = DiagnosticsConfig::default()
|
||||
.disable(DiagnosticCode::MissingCompileWarnMissingSpec)
|
||||
.disable(DiagnosticCode::Unexpected("unexpected_semi".to_string()))
|
||||
.disable(DiagnosticCode::Unexpected("unexpected_dot".to_string()));
|
||||
check_nth_fix(
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@
|
|||
//! Return a diagnostic if a the file does not have
|
||||
//! `warn_missing_spec(_all)` in a compile attribute
|
||||
//! Add this as a fix.
|
||||
//!
|
||||
|
||||
use elp_ide_assists::helpers::add_compile_option;
|
||||
use elp_ide_assists::helpers::rename_atom_in_compile_attribute;
|
||||
|
|
@ -155,7 +154,7 @@ fn report_diagnostic(
|
|||
&co_id,
|
||||
"warn_missing_spec",
|
||||
"warn_missing_spec_all",
|
||||
&mut builder
|
||||
&mut builder,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -183,15 +182,15 @@ mod tests {
|
|||
|
||||
#[track_caller]
|
||||
pub(crate) fn check_fix(fixture_before: &str, fixture_after: Expect) {
|
||||
let mut config = DiagnosticsConfig::default();
|
||||
config.enabled.insert(DiagnosticCode::MissingCompileWarnMissingSpec);
|
||||
let config =
|
||||
DiagnosticsConfig::default().enable(DiagnosticCode::MissingCompileWarnMissingSpec);
|
||||
check_fix_with_config(config, fixture_before, fixture_after)
|
||||
}
|
||||
|
||||
#[track_caller]
|
||||
pub(crate) fn check_diagnostics(fixture: &str) {
|
||||
let mut config = DiagnosticsConfig::default();
|
||||
config.enabled.insert(DiagnosticCode::MissingCompileWarnMissingSpec);
|
||||
let config =
|
||||
DiagnosticsConfig::default().enable(DiagnosticCode::MissingCompileWarnMissingSpec);
|
||||
check_diagnostics_with_config(config, fixture)
|
||||
}
|
||||
|
||||
|
|
@ -201,7 +200,6 @@ mod tests {
|
|||
check_diagnostics_with_config(config, fixture)
|
||||
}
|
||||
|
||||
|
||||
#[test]
|
||||
fn no_compile_attribute() {
|
||||
check_diagnostics(
|
||||
|
|
|
|||
|
|
@ -148,7 +148,6 @@ fn make_diagnostic(
|
|||
mod tests {
|
||||
use expect_test::expect;
|
||||
|
||||
use crate::diagnostics::DiagnosticCode;
|
||||
use crate::diagnostics::DiagnosticsConfig;
|
||||
use crate::fixture;
|
||||
use crate::tests::check_diagnostics;
|
||||
|
|
@ -183,10 +182,7 @@ mod tests {
|
|||
-di~alyzer({nowarn_function, f/0}).
|
||||
"#,
|
||||
);
|
||||
let mut config = DiagnosticsConfig::default();
|
||||
config
|
||||
.disabled
|
||||
.insert(DiagnosticCode::MissingCompileWarnMissingSpec);
|
||||
let config = DiagnosticsConfig::default();
|
||||
let diags = analysis
|
||||
.native_diagnostics(&config, position.file_id)
|
||||
.unwrap();
|
||||
|
|
@ -207,10 +203,7 @@ mod tests {
|
|||
f(#dyalizer{field = Bar}) -> Bar.
|
||||
"#,
|
||||
);
|
||||
let mut config = DiagnosticsConfig::default();
|
||||
config
|
||||
.disabled
|
||||
.insert(DiagnosticCode::MissingCompileWarnMissingSpec);
|
||||
let config = DiagnosticsConfig::default();
|
||||
let diags = analysis
|
||||
.native_diagnostics(&config, position.file_id)
|
||||
.unwrap();
|
||||
|
|
|
|||
|
|
@ -371,7 +371,6 @@ mod tests {
|
|||
) {
|
||||
let config = DiagnosticsConfig::default()
|
||||
.set_experimental(true)
|
||||
.disable(DiagnosticCode::MissingCompileWarnMissingSpec)
|
||||
.disable(DiagnosticCode::UndefinedFunction)
|
||||
.set_ad_hoc_semantic_diagnostics(ad_hoc_semantic_diagnostics);
|
||||
check_fix_with_config(config, fixture_before, fixture_after)
|
||||
|
|
@ -385,7 +384,6 @@ mod tests {
|
|||
) {
|
||||
let config = DiagnosticsConfig::default()
|
||||
.set_experimental(true)
|
||||
.disable(DiagnosticCode::MissingCompileWarnMissingSpec)
|
||||
.disable(DiagnosticCode::UndefinedFunction)
|
||||
.set_lints_from_config(&Arc::new(lints_from_config));
|
||||
check_fix_with_config(config, fixture_before, fixture_after)
|
||||
|
|
@ -398,7 +396,6 @@ mod tests {
|
|||
) {
|
||||
let config = DiagnosticsConfig::default()
|
||||
.set_experimental(true)
|
||||
.disable(DiagnosticCode::MissingCompileWarnMissingSpec)
|
||||
.disable(DiagnosticCode::UndefinedFunction)
|
||||
.set_ad_hoc_semantic_diagnostics(ad_hoc_semantic_diagnostics);
|
||||
check_diagnostics_with_config(config, fixture)
|
||||
|
|
|
|||
|
|
@ -256,7 +256,6 @@ mod tests {
|
|||
use crate::diagnostics;
|
||||
use crate::diagnostics::attach_related_diagnostics;
|
||||
use crate::diagnostics::Diagnostic;
|
||||
use crate::diagnostics::DiagnosticCode;
|
||||
use crate::diagnostics::LabeledDiagnostics;
|
||||
use crate::diagnostics::Severity;
|
||||
use crate::diagnostics_collection::are_all_labeled_diagnostics_equal;
|
||||
|
|
@ -393,8 +392,7 @@ mod tests {
|
|||
labeled_undefined_errors,
|
||||
};
|
||||
|
||||
let config =
|
||||
DiagnosticsConfig::default().disable(DiagnosticCode::MissingCompileWarnMissingSpec);
|
||||
let config = DiagnosticsConfig::default();
|
||||
check_diagnostics_with_config_and_extra(
|
||||
config,
|
||||
&extra_diags,
|
||||
|
|
|
|||
|
|
@ -37,9 +37,7 @@ use crate::NavigationTarget;
|
|||
|
||||
#[track_caller]
|
||||
pub(crate) fn check_ct_fix(fixture_before: &str, fixture_after: &str) {
|
||||
let config = DiagnosticsConfig::default()
|
||||
.disable(DiagnosticCode::MissingCompileWarnMissingSpec)
|
||||
.disable(DiagnosticCode::UndefinedFunction);
|
||||
let config = DiagnosticsConfig::default().disable(DiagnosticCode::UndefinedFunction);
|
||||
let diagnostic_filter = &|_d: &Diagnostic| true;
|
||||
let assist_filter = &|_d: &Assist| true;
|
||||
check_filtered_ct_fix_with_config(
|
||||
|
|
@ -58,9 +56,7 @@ pub(crate) fn check_filtered_ct_fix(
|
|||
diagnostic_filter: &dyn Fn(&Diagnostic) -> bool,
|
||||
assist_filter: &dyn Fn(&Assist) -> bool,
|
||||
) {
|
||||
let config = DiagnosticsConfig::default()
|
||||
.disable(DiagnosticCode::MissingCompileWarnMissingSpec)
|
||||
.disable(DiagnosticCode::UndefinedFunction);
|
||||
let config = DiagnosticsConfig::default().disable(DiagnosticCode::UndefinedFunction);
|
||||
check_filtered_ct_fix_with_config(
|
||||
fixture_before,
|
||||
fixture_after,
|
||||
|
|
@ -126,9 +122,7 @@ pub(crate) fn check_filtered_ct_fix_with_config(
|
|||
/// * that the contents of the file containing the cursor match `after` after the diagnostic fix is applied
|
||||
#[track_caller]
|
||||
pub(crate) fn check_fix(fixture_before: &str, fixture_after: Expect) {
|
||||
let config = DiagnosticsConfig::default()
|
||||
.disable(DiagnosticCode::MissingCompileWarnMissingSpec)
|
||||
.set_experimental(true);
|
||||
let config = DiagnosticsConfig::default().set_experimental(true);
|
||||
check_nth_fix(
|
||||
0,
|
||||
fixture_before,
|
||||
|
|
@ -162,9 +156,7 @@ pub enum IncludeCodeActionAssists {
|
|||
|
||||
#[track_caller]
|
||||
pub(crate) fn check_fix_including_assists(fixture_before: &str, fixture_after: Expect) {
|
||||
let config = DiagnosticsConfig::default()
|
||||
.disable(DiagnosticCode::MissingCompileWarnMissingSpec)
|
||||
.set_experimental(true);
|
||||
let config = DiagnosticsConfig::default().set_experimental(true);
|
||||
check_nth_fix(
|
||||
0,
|
||||
fixture_before,
|
||||
|
|
@ -224,9 +216,7 @@ pub(crate) fn check_nth_fix(
|
|||
/// * that the contents of the file containing the cursor match `after` after the diagnostic fix is applied
|
||||
#[track_caller]
|
||||
pub(crate) fn check_specific_fix(assist_label: &str, fixture_before: &str, fixture_after: &str) {
|
||||
let config = DiagnosticsConfig::default()
|
||||
.disable(DiagnosticCode::MissingCompileWarnMissingSpec)
|
||||
.set_experimental(true);
|
||||
let config = DiagnosticsConfig::default().set_experimental(true);
|
||||
check_specific_fix_with_config(Some(assist_label), fixture_before, fixture_after, config);
|
||||
}
|
||||
|
||||
|
|
@ -296,9 +286,7 @@ pub(crate) fn check_specific_fix_with_config(
|
|||
|
||||
#[track_caller]
|
||||
pub(crate) fn check_diagnostics(fixture: &str) {
|
||||
let config = DiagnosticsConfig::default()
|
||||
.disable(DiagnosticCode::MissingCompileWarnMissingSpec)
|
||||
.set_experimental(true);
|
||||
let config = DiagnosticsConfig::default().set_experimental(true);
|
||||
check_diagnostics_with_config(config, fixture)
|
||||
}
|
||||
|
||||
|
|
@ -415,9 +403,7 @@ pub(crate) fn check_diagnostics_with_config_and_extra(
|
|||
|
||||
#[track_caller]
|
||||
pub fn check_no_parse_errors(analysis: &Analysis, file_id: FileId) {
|
||||
let config = DiagnosticsConfig::default()
|
||||
.disable(DiagnosticCode::MissingCompileWarnMissingSpec)
|
||||
.disable(DiagnosticCode::UndefinedFunction);
|
||||
let config = DiagnosticsConfig::default().disable(DiagnosticCode::UndefinedFunction);
|
||||
check_no_parse_errors_with_config(analysis, file_id, &config);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue