mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 03:27:44 +00:00
commit
746a17352d
4 changed files with 19 additions and 14 deletions
2
.github/workflows/code-quality.yml
vendored
2
.github/workflows/code-quality.yml
vendored
|
@ -112,7 +112,7 @@ jobs:
|
||||||
fault_type="${{ steps.vars.outputs.FAULT_TYPE }}"
|
fault_type="${{ steps.vars.outputs.FAULT_TYPE }}"
|
||||||
fault_prefix=$(echo "$fault_type" | tr '[:lower:]' '[:upper:]')
|
fault_prefix=$(echo "$fault_type" | tr '[:lower:]' '[:upper:]')
|
||||||
# * convert any warnings to GHA UI annotations; ref: <https://help.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-a-warning-message>
|
# * convert any warnings to GHA UI annotations; ref: <https://help.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-a-warning-message>
|
||||||
S=$(cargo clippy --all-targets --features ${{ matrix.job.features }} -pcoreutils -- ${CLIPPY_FLAGS} -D warnings 2>&1) && printf "%s\n" "$S" || { printf "%s\n" "$S" ; printf "%s" "$S" | sed -E -n -e '/^error:/{' -e "N; s/^error:[[:space:]]+(.*)\\n[[:space:]]+-->[[:space:]]+(.*):([0-9]+):([0-9]+).*$/::${fault_type} file=\2,line=\3,col=\4::${fault_prefix}: \`cargo clippy\`: \1 (file:'\2', line:\3)/p;" -e '}' ; fault=true ; }
|
S=$(cargo clippy --all-targets --features ${{ matrix.job.features }} --tests -pcoreutils -- ${CLIPPY_FLAGS} -D warnings 2>&1) && printf "%s\n" "$S" || { printf "%s\n" "$S" ; printf "%s" "$S" | sed -E -n -e '/^error:/{' -e "N; s/^error:[[:space:]]+(.*)\\n[[:space:]]+-->[[:space:]]+(.*):([0-9]+):([0-9]+).*$/::${fault_type} file=\2,line=\3,col=\4::${fault_prefix}: \`cargo clippy\`: \1 (file:'\2', line:\3)/p;" -e '}' ; fault=true ; }
|
||||||
if [ -n "${{ steps.vars.outputs.FAIL_ON_FAULT }}" ] && [ -n "$fault" ]; then exit 1 ; fi
|
if [ -n "${{ steps.vars.outputs.FAIL_ON_FAULT }}" ] && [ -n "$fault" ]; then exit 1 ; fi
|
||||||
|
|
||||||
style_spellcheck:
|
style_spellcheck:
|
||||||
|
|
|
@ -22,7 +22,6 @@ allow = [
|
||||||
"Apache-2.0",
|
"Apache-2.0",
|
||||||
"ISC",
|
"ISC",
|
||||||
"BSD-2-Clause",
|
"BSD-2-Clause",
|
||||||
"BSD-2-Clause-FreeBSD",
|
|
||||||
"BSD-3-Clause",
|
"BSD-3-Clause",
|
||||||
"BSL-1.0",
|
"BSL-1.0",
|
||||||
"CC0-1.0",
|
"CC0-1.0",
|
||||||
|
|
|
@ -667,17 +667,14 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_numbered_backup_path() {
|
fn test_numbered_backup_path() {
|
||||||
assert_eq!(numbered_backup_path(&Path::new("")), PathBuf::from(".~1~"));
|
assert_eq!(numbered_backup_path(Path::new("")), PathBuf::from(".~1~"));
|
||||||
|
assert_eq!(numbered_backup_path(Path::new("/")), PathBuf::from("/.~1~"));
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
numbered_backup_path(&Path::new("/")),
|
numbered_backup_path(Path::new("/hello/world")),
|
||||||
PathBuf::from("/.~1~")
|
|
||||||
);
|
|
||||||
assert_eq!(
|
|
||||||
numbered_backup_path(&Path::new("/hello/world")),
|
|
||||||
PathBuf::from("/hello/world.~1~")
|
PathBuf::from("/hello/world.~1~")
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
numbered_backup_path(&Path::new("/hello/world/")),
|
numbered_backup_path(Path::new("/hello/world/")),
|
||||||
PathBuf::from("/hello/world.~1~")
|
PathBuf::from("/hello/world.~1~")
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -685,19 +682,19 @@ mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_simple_backup_path() {
|
fn test_simple_backup_path() {
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
simple_backup_path(&Path::new(""), ".bak"),
|
simple_backup_path(Path::new(""), ".bak"),
|
||||||
PathBuf::from(".bak")
|
PathBuf::from(".bak")
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
simple_backup_path(&Path::new("/"), ".bak"),
|
simple_backup_path(Path::new("/"), ".bak"),
|
||||||
PathBuf::from("/.bak")
|
PathBuf::from("/.bak")
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
simple_backup_path(&Path::new("/hello/world"), ".bak"),
|
simple_backup_path(Path::new("/hello/world"), ".bak"),
|
||||||
PathBuf::from("/hello/world.bak")
|
PathBuf::from("/hello/world.bak")
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
simple_backup_path(&Path::new("/hello/world/"), ".bak"),
|
simple_backup_path(Path::new("/hello/world/"), ".bak"),
|
||||||
PathBuf::from("/hello/world.bak")
|
PathBuf::from("/hello/world.bak")
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
// For the full copyright and license information, please view the LICENSE
|
// For the full copyright and license information, please view the LICENSE
|
||||||
// file that was distributed with this source code.
|
// file that was distributed with this source code.
|
||||||
|
|
||||||
// spell-checker:ignore exitstatus cmdline kworker pgrep pwait snice
|
// spell-checker:ignore exitstatus cmdline kworker pgrep pwait snice procps
|
||||||
|
|
||||||
//! Set of functions to manage IDs
|
//! Set of functions to manage IDs
|
||||||
//!
|
//!
|
||||||
|
@ -19,6 +19,15 @@
|
||||||
//! `snice` (TBD)
|
//! `snice` (TBD)
|
||||||
//!
|
//!
|
||||||
|
|
||||||
|
// This file is currently flagged as dead code, because it isn't used anywhere
|
||||||
|
// in the codebase. It may be useful in the future though, so we decide to keep
|
||||||
|
// it.
|
||||||
|
// The code was originally written in procps
|
||||||
|
// (https://github.com/uutils/procps/blob/main/src/uu/pgrep/src/process.rs)
|
||||||
|
// but was eventually moved here.
|
||||||
|
// See https://github.com/uutils/coreutils/pull/6932 for discussion.
|
||||||
|
#![allow(dead_code)]
|
||||||
|
|
||||||
use crate::features::tty::Teletype;
|
use crate::features::tty::Teletype;
|
||||||
use std::hash::Hash;
|
use std::hash::Hash;
|
||||||
use std::{
|
use std::{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue