From 7e1b5bd3bc21a324694e9a892ee6d5219ee7505f Mon Sep 17 00:00:00 2001 From: Georg Kotheimer Date: Thu, 31 May 2018 11:24:18 +0200 Subject: [PATCH] style: normalize filename in SortedIncludes.fix() The filename affects the sorting result. Therefore check(), which normalizes the filename, detects an invalid sorting of includes, but fix() fails to fix the corresponding includes. Change-Id: I7d5a941c9ebea853004922d19e3b84f8ded2afa6 Signed-off-by: Georg Kotheimer Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/10742 Tested-by: kokoro Reviewed-by: Andreas Sandberg Maintainer: Andreas Sandberg --- util/style/verifiers.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/util/style/verifiers.py b/util/style/verifiers.py index 33b127a79..3cc513429 100644 --- a/util/style/verifiers.py +++ b/util/style/verifiers.py @@ -378,11 +378,12 @@ class SortedIncludes(Verifier): @safefix def fix(self, filename, regions=all_regions): f = self.open(filename, 'r+') + norm_fname = self.normalize_filename(filename) old = f.readlines() lines = [ l.rstrip('\n') for l in old ] language = lang_type(filename, lines[0]) - sort_lines = list(self.sort_includes(lines, filename, language)) + sort_lines = list(self.sort_includes(lines, norm_fname, language)) new = ''.join(line + '\n' for line in sort_lines) f.seek(0) -- 2.30.2