diff --git a/GNUmakefile b/GNUmakefile index 367568ca8..12cd95013 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -47,12 +47,12 @@ BUSYBOX_VER := 1.32.1 BUSYBOX_SRC := $(BUSYBOX_ROOT)/busybox-$(BUSYBOX_VER) ifeq ($(SELINUX_ENABLED),) - SELINUX_ENABLED := 0 - ifneq ($(OS),Windows_NT) - ifeq ($(shell /sbin/selinuxenabled 2>/dev/null ; echo $$?),0) - SELINUX_ENABLED := 1 - endif - endif + SELINUX_ENABLED := 0 + ifneq ($(OS),Windows_NT) + ifeq ($(shell /sbin/selinuxenabled 2>/dev/null ; echo $$?),0) + SELINUX_ENABLED := 1 + endif + endif endif # Possible programs @@ -161,11 +161,11 @@ SELINUX_PROGS := \ runcon ifneq ($(OS),Windows_NT) - PROGS := $(PROGS) $(UNIX_PROGS) + PROGS := $(PROGS) $(UNIX_PROGS) endif ifeq ($(SELINUX_ENABLED),1) - PROGS := $(PROGS) $(SELINUX_PROGS) + PROGS := $(PROGS) $(SELINUX_PROGS) endif UTILS ?= $(PROGS) diff --git a/src/uu/head/BENCHMARKING.md b/src/uu/head/BENCHMARKING.md index 49574eb79..29ce4c46b 100644 --- a/src/uu/head/BENCHMARKING.md +++ b/src/uu/head/BENCHMARKING.md @@ -20,7 +20,7 @@ and most other parts of the world. This particular file has about 170,000 lines, each of which is no longer than 96 characters: - $ wc -lL shakespeare.txt + $ wc -lL shakespeare.txt 170592 96 shakespeare.txt You could use files of different shapes and sizes to test the diff --git a/src/uu/nl/Cargo.toml b/src/uu/nl/Cargo.toml index f9e2cfc55..a225453f0 100644 --- a/src/uu/nl/Cargo.toml +++ b/src/uu/nl/Cargo.toml @@ -29,4 +29,4 @@ name = "nl" path = "src/main.rs" [package.metadata.cargo-udeps.ignore] -normal = ["uucore_procs"] \ No newline at end of file +normal = ["uucore_procs"] diff --git a/src/uu/numfmt/Cargo.toml b/src/uu/numfmt/Cargo.toml index 29313350f..4396285bc 100644 --- a/src/uu/numfmt/Cargo.toml +++ b/src/uu/numfmt/Cargo.toml @@ -24,4 +24,4 @@ name = "numfmt" path = "src/main.rs" [package.metadata.cargo-udeps.ignore] -normal = ["uucore_procs"] \ No newline at end of file +normal = ["uucore_procs"] diff --git a/src/uu/rm/src/rm.rs b/src/uu/rm/src/rm.rs index 86a971085..3183b0ac0 100644 --- a/src/uu/rm/src/rm.rs +++ b/src/uu/rm/src/rm.rs @@ -217,7 +217,7 @@ pub fn uu_app() -> App<'static, 'static> { // This is solely for testing. // Do not document. // It is relatively difficult to ensure that there is a tty on stdin. - // Since rm acts differently depending on that, without this option, + // Since rm acts differently depending on that, without this option, // it'd be harder to test the parts of rm that depend on that setting. .arg( Arg::with_name(PRESUME_INPUT_TTY) diff --git a/src/uucore/src/lib/mods/backup_control.rs b/src/uucore/src/lib/mods/backup_control.rs index acb7342b7..167c51386 100644 --- a/src/uucore/src/lib/mods/backup_control.rs +++ b/src/uucore/src/lib/mods/backup_control.rs @@ -56,7 +56,7 @@ //! .get_matches_from(vec![ //! "app", "--backup=t", "--suffix=bak~" //! ]); -//! +//! //! let backup_mode = match backup_control::determine_backup_mode(&matches) { //! Err(e) => { //! show!(e); @@ -321,7 +321,7 @@ pub fn determine_backup_suffix(matches: &ArgMatches) -> String { /// .get_matches_from(vec![ /// "app", "-b", "--backup=n" /// ]); -/// +/// /// let backup_mode = backup_control::determine_backup_mode(&matches); /// /// assert!(backup_mode.is_err()); diff --git a/tests/by-util/test_sort.rs b/tests/by-util/test_sort.rs index 9b1b4dfb5..76095ff76 100644 --- a/tests/by-util/test_sort.rs +++ b/tests/by-util/test_sort.rs @@ -340,10 +340,10 @@ fn test_dictionary_order() { fn test_dictionary_order2() { for non_dictionary_order2_param in &["-d"] { new_ucmd!() - .pipe_in("a👦🏻aa b\naaaa b") // spell-checker:disable-line + .pipe_in("a👦🏻aa\tb\naaaa\tb") // spell-checker:disable-line .arg(non_dictionary_order2_param) // spell-checker:disable-line .succeeds() - .stdout_only("a👦🏻aa b\naaaa b\n"); // spell-checker:disable-line + .stdout_only("a👦🏻aa\tb\naaaa\tb\n"); // spell-checker:disable-line } } diff --git a/util/test-repo-whitespace.BAT b/util/test-repo-whitespace.BAT index c63415295..6e2fce557 100644 --- a/util/test-repo-whitespace.BAT +++ b/util/test-repo-whitespace.BAT @@ -1,19 +1,21 @@ @setLocal @echo off -:: `test-repo-whitespace [DIR]...` +:: `test-repo-whitespace [DIR]...` v2022.01.01 :: style inspector ~ whitespace: find nonconforming files in repository -:: Copyright (C) 2016-2020 ~ Roy Ivy III +:: Copyright (C) 2016-2022 ~ Roy Ivy III :: License: MIT/Apache-2.0 (see https://opensource.org/licenses/Apache-2.0 , https://opensource.org/licenses/MIT) :: * this software is provided for free, WITHOUT ANY EXPRESS OR IMPLIED WARRANTY (see the license for details) -:: spell-checker:ignore (ignore) CTYPE POSIX RETval RETvar akefile makefile makefiles multiline :: spell-checker:ignore (shell/cmd) COMSPEC ERRORLEVEL +:: spell-checker:ignore () CTYPE POSIX Tval Tvar akefile makefile makefiles multiline testdata :config -set "_exclude_dir=(?i)[_.#]build|[.]git|[.]gpg|[.]vs|fixtures|vendor" -set "_exclude=(?i)[.](cache|dll|exe|gif|gz|zip)$" +set "_exclude_dirs_rx=(?i)[_.#]build|[.]git|[.]gpg|[.]obj|[.]vs|fixtures|node_modules|target|testdata|test-resources|vendor" +set "_exclude_files_rx=(?i)[.](cache|dll|exe|gif|gz|ico|png|zip)$" +set "_crlf_files_rx=(?i)[.](bat|cmd|csv)$" +set "_tabbed_files_rx=(?i)^^(.*[.]go|go[.](mod|sum)|(GNU)?[Mm]akefile([.].*)?)$" :config_done set _dp0=%~dp0. @@ -34,36 +36,36 @@ if /i "%LC_CTYPE%"=="posix" (set "LC_CTYPE=C") &:: `pcregrep` doesn't understand set "ERRORLEVEL=" set "ERROR=" :: 1. Test for TABs within leading whitespace (except go files makefiles) -"%PCREGREP%" -I --exclude-dir "%_exclude_dir%" --exclude "%_exclude%" --exclude "(?i)[.]go$" --exclude "go[.](mod|sum)" --exclude "(GNU)?[Mm]akefile([.].*)?" --count --files-with-matches --recursive "^\s*\t" %dirs% +"%PCREGREP%" -I --exclude-dir "%_exclude_dirs_rx%" --exclude "%_exclude_files_rx%" --exclude "%_tabbed_files_rx%" --count --files-with-matches --recursive "^\s*\t" %dirs% if NOT "%ERRORLEVEL%" == "1" ( set ERROR=1 & echo ERROR: files found with TABs within leading whitespace [file:#lines_matched]) :: 2. Test for lines with internal TABs -"%PCREGREP%" -I --exclude-dir "%_exclude_dir%" --exclude "%_exclude%" --count --files-with-matches --recursive "^.*[^\t]\t" %dirs% +"%PCREGREP%" -I --exclude-dir "%_exclude_dirs_rx%" --exclude "%_exclude_files_rx%" --count --files-with-matches --recursive "^.*[^\t]\t" %dirs% if NOT "%ERRORLEVEL%" == "1" ( set ERROR=1 & echo ERROR: files found with lines containing internal TABs [file:#lines_matched]) :: 3. Test that makefiles have ONLY initial-TAB leading whitespace -"%PCREGREP%" -I --exclude-dir "%_exclude_dir%" --include "(GNU)?[Mm]akefile([.].*)?" --exclude "[.](to|y)ml$" --recursive --line-number --invert-match "^([\t]\s*\S|\S|$)" %dirs% +"%PCREGREP%" -I --exclude-dir "%_exclude_dirs_rx%" --include "(GNU)?[Mm]akefile([.].*)?" --exclude "[.](to|y)ml$" --recursive --line-number --invert-match "^([\t]\s*\S|\S|$)" %dirs% if NOT "%ERRORLEVEL%" == "1" ( set ERROR=1 & echo ERROR: Makefiles found with lines having non-TAB leading whitespace [file:line_number]) :: 4. Test for non-LF line endings set "HAVE_NonLF_ERROR=" -"%PCREGREP%" --buffer-size=1M -I --exclude-dir "%_exclude_dir%" --exclude "%_exclude%" -NLF --files-with-matches --multiline --recursive "\r[^\n]" %dirs% +"%PCREGREP%" --buffer-size=1M -I --exclude-dir "%_exclude_dirs_rx%" --exclude "%_exclude_files_rx%" -NLF --files-with-matches --multiline --recursive "\r[^\n]" %dirs% if NOT "%ERRORLEVEL%" == "1" ( set HAVE_NonLF_ERROR=1 & echo ## files found with CR line endings) -"%PCREGREP%" --buffer-size=1M -I --exclude-dir "%_exclude_dir%" --exclude "%_exclude%" --exclude "(?i)\.bat$|\.cmd$" -NLF --files-with-matches --multiline --recursive "\r\n" %dirs% +"%PCREGREP%" --buffer-size=1M -I --exclude-dir "%_exclude_dirs_rx%" --exclude "%_exclude_files_rx%" --exclude "%_crlf_files_rx%" -NLF --files-with-matches --multiline --recursive "\r\n" %dirs% if NOT "%ERRORLEVEL%" == "1" ( set HAVE_NonLF_ERROR=1 & echo ## files found with CRLF line endings) if DEFINED HAVE_NonLF_ERROR ( set ERROR=1 & echo ERROR: files found with non-LF line endings) :: 5. Test for files without trailing newline -:: "%PCREGREP%" -I --exclude-dir "%_exclude_dir%" --exclude "%_exclude%" --files-without-match --multiline --recursive "\r?[\r\n]\z" %dirs% -"%PCREGREP%" -I --exclude-dir "%_exclude_dir%" --exclude "%_exclude%" --files-with-matches --multiline --recursive "\z" %dirs% +:: "%PCREGREP%" -I --exclude-dir "%_exclude_dirs_rx%" --exclude "%_exclude_files_rx%" --files-without-match --multiline --recursive "\r?[\r\n]\z" %dirs% +"%PCREGREP%" -I --exclude-dir "%_exclude_dirs_rx%" --exclude "%_exclude_files_rx%" --files-with-matches --multiline --recursive "\z" %dirs% if NOT "%ERRORLEVEL%" == "1" ( set ERROR=1 & echo ERROR: files found without trailing newline) :: 6. Test for files with lines having trailing whitespace -"%PCREGREP%" -I --exclude-dir "%_exclude_dir%" --exclude "%_exclude%" --recursive --line-number "\s$" %dirs% +"%PCREGREP%" -I --exclude-dir "%_exclude_dirs_rx%" --exclude "%_exclude_files_rx%" --recursive --line-number "\s$" %dirs% if NOT "%ERRORLEVEL%" == "1" ( set ERROR=1 & echo ERROR: files found with lines having trailing whitespace [file:line_number]) :: 7. Test for files with BOM -"%PCREGREP%" -I --exclude-dir "%_exclude_dir%" --exclude "%_exclude%" --files-with-matches --multiline --recursive "\A[\xEF][\xBB][\xBF]" %dirs% +"%PCREGREP%" -I --exclude-dir "%_exclude_dirs_rx%" --exclude "%_exclude_files_rx%" --files-with-matches --multiline --recursive "\A[\xEF][\xBB][\xBF]" %dirs% if NOT "%ERRORLEVEL%" == "1" ( set ERROR=1 & echo ERROR: files found with leading BOM) :script_done