format: use 4-space indents in more files

Change some files which have lines whose indentation is not a multiple
of the 4 spaces specified in the editorconfig file.

Some of these changes are fixes or clear improvements (e.g. in Rust
macros which rustfmt can't format properly). Other changes don't clearly
improve the code style, and in some cases it might actually get worse.

The goal is to eventually be able to use our editorconfig for automated
style checks, but there are a lot of cases where conforming to the
limited editorconfig style spec does not make sense, so I'm not sure how
useful such automated checks can be.

Closes #12408
This commit is contained in:
Daniel Rainer
2026-02-02 18:08:40 +01:00
committed by Johannes Altmanninger
parent 1df7a8ba29
commit c5e4fed021
42 changed files with 540 additions and 481 deletions

View File

@@ -21,7 +21,7 @@ indent_size = 4
[build_tools/release.sh]
max_line_length = 72
[{Dockerfile,Vagrantfile}]
[Vagrantfile]
indent_size = 2
[share/{completions,functions}/**.fish]

View File

@@ -15,8 +15,7 @@ tmpdir=$(mktemp -d)
manifest=$tmpdir/Cargo.toml
lockfile=$tmpdir/Cargo.lock
sed "s/^version = \".*\"\$/version = \"$VERSION\"/g" Cargo.toml \
>"$manifest"
sed "s/^version = \".*\"\$/version = \"$VERSION\"/g" Cargo.toml >"$manifest"
awk -v version=$VERSION '
/^name = "fish"$/ { ok=1 }
ok == 1 && /^version = ".*"$/ {

View File

@@ -51,9 +51,10 @@ endif()
add_feature_info(Documentation WITH_DOCS "user manual and documentation")
if(WITH_DOCS)
add_custom_target(doc ALL
DEPENDS sphinx-docs sphinx-manpages)
add_custom_target(doc ALL DEPENDS sphinx-docs sphinx-manpages)
# Group docs targets into a DocsTargets folder
set_property(TARGET doc sphinx-docs sphinx-manpages
PROPERTY FOLDER cmake/DocTargets)
set_property(
TARGET doc sphinx-docs sphinx-manpages
PROPERTY FOLDER cmake/DocTargets
)
endif()

View File

@@ -14,21 +14,25 @@ set(rel_completionsdir "fish/vendor_completions.d")
set(rel_functionsdir "fish/vendor_functions.d")
set(rel_confdir "fish/vendor_conf.d")
set(extra_completionsdir
"${datadir}/${rel_completionsdir}"
CACHE STRING "Path for extra completions")
set(
extra_completionsdir "${datadir}/${rel_completionsdir}"
CACHE STRING "Path for extra completions"
)
set(extra_functionsdir
"${datadir}/${rel_functionsdir}"
CACHE STRING "Path for extra functions")
set(
extra_functionsdir "${datadir}/${rel_functionsdir}"
CACHE STRING "Path for extra functions"
)
set(extra_confdir
"${datadir}/${rel_confdir}"
CACHE STRING "Path for extra configuration")
set(
extra_confdir "${datadir}/${rel_confdir}"
CACHE STRING "Path for extra configuration"
)
# These are the man pages that go in system manpath; all manpages go in the fish-specific manpath.
set(MANUALS ${SPHINX_OUTPUT_DIR}/man/man1/fish.1
set(MANUALS
${SPHINX_OUTPUT_DIR}/man/man1/fish.1
${SPHINX_OUTPUT_DIR}/man/man1/fish_indent.1
${SPHINX_OUTPUT_DIR}/man/man1/fish_key_reader.1
${SPHINX_OUTPUT_DIR}/man/man1/fish-doc.1
@@ -67,16 +71,25 @@ function(FISH_TRY_CREATE_DIRS)
else()
set(abs_dir "\$ENV{DESTDIR}${dir}")
endif()
install(SCRIPT CODE "EXECUTE_PROCESS(COMMAND mkdir -p ${abs_dir} OUTPUT_QUIET ERROR_QUIET)
install(SCRIPT CODE "
EXECUTE_PROCESS(COMMAND mkdir -p ${abs_dir} OUTPUT_QUIET ERROR_QUIET)
execute_process(COMMAND chmod 755 ${abs_dir} OUTPUT_QUIET ERROR_QUIET)
")
endforeach()
endfunction(FISH_TRY_CREATE_DIRS)
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/fish
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ
GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
DESTINATION ${bindir})
install(
PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/fish
PERMISSIONS
OWNER_READ
OWNER_WRITE
OWNER_EXECUTE
GROUP_READ
GROUP_EXECUTE
WORLD_READ
WORLD_EXECUTE
DESTINATION ${bindir}
)
if(NOT IS_ABSOLUTE ${bindir})
set(abs_bindir "\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${bindir}")
@@ -90,87 +103,116 @@ fish_create_dirs(${sysconfdir}/fish/conf.d ${sysconfdir}/fish/completions
${sysconfdir}/fish/functions)
install(FILES etc/config.fish DESTINATION ${sysconfdir}/fish/)
fish_create_dirs(${rel_datadir}/fish ${rel_datadir}/fish/completions
fish_create_dirs(
${rel_datadir}/fish ${rel_datadir}/fish/completions
${rel_datadir}/fish/functions
${rel_datadir}/fish/man/man1 ${rel_datadir}/fish/tools
${rel_datadir}/fish/tools/web_config
${rel_datadir}/fish/tools/web_config/js
${rel_datadir}/fish/prompts
${rel_datadir}/fish/themes
)
)
configure_file(share/__fish_build_paths.fish.in share/__fish_build_paths.fish)
install(FILES share/config.fish
${CMAKE_CURRENT_BINARY_DIR}/share/__fish_build_paths.fish
DESTINATION ${rel_datadir}/fish)
DESTINATION ${rel_datadir}/fish
)
# Create only the vendor directories inside the prefix (#5029 / #6508)
fish_create_dirs(${rel_datadir}/fish/vendor_completions.d ${rel_datadir}/fish/vendor_functions.d
${rel_datadir}/fish/vendor_conf.d)
fish_create_dirs(
${rel_datadir}/fish/vendor_completions.d
${rel_datadir}/fish/vendor_functions.d
${rel_datadir}/fish/vendor_conf.d
)
fish_try_create_dirs(${rel_datadir}/pkgconfig)
configure_file(fish.pc.in fish.pc.noversion @ONLY)
add_custom_command(OUTPUT fish.pc
add_custom_command(
OUTPUT fish.pc
COMMAND sed '/Version/d' fish.pc.noversion > fish.pc
COMMAND printf "Version: " >> fish.pc
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/build_tools/git_version_gen.sh >> fish.pc
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/fish.pc.noversion)
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/fish.pc.noversion
)
add_custom_target(build_fish_pc ALL DEPENDS fish.pc)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/fish.pc
DESTINATION ${rel_datadir}/pkgconfig)
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/fish.pc
DESTINATION ${rel_datadir}/pkgconfig
)
install(DIRECTORY share/completions/
install(
DIRECTORY share/completions/
DESTINATION ${rel_datadir}/fish/completions
FILES_MATCHING PATTERN "*.fish")
FILES_MATCHING PATTERN "*.fish"
)
install(DIRECTORY share/functions/
install(
DIRECTORY share/functions/
DESTINATION ${rel_datadir}/fish/functions
FILES_MATCHING PATTERN "*.fish")
FILES_MATCHING PATTERN "*.fish"
)
install(DIRECTORY share/prompts/
install(
DIRECTORY share/prompts/
DESTINATION ${rel_datadir}/fish/prompts
FILES_MATCHING PATTERN "*.fish")
FILES_MATCHING PATTERN "*.fish"
)
install(DIRECTORY share/themes/
install(
DIRECTORY share/themes/
DESTINATION ${rel_datadir}/fish/themes
FILES_MATCHING PATTERN "*.theme")
FILES_MATCHING PATTERN "*.theme"
)
# CONDEMNED_PAGE is managed by the conditional above
# Building the man pages is optional: if sphinx isn't installed, they're not built
install(DIRECTORY ${SPHINX_OUTPUT_DIR}/man/man1/
install(
DIRECTORY ${SPHINX_OUTPUT_DIR}/man/man1/
DESTINATION ${rel_datadir}/fish/man/man1
FILES_MATCHING
PATTERN "*.1"
PATTERN ${CONDEMNED_PAGE} EXCLUDE)
PATTERN ${CONDEMNED_PAGE} EXCLUDE
)
install(PROGRAMS share/tools/create_manpage_completions.py
DESTINATION ${rel_datadir}/fish/tools/)
install(
PROGRAMS share/tools/create_manpage_completions.py
DESTINATION ${rel_datadir}/fish/tools/
)
install(DIRECTORY share/tools/web_config
install(
DIRECTORY share/tools/web_config
DESTINATION ${rel_datadir}/fish/tools/
FILES_MATCHING
PATTERN "*.png"
PATTERN "*.css"
PATTERN "*.html"
PATTERN "*.py"
PATTERN "*.js")
PATTERN "*.js"
)
# Building the man pages is optional: if Sphinx isn't installed, they're not built
install(FILES ${MANUALS} DESTINATION ${mandir}/man1/ OPTIONAL)
install(DIRECTORY ${SPHINX_OUTPUT_DIR}/html/ # Trailing slash is important!
DESTINATION ${docdir} OPTIONAL)
install(
DIRECTORY ${SPHINX_OUTPUT_DIR}/html/ # Trailing slash is important!
DESTINATION ${docdir} OPTIONAL
)
install(FILES CHANGELOG.rst DESTINATION ${docdir})
# Group install targets into a InstallTargets folder
set_property(TARGET build_fish_pc
PROPERTY FOLDER cmake/InstallTargets)
set_property(
TARGET build_fish_pc
PROPERTY FOLDER cmake/InstallTargets
)
# Make a target build_root that installs into the buildroot directory, for testing.
set(BUILDROOT_DIR ${CMAKE_CURRENT_BINARY_DIR}/buildroot)
add_custom_target(build_root
add_custom_target(
build_root
COMMAND DESTDIR=${BUILDROOT_DIR} ${CMAKE_COMMAND}
--build ${CMAKE_CURRENT_BINARY_DIR} --target install)
--build ${CMAKE_CURRENT_BINARY_DIR} --target install
)

View File

@@ -1,5 +1,6 @@
set(FISH_USE_SYSTEM_PCRE2 ON CACHE BOOL
"Try to use PCRE2 from the system, instead of the pcre2-sys version")
"Try to use PCRE2 from the system, instead of the pcre2-sys version"
)
if(FISH_USE_SYSTEM_PCRE2)
message(STATUS "Trying to use PCRE2 from the system")

View File

@@ -30,14 +30,20 @@ if(DEFINED ASAN)
# Rust w/ -Zsanitizer=address requires explicitly specifying the --target triple or else linker
# errors pertaining to asan symbols will ensue.
if(NOT DEFINED Rust_CARGO_TARGET)
message(FATAL_ERROR "ASAN requires defining the CMake variable Rust_CARGO_TARGET to the
intended target triple")
message(
FATAL_ERROR
"ASAN requires defining the CMake variable Rust_CARGO_TARGET to the
intended target triple"
)
endif()
endif()
if(DEFINED TSAN)
if(NOT DEFINED Rust_CARGO_TARGET)
message(FATAL_ERROR "TSAN requires defining the CMake variable Rust_CARGO_TARGET to the
intended target triple")
message(
FATAL_ERROR
"TSAN requires defining the CMake variable Rust_CARGO_TARGET to the
intended target triple"
)
endif()
endif()
@@ -55,8 +61,8 @@ endif()
add_custom_target(fish_run_tests
# TODO: This should be replaced with a unified solution, possibly build_tools/check.sh.
COMMAND ${CMAKE_SOURCE_DIR}/tests/test_driver.py ${max_concurrency_flag} ${CMAKE_CURRENT_BINARY_DIR}
COMMAND env ${VARS_FOR_CARGO}
${Rust_CARGO}
COMMAND
env ${VARS_FOR_CARGO} ${Rust_CARGO}
test
--no-default-features
--features=${FISH_CARGO_FEATURES}

View File

@@ -4,20 +4,25 @@ complete -c ansible-galaxy -s h -l help -d "Show help message"
complete -c ansible-galaxy -n __fish_use_subcommand -s v -l verbose -d "Verbose mode (-vvv for more, -vvvv for connection debugging)"
# first subcommand
complete -c ansible-galaxy -n __fish_use_subcommand -xa "collection\t'Manage a collection'
role\t'Manage a role'"
complete -c ansible-galaxy -n __fish_use_subcommand -xa "
collection\t'Manage a collection'
role\t'Manage a role'
"
# second subcommand (for collection)
complete -c ansible-galaxy -n '__fish_seen_subcommand_from collection' -a "download\t'Download collections as tarball'
complete -c ansible-galaxy -n '__fish_seen_subcommand_from collection' -a "
download\t'Download collections as tarball'
init\t'Initialize new collection with the base structure'
build\t'Build collection artifact that can be published'
publish\t'Publish collection artifact to Ansible Galaxy'
install\t'Install collections'
list\t'Show collections installed'
verify\t'Compare checksums of local and remote collections'"
verify\t'Compare checksums of local and remote collections'
"
# second subcommand (for role)
complete -c ansible-galaxy -n '__fish_seen_subcommand_from role' -a "init\t'Initialize new role with the base structure'
complete -c ansible-galaxy -n '__fish_seen_subcommand_from role' -a "
init\t'Initialize new role with the base structure'
remove\t'Delete roles from roles_path'
delete\t'Removes the role from Galaxy'
list\t'Show roles installed'
@@ -25,4 +30,5 @@ complete -c ansible-galaxy -n '__fish_seen_subcommand_from role' -a "init\t'Init
import\t'Import role into a galaxy server'
setup\t'Manage integration between Galaxy and the given source'
info\t'View details about a role'
install\t'Install roles'"
install\t'Install roles'
"

View File

@@ -1,3 +1 @@
complete -c dvipdf -k -x -a "(
__fish_complete_suffix .dvi
)"
complete -c dvipdf -k -x -a "(__fish_complete_suffix .dvi)"

View File

@@ -1,4 +1 @@
complete -c dvipdfm -k -x -a "
(
__fish_complete_suffix .dvi
)"
complete -c dvipdfm -k -x -a "(__fish_complete_suffix .dvi)"

View File

@@ -1469,11 +1469,13 @@ complete -f -c git -n '__fish_git_using_command commit' -l fixup -d 'Fixup commi
complete -f -c git -n '__fish_git_using_command commit' -l squash -d 'Squash commit to be used with rebase --autosquash'
complete -c git -n '__fish_git_using_command commit' -l reset-author -d 'When amending, reset author of commit to the committer'
complete -x -c git -n '__fish_git_using_command commit' -l author -d 'Override the commit author'
complete -x -c git -n '__fish_git_using_command commit' -l cleanup -a "strip\t'Leading/trailing whitespace/empty lines, #commentary'
complete -x -c git -n '__fish_git_using_command commit' -l cleanup -a "
strip\t'Leading/trailing whitespace/empty lines, #commentary'
whitespace\t'Like strip but keep #commentary'
verbatim\t'Do not change the message'
scissors\t'Like whitespace but also remove after scissor lines'
default\t'Like strip if the message is to be edited, whitespace otherwise'" -d 'How to clean up the commit message'
default\t'Like strip if the message is to be edited, whitespace otherwise'
" -d 'How to clean up the commit message'
complete -x -c git -n '__fish_git_using_command commit' -l date -d 'Override the author date'
complete -x -c git -n '__fish_git_using_command commit' -s m -l message -d 'Use the given message as the commit message'
complete -f -c git -n '__fish_git_using_command commit' -l no-edit -d 'Use the selected commit message without launching an editor'

View File

@@ -19,9 +19,13 @@ complete -c mtr -s p -l split -d 'Split output'
complete -c mtr -s n -l no-dns -d 'Do not resolve host names'
complete -c mtr -s b -l show-ips -d 'Show IP numbers and host names'
complete -c mtr -s o -l order -d 'Select output fields' -x
complete -c mtr -s y -l ipinfo -d 'Select IP information in output' -x -a \
'0\t"AS number" 1\t"IP prefix" 2\t"Country code" 3\t"RIR organization"\
4\t"Allocation date of the IP prefix"'
complete -c mtr -s y -l ipinfo -d 'Select IP information in output' -x -a '
0\t"AS number"
1\t"IP prefix"
2\t"Country code"
3\t"RIR organization"
4\t"Allocation date of the IP prefix"
'
complete -c mtr -s z -l aslookup -d 'Display AS number'
complete -c mtr -s i -l interval -d 'ICMP echo request interval (sec)' -x
complete -c mtr -s c -l report-cycles -d 'Set the number of pings sent' -x

View File

@@ -3,15 +3,16 @@ set -l uname (uname -s)
## GNU mv
if mv --version >/dev/null 2>/dev/null
# --backup requires an argument, -b does not accept an argument
complete -c mv -l backup -r -d "Backup each existing destination file" \
-x -ka "none\t'Never make backups'
complete -c mv -l backup -r -d "Backup each existing destination file" -x -ka "
none\t'Never make backups'
off\t'Never make backups'
numbered\t'Make numbered backups'
t\t'Make numbered backups'
existing\t'Numbered backups if any exist, else simple'
nil\t'Numbered backups if any exist, else simple'
simple\t'Make simple backups'
never\t'Make simple backups'"
never\t'Make simple backups'
"
complete -c mv -s b -d "Backup each existing destination file"
complete -c mv -s f -l force -d "Don't prompt to overwrite"
complete -c mv -s i -l interactive -d "Prompt to overwrite"

View File

@@ -1,3 +1 @@
complete -c ps2pdf -k -x -a "(
__fish_complete_suffix .ps
)"
complete -c ps2pdf -k -x -a "(__fish_complete_suffix .ps)"

View File

@@ -35,7 +35,8 @@ complete -x -c string -n "test (count (commandline -xpc)) -ge 2" -n "contains --
(printf '%s\t%s\n' script 'For use in scripts' \
var 'For use as a variable name' \
regex 'For string match -r, string replace -r' \
url 'For use as a URL')"
url 'For use as a URL')
"
complete -f -c string -n "test (count (commandline -xpc)) -lt 2" -a match
complete -f -c string -n "test (count (commandline -xpc)) -ge 2" -n "contains -- (commandline -xpc)[2] match" -s n -l index -d "Report index, length of match"
complete -f -c string -n "test (count (commandline -xpc)) -ge 2" -n "contains -- (commandline -xpc)[2] match" -s v -l invert -d "Report only non-matches"

View File

@@ -14,8 +14,9 @@ complete -c update-eix-remote -s o -d "Use the given PATH as $OVERLAYPARENT"
# Subcommands
set -l subcmds "
"
complete -c update-eix-remote -xa \
'update\t"Fetch the eix-caches of some layman overlays into a temporary file resp. into FILE and add them to the eix database"
complete -c update-eix-remote -xa '
update\t"Fetch the eix-caches of some layman overlays into a temporary file resp. into FILE and add them to the eix database"
fetch\t"Only fetch the overlays into FILE"
add\t"Only add the overlays from FILE to the eix database"
remove\t"Remove all temporarily added virtual overlays from the eix database"'
remove\t"Remove all temporarily added virtual overlays from the eix database"
'

View File

@@ -658,8 +658,7 @@ pub fn read(parser: &Parser, streams: &mut IoStreams, argv: &mut [&wstr]) -> Bui
// if we're chunking we could get multiple lines so we would have to advance
// more than 1 per run through the loop. Let's skip that for now.
!opts.one_line &&
(
streams.stdin_is_directly_redirected ||
(streams.stdin_is_directly_redirected ||
unsafe {libc::lseek(streams.stdin_fd(), 0, SEEK_CUR)} != -1)
{
// We read in chunks when we either can seek (so we put the bytes back),

View File

@@ -758,9 +758,12 @@ pub fn parse_args(
if !parser.errors.is_empty() {
err.push_utfstr(&parser.errors[0]);
} else {
sprintf!(=> err, "unexpected argument at index %u: '%s'",
sprintf!(
=> err,
"unexpected argument at index %u: '%s'",
result.as_ref().unwrap().range().end + 1,
args[result.as_ref().unwrap().range().end]);
args[result.as_ref().unwrap().range().end],
);
}
err.push('\n');
err.push_utfstr(&commandline);