remove preview check for rule

This commit is contained in:
dylwil3 2025-06-06 09:26:59 -05:00
parent 86ae9fbc08
commit a071114638
2 changed files with 8 additions and 17 deletions

View File

@ -65,7 +65,7 @@ use crate::docstrings::extraction::ExtractionTarget;
use crate::importer::{ImportRequest, Importer, ResolutionError}; use crate::importer::{ImportRequest, Importer, ResolutionError};
use crate::noqa::NoqaMapping; use crate::noqa::NoqaMapping;
use crate::package::PackageRoot; use crate::package::PackageRoot;
use crate::preview::{is_semantic_errors_enabled, is_undefined_export_in_dunder_init_enabled}; use crate::preview::is_semantic_errors_enabled;
use crate::registry::{AsRule, Rule}; use crate::registry::{AsRule, Rule};
use crate::rules::pyflakes::rules::{ use crate::rules::pyflakes::rules::{
LateFutureImport, ReturnOutsideFunction, YieldOutsideFunction, LateFutureImport, ReturnOutsideFunction, YieldOutsideFunction,
@ -2900,17 +2900,13 @@ impl<'a> Checker<'a> {
} }
} else { } else {
if self.enabled(Rule::UndefinedExport) { if self.enabled(Rule::UndefinedExport) {
if is_undefined_export_in_dunder_init_enabled(self.settings) self.report_diagnostic(
|| !self.path.ends_with("__init__.py") pyflakes::rules::UndefinedExport {
{ name: name.to_string(),
self.report_diagnostic( },
pyflakes::rules::UndefinedExport { range,
name: name.to_string(), )
}, .set_parent(definition.start());
range,
)
.set_parent(definition.start());
}
} }
} }
} }

View File

@ -111,11 +111,6 @@ pub(crate) const fn is_support_slices_in_literal_concatenation_enabled(
settings.preview.is_enabled() settings.preview.is_enabled()
} }
// https://github.com/astral-sh/ruff/pull/11370
pub(crate) const fn is_undefined_export_in_dunder_init_enabled(settings: &LinterSettings) -> bool {
settings.preview.is_enabled()
}
// https://github.com/astral-sh/ruff/pull/14236 // https://github.com/astral-sh/ruff/pull/14236
pub(crate) const fn is_allow_nested_roots_enabled(settings: &LinterSettings) -> bool { pub(crate) const fn is_allow_nested_roots_enabled(settings: &LinterSettings) -> bool {
settings.preview.is_enabled() settings.preview.is_enabled()