mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-02 14:52:01 +00:00
Add Python 3.14 to configuration options (#17647)
A small PR that just updates the various settings/configurations to allow Python 3.14. At the moment selecting that target version will have no impact compared to Python 3.13 - except that a warning is emitted if the user does so with `preview` disabled.
This commit is contained in:
parent
504fa20057
commit
ae7691b026
7 changed files with 32 additions and 5 deletions
|
@ -30,14 +30,14 @@ use crate::fix::{fix_file, FixResult};
|
|||
use crate::message::Message;
|
||||
use crate::noqa::add_noqa;
|
||||
use crate::package::PackageRoot;
|
||||
use crate::preview::is_unsupported_syntax_enabled;
|
||||
use crate::preview::{is_py314_support_enabled, is_unsupported_syntax_enabled};
|
||||
use crate::registry::{AsRule, Rule, RuleSet};
|
||||
#[cfg(any(feature = "test-rules", test))]
|
||||
use crate::rules::ruff::rules::test_rules::{self, TestRule, TEST_RULES};
|
||||
use crate::settings::types::UnsafeFixes;
|
||||
use crate::settings::{flags, LinterSettings};
|
||||
use crate::source_kind::SourceKind;
|
||||
use crate::{directives, fs, Locator};
|
||||
use crate::{directives, fs, warn_user_once, Locator};
|
||||
|
||||
pub struct LinterResult {
|
||||
/// A collection of diagnostic messages generated by the linter.
|
||||
|
@ -450,6 +450,11 @@ pub fn lint_only(
|
|||
source: ParseSource,
|
||||
) -> LinterResult {
|
||||
let target_version = settings.resolve_target_version(path);
|
||||
|
||||
if matches!(target_version, PythonVersion::PY314) && !is_py314_support_enabled(settings) {
|
||||
warn_user_once!("Support for Python 3.14 is under development and may be unstable. Enable `preview` to remove this warning.");
|
||||
}
|
||||
|
||||
let parsed = source.into_parsed(source_kind, source_type, target_version);
|
||||
|
||||
// Map row and column locations to byte slices (lazily).
|
||||
|
@ -559,6 +564,10 @@ pub fn lint_fix<'a>(
|
|||
|
||||
let target_version = settings.resolve_target_version(path);
|
||||
|
||||
if matches!(target_version, PythonVersion::PY314) && !is_py314_support_enabled(settings) {
|
||||
warn_user_once!("Support for Python 3.14 is under development and may be unstable. Enable `preview` to remove this warning.");
|
||||
}
|
||||
|
||||
// Continuously fix until the source code stabilizes.
|
||||
loop {
|
||||
// Parse once.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue