Mostly line breaks, one instance of tabs!

For some reason clang-format insists on two spaces before a same-line comment?

(I continue to be unimpressed with super-strict line length limits,
but I continue to believe in automatic styling, so it is what it is)

[ci skip]
This commit is contained in:
Fabian Homborg 2020-02-17 14:12:27 +01:00
parent 4cefcd4327
commit 65883e0e40
11 changed files with 44 additions and 31 deletions

View File

@ -117,7 +117,7 @@ class RunCmd(object):
class TestFailure(object):
def __init__(self, line, check, testrun, after = None):
def __init__(self, line, check, testrun, after=None):
self.line = line
self.check = check
self.testrun = testrun
@ -185,7 +185,7 @@ class TestFailure(object):
fmtstrs += [
" additional output:",
" {BOLD}{additional_output}{RESET}",
]
]
fmtstrs += [" when running command:", " {subbed_command}"]
return "\n".join(fmtstrs).format(**fields)
@ -243,7 +243,14 @@ class TestRun(object):
# Failed to match.
lineq.pop()
# Add context, ignoring empty lines.
return TestFailure(line, check, self, after = [line.text for line in lineq[::-1] if not line.is_empty_space()])
return TestFailure(
line,
check,
self,
after=[
line.text for line in lineq[::-1] if not line.is_empty_space()
],
)
# Drain empties.
while lineq and lineq[-1].is_empty_space():
lineq.pop()
@ -440,14 +447,15 @@ def get_argparse():
parser.add_argument(
"-p",
"--progress",
action='store_true',
dest='progress',
action="store_true",
dest="progress",
help="Show the files to be checked",
default=False,
)
parser.add_argument("file", nargs="+", help="File to check")
parser.add_argument(
"-A", "--after",
"-A",
"--after",
type=int,
help="How many non-empty lines of output after a failure to print (default: 5)",
action="store",
@ -471,7 +479,7 @@ def main():
for path in args.file:
fields["path"] = path
if config.progress:
print("Testing file {path} ... ".format(**fields), end='')
print("Testing file {path} ... ".format(**fields), end="")
subs = def_subs.copy()
subs["s"] = path
if not check_path(path, subs, config, TestFailure.print_message):

View File

@ -1,9 +1,9 @@
function __fish_get_vmctl_vms
for line in (vmctl status | string match -e -v "MAXMEM");
set a (string split " " $line)
and printf "%s " $a[-1]
end
for line in (vmctl status | string match -e -v "MAXMEM")
set a (string split " " $line)
and printf "%s " $a[-1]
end
end
complete -c vmctl -xa 'console create load log reload reset start status stop pause unpause send receive' -n 'not __fish_seen_subcommand_from list console create load log reload reset start status stop pause unpause send receive'

View File

@ -5,13 +5,13 @@ function __fish_complete_gpg_key_id -d 'Complete using gpg key ids' -a __fish_co
set -l keyid
$__fish_complete_gpg_command --list-keys --with-colons | while read garbage
switch $garbage
# Extract user ids (note: gpg escapes colons as '\x3a')
case "uid*"
# Extract user ids (note: gpg escapes colons as '\x3a')
set -l __uid (string split ":" -- $garbage)
set uid (string replace -a '\x3a' ':' -- $__uuid[10])
printf "%s\t%s\n" $keyid $uid
# Extract key fingerprints (no subkeys)
case "pub*"
# Extract key fingerprints (no subkeys)
set -l __pub (string split ":" -- $garbage)
set keyid $__pub[5]
end

View File

@ -8,11 +8,11 @@ function __fish_make_completion_signals --description 'Make list of kill signals
# Just hardcode the signals.
if uname | string match -q 'CYGWIN*'
set -a __kill_signals "1 HUP" "2 INT" "3 QUIT" "4 ILL" "5 TRAP" "6 ABRT" \
"6 IOT" "7 BUS" "8 FPE" "9 KILL" "10 USR1" "11 SEGV" \
"12 USR2" "13 PIPE" "14 ALRM" "15 TERM" "16 STKFLT" "17 CHLD" \
"17 CLD" "18 CONT" "19 STOP" "20 TSTP" "21 TTIN" "22 TTOU" \
"23 URG" "24 XCPU" "25 XFSZ" "26 VTALRM" "27 PROF" "28 WINC" \
"29 IO" "29 POLL" "30 PWR" "31 SYS" "34 RTMIN" "64 RTMA"
"6 IOT" "7 BUS" "8 FPE" "9 KILL" "10 USR1" "11 SEGV" \
"12 USR2" "13 PIPE" "14 ALRM" "15 TERM" "16 STKFLT" "17 CHLD" \
"17 CLD" "18 CONT" "19 STOP" "20 TSTP" "21 TTIN" "22 TTOU" \
"23 URG" "24 XCPU" "25 XFSZ" "26 VTALRM" "27 PROF" "28 WINC" \
"29 IO" "29 POLL" "30 PWR" "31 SYS" "34 RTMIN" "64 RTMA"
return
end

View File

@ -1,5 +1,5 @@
function __fish_print_encodings -d "Complete using available character encodings"
if iconv --usage &>/dev/null # only GNU has this flag
if iconv --usage &>/dev/null # only GNU has this flag
# Note: GNU iconv changes its output to contain the forward slashes below when stdout is not a tty.
iconv --list | string replace -ra '//' ''
else # non-GNU

View File

@ -1478,7 +1478,7 @@ url = "http://localhost:%d/%s/%s" % (PORT, authkey, initial_tab)
# Create temporary file to hold redirect to real server. This prevents exposing
# the URL containing the authentication key on the command line (see
# CVE-2014-2914 or https://github.com/fish-shell/fish-shell/issues/1438).
f = tempfile.NamedTemporaryFile(prefix='web_config', suffix='.html', mode='w')
f = tempfile.NamedTemporaryFile(prefix="web_config", suffix=".html", mode="w")
f.write(redirect_template_html % (url, url))
f.flush()

View File

@ -17,8 +17,8 @@
#include <procfs.h>
#endif
#if __APPLE__
#include <sys/time.h> // Required to build with old SDK versions
#include <sys/proc.h>
#include <sys/time.h> // Required to build with old SDK versions
#else
#include <dirent.h>
#include <sys/stat.h>
@ -194,7 +194,7 @@ static size_t parse_slice(const wchar_t *in, wchar_t **end_ptr, std::vector<long
if (idx.empty() && in[pos] == L'.' && in[pos + 1] == L'.') {
// If we are at the first index expression, a missing start index means the range starts
// at the first item.
tmp = 1; // first index
tmp = 1; // first index
end = &in[pos];
} else {
tmp = fish_wcstol(&in[pos], &end);
@ -212,13 +212,13 @@ static size_t parse_slice(const wchar_t *in, wchar_t **end_ptr, std::vector<long
if (in[pos] == L'.' && in[pos + 1] == L'.') {
pos += 2;
while (in[pos] == INTERNAL_SEPARATOR) pos++;
while (iswspace(in[pos])) pos++; // Allow the space in "[.. ]".
while (iswspace(in[pos])) pos++; // Allow the space in "[.. ]".
long tmp1;
// Check if we are at the last index range expression, a missing end index means the
// range spans until the last item.
if (in[pos] == L']') {
tmp1 = -1; // last index
tmp1 = -1; // last index
end = &in[pos];
} else {
tmp1 = fish_wcstol(&in[pos], &end);

View File

@ -4,7 +4,7 @@
#include <pthread.h>
#include <cstdint> // for uint64_t
#include <cstdint> // for uint64_t
#include <functional>
#include <type_traits>

View File

@ -268,10 +268,13 @@ bool process_t::is_internal() const {
case process_type_t::exec:
return false;
default:
assert(false && "The fish developers forgot to include a process_t. Please report a bug");
assert(false &&
"The fish developers forgot to include a process_t. Please report a bug");
return true;
}
assert(false && "process_t::is_internal: Total logic failure, universe is broken. Please replace universe and retry.");
assert(false &&
"process_t::is_internal: Total logic failure, universe is broken. Please replace "
"universe and retry.");
return true;
}

View File

@ -375,7 +375,8 @@ maybe_t<pipe_or_redir_t> pipe_or_redir_t::from_string(const wchar_t *buff) {
: STDOUT_FILENO; // like >|
} else if (try_consume(L'&')) {
// This is a redirection to an fd.
// Note that we allow ">>&", but it's still just writing to the fd - "appending" to it doesn't make sense.
// Note that we allow ">>&", but it's still just writing to the fd - "appending" to
// it doesn't make sense.
result.mode = redirection_mode_t::fd;
result.fd = has_fd ? parse_fd(fd_start, fd_end) // like 1>&2
: STDOUT_FILENO; // like >&2
@ -383,7 +384,8 @@ maybe_t<pipe_or_redir_t> pipe_or_redir_t::from_string(const wchar_t *buff) {
// This is a redirection to a file.
result.fd = has_fd ? parse_fd(fd_start, fd_end) // like 1> file.txt
: STDOUT_FILENO; // like > file.txt
if (result.mode != redirection_mode_t::append) result.mode = redirection_mode_t::overwrite;
if (result.mode != redirection_mode_t::append)
result.mode = redirection_mode_t::overwrite;
// Note 'echo abc >>? file' is valid: it means append and noclobber.
// But here "noclobber" means the file must not exist, so appending
// can be ignored.

View File

@ -266,8 +266,8 @@ int fd_check_is_remote(int fd) {
// these are in varying headers. Simply hard code them.
// NOTE: The cast is necessary for 32-bit systems because of the 4-byte CIFS_MAGIC_NUMBER
switch ((unsigned int)buf.f_type) {
case 0x6969: // NFS_SUPER_MAGIC
case 0x517B: // SMB_SUPER_MAGIC
case 0x6969: // NFS_SUPER_MAGIC
case 0x517B: // SMB_SUPER_MAGIC
case 0xFF534D42u: // CIFS_MAGIC_NUMBER
return 1;
default: