Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Applescript implementation deviates from clang-format rules, due to line_count_without-trailing_empty_lines. #6

Open
soerlemans opened this issue Jul 23, 2024 · 0 comments

Comments

@soerlemans
Copy link

The following function will ignore trailing empty lines.

on line_count_without_trailing_empty_lines(_source)
	set _lines to (length of _source)
	if _lines = 0 then return 0

	repeat with _index from _lines to 1 by -1
		if item _index of _source � "" then
			return _index
		end if
	end repeat

	return 1
end line_count_without_trailing_empty_lines

on line_count_without_trailing_empty_lines(_source)

But when the following setting is set in .clang-format:

MaxEmptyLinesToKeep: 2

Then clang-format will fail to trim empty trailing lines.
This means that using clang-foramt --dry-run -Werror to validate if a source file was properly formatted then it will fail.
And then using the xcode-clang-format.applescript to format the file wont fix this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant