Skip to content

Commit

Permalink
Soft-deprecate update_check (#2530)
Browse files Browse the repository at this point in the history
  • Loading branch information
akx committed Feb 3, 2023
1 parent 924e35b commit 38addbe
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 128 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ruff.yaml
Expand Up @@ -138,7 +138,7 @@ jobs:
with:
target: ${{ matrix.target }}
manylinux: auto
args: --no-default-features --release --out dist
args: --release --out dist
- uses: uraimo/run-on-arch-action@v2.5.0
if: matrix.target != 'ppc64'
name: Install built wheel
Expand Down
25 changes: 0 additions & 25 deletions Cargo.lock

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

2 changes: 0 additions & 2 deletions README.md
Expand Up @@ -476,8 +476,6 @@ Miscellaneous:
The name of the file when passing it through stdin
-e, --exit-zero
Exit with status code "0", even upon detecting lint violations
--update-check
Enable or disable automatic update checks
Log levels:
-v, --verbose Enable verbose logging
Expand Down
5 changes: 0 additions & 5 deletions ruff_cli/Cargo.toml
Expand Up @@ -51,7 +51,6 @@ serde = { version = "1.0.147", features = ["derive"] }
serde_json = { version = "1.0.87" }
similar = { version = "2.2.1" }
textwrap = { version = "0.16.0" }
update-informer = { version = "0.6.0", default-features = false, features = ["pypi"], optional = true }
walkdir = { version = "2.3.2" }
strum = "0.24.1"

Expand All @@ -60,10 +59,6 @@ assert_cmd = { version = "2.0.4" }
strum = { version = "0.24.1" }
ureq = { version = "2.5.0", features = [] }

[features]
default = ["update-informer"]
update-informer = ["dep:update-informer"]

[package.metadata.maturin]
name = "ruff"
# Setting the name here is necessary for maturin to include the package in its builds.
5 changes: 3 additions & 2 deletions ruff_cli/src/args.rs
Expand Up @@ -211,11 +211,12 @@ pub struct CheckArgs {
/// Exit with status code "0", even upon detecting lint violations.
#[arg(short, long, help_heading = "Miscellaneous")]
pub exit_zero: bool,
/// Enable or disable automatic update checks.
/// Does nothing and will be removed in the future.
#[arg(
long,
overrides_with("no_update_check"),
help_heading = "Miscellaneous"
help_heading = "Miscellaneous",
hide = true
)]
update_check: bool,
#[clap(long, overrides_with("update_check"), hide = true)]
Expand Down
25 changes: 10 additions & 15 deletions ruff_cli/src/main.rs
Expand Up @@ -3,17 +3,18 @@ use std::path::PathBuf;
use std::process::ExitCode;
use std::sync::mpsc::channel;

use anyhow::Result;
use clap::{CommandFactory, Parser, Subcommand};
use colored::Colorize;
use notify::{recommended_watcher, RecursiveMode, Watcher};

use ::ruff::logging::{set_up_logging, LogLevel};
use ::ruff::resolver::PyprojectDiscovery;
use ::ruff::settings::types::SerializationFormat;
use ::ruff::settings::CliSettings;
use ::ruff::{fix, fs, warn_user_once};
use anyhow::Result;
use args::{Args, CheckArgs, Command};
use clap::{CommandFactory, Parser, Subcommand};
use colored::Colorize;
use notify::{recommended_watcher, RecursiveMode, Watcher};
use printer::{Printer, Violations};
use ruff::settings::CliSettings;

pub(crate) mod args;
mod cache;
Expand All @@ -22,8 +23,6 @@ mod diagnostics;
mod iterators;
mod printer;
mod resolve;
#[cfg(all(feature = "update-informer"))]
pub mod updates;

fn inner_main() -> Result<ExitCode> {
let mut args: Vec<_> = std::env::args_os().collect();
Expand Down Expand Up @@ -256,14 +255,10 @@ fn check(args: CheckArgs, log_level: LogLevel) -> Result<ExitCode> {
}
}

// Check for updates if we're in a non-silent log level.
#[cfg(feature = "update-informer")]
if update_check
&& !is_stdin
&& log_level >= LogLevel::Default
&& atty::is(atty::Stream::Stdout)
{
drop(updates::check_for_updates());
if update_check {
warn_user_once!(
"update-check has been removed; setting it will cause an error in a future version."
);
}

if !cli.exit_zero {
Expand Down
78 changes: 0 additions & 78 deletions ruff_cli/src/updates.rs

This file was deleted.

0 comments on commit 38addbe

Please sign in to comment.