Skip to content

Commit 0704f9f

Browse files
authored
Parse new rustfmt filename:line format
Adjust code for stripping ANSI escapes. A 0x0f character is included for switching character sets. The old "filename at line line" is still supported.
1 parent 1ad726d commit 0704f9f

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Fixed
11+
12+
* Parse the new rustfmt file and line number format
13+
14+
The format changed in https://github.com/rust-lang/rustfmt/pull/5971
15+
16+
Thanks to @0xcypher02 for pointing out the problem.
17+
1018
## [1.1.0] - 2022-11-21
1119

1220
### Added

action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,12 @@ runs:
4141
4242
echo "${CARGO_OUTPUT}" |
4343
# Strip color codes
44-
sed 's/\x1B\[[0-9;]*[A-Za-z]//g' |
44+
sed 's/\x1B\[[0-9;]*[A-Za-z]\x0f\?//g' |
4545
# Strip (some) cursor movements
4646
sed 's/\x1B.[A-G]//g' |
4747
tr "\n" "\r" |
4848
# Wrap each location into a HTML details
49-
sed -E 's#Diff in ([^\r]*?) at line ([[:digit:]]+):\r((:?[ +-][^\r]*\r)+)#<details>\n<summary>\1:\2</summary>\n\n```diff\n\3```\n\n</details>\n\n#g' |
49+
sed -E 's#Diff in ([^\r]*?)( at line |:)([[:digit:]]+):\r((:?[ +-][^\r]*\r)+)#<details>\n<summary>\1:\3</summary>\n\n```diff\n\4```\n\n</details>\n\n#g' |
5050
tr "\r" "\n" >> $GITHUB_STEP_SUMMARY
5151
fi
5252

0 commit comments

Comments
 (0)