From 425813fde35a5c67ed3dfa0729ef88a147570b75 Mon Sep 17 00:00:00 2001 From: Danila Fedorin Date: Thu, 22 Aug 2024 10:26:15 -0700 Subject: [PATCH] Add an auto-fixit good file Signed-off-by: Danila Fedorin --- test/chplcheck/IncorrectIndentation.good | 1 + .../chplcheck/IncorrectIndentation.good-fixit | 388 ++++++++++++++++++ 2 files changed, 389 insertions(+) create mode 100644 test/chplcheck/IncorrectIndentation.good-fixit diff --git a/test/chplcheck/IncorrectIndentation.good b/test/chplcheck/IncorrectIndentation.good index 2dae0454759b..2af1bee54482 100644 --- a/test/chplcheck/IncorrectIndentation.good +++ b/test/chplcheck/IncorrectIndentation.good @@ -63,3 +63,4 @@ IncorrectIndentation.chpl:339: node violates rule IncorrectIndentation IncorrectIndentation.chpl:349: node violates rule IncorrectIndentation IncorrectIndentation.chpl:353: node violates rule IncorrectIndentation IncorrectIndentation.chpl:358: node violates rule IncorrectIndentation +[Success matching fixit for IncorrectIndentation] diff --git a/test/chplcheck/IncorrectIndentation.good-fixit b/test/chplcheck/IncorrectIndentation.good-fixit new file mode 100644 index 000000000000..fd5e9aa9ae15 --- /dev/null +++ b/test/chplcheck/IncorrectIndentation.good-fixit @@ -0,0 +1,388 @@ +module IncorrectIndentation { + proc f1() + { + writeln("hi"); + writeln("??"); + } + + @chplcheck.ignore("IncorrectIndentation") + proc f2() + { + writeln("hi"); + } + + @chplcheck.ignore("IncorrectIndentation") + proc f3() { + writeln("hi"); + } + + proc f4() { + writeln("hi"); + writeln("hi"); + } + + proc f5() { + writeln("hi"); writeln("hi"); + } + + proc f6() { + @chplcheck.ignore("IncorrectIndentation") + for 1..10 do + writeln("hi"); + } + + module M1 + { + writeln("hi"); + writeln("??"); + } + + @chplcheck.ignore("IncorrectIndentation") + module M2 + { + writeln("hi"); + } + + @chplcheck.ignore("IncorrectIndentation") + module M3 { + writeln("hi"); + } + + module M4 { + writeln("hi"); + writeln("hi"); + } + + module M5 { + writeln("hi"); writeln("hi"); + } + + module M6 { + @chplcheck.ignore("IncorrectIndentation") + for 1..10 do + writeln("hi"); + } + + for 1..10 { + writeln("hi"); + } + + @chplcheck.ignore("IncorrectIndentation") + for 1..10 + { + writeln("hi"); + } + + @chplcheck.ignore("IncorrectIndentation") + for 1..10 { + writeln("hi"); + } + + module NestedOuter { + module NestedInner { + writeln("hi"); + writeln("??"); + writeln("??"); + record nestedRecord { + proc firstProc() {} + proc secondProc() {} + proc thirdProc() {} + + proc nestedProcOuter() { + proc nestedProcInner(x: int) do return x; + proc nestedProcInner(x: string) { + writeln(x); + writeln(x); + writeln(x); + return x; + } + } + } + } + } + + on here + { + writeln("hi"); + writeln("??"); + } + + @chplcheck.ignore("IncorrectIndentation") + on here + { + writeln("hi"); + } + + @chplcheck.ignore("IncorrectIndentation") + on here { + writeln("hi"); + } + + on here { + writeln("hi"); + writeln("hi"); + } + + on here { + writeln("hi"); writeln("hi"); + } + + on here { + @chplcheck.ignore("IncorrectIndentation") + for 1..10 do + writeln("hi"); + } + + begin + { + writeln("hi"); + writeln("??"); + } + + @chplcheck.ignore("IncorrectIndentation") + begin + { + writeln("hi"); + } + + @chplcheck.ignore("IncorrectIndentation") + begin { + writeln("hi"); + } + + begin { + writeln("hi"); + writeln("hi"); + } + + begin { + writeln("hi"); writeln("hi"); + } + + begin { + @chplcheck.ignore("IncorrectIndentation") + for 1..10 do + writeln("hi"); + } + + var dummy: int; + + begin with (ref dummy) + { + writeln("hi"); + writeln("??"); + } + + @chplcheck.ignore("IncorrectIndentation") + begin with (ref dummy) + { + writeln("hi"); + } + + @chplcheck.ignore("IncorrectIndentation") + begin with (ref dummy) { + writeln("hi"); + } + + begin with (ref dummy) { + writeln("hi"); + writeln("hi"); + } + + begin with (ref dummy) { + writeln("hi"); writeln("hi"); + } + + begin with (ref dummy) { + @chplcheck.ignore("IncorrectIndentation") + for 1..10 do + writeln("hi"); + } + + // Note: 'cobegins' with one statement throw warning, so all tests here include + // at least two statements. + + cobegin + { + writeln("hi"); + writeln("??"); + } + + @chplcheck.ignore("IncorrectIndentation") + cobegin + { + writeln("hi"); + writeln("hi"); + } + + @chplcheck.ignore("IncorrectIndentation") + cobegin { + writeln("hi"); + writeln("hi"); + } + + cobegin { + writeln("hi"); + writeln("hi"); + } + + cobegin { + writeln("hi"); writeln("hi"); + } + + cobegin { + writeln("hi"); + @chplcheck.ignore("IncorrectIndentation") + for 1..10 do + writeln("hi"); + } + + cobegin with (ref dummy) + { + writeln("hi"); + writeln("??"); + } + + cobegin with (ref dummy) + { + writeln("hi"); + writeln("hi"); + } + + cobegin with (ref dummy) { + writeln("hi"); + writeln("hi"); + } + + cobegin with (ref dummy) { + writeln("hi"); + writeln("hi"); + } + + cobegin with (ref dummy) { + writeln("hi"); writeln("hi"); + } + + cobegin with (ref dummy) { + writeln("hi"); + @chplcheck.ignore("IncorrectIndentation") + for 1..10 do + writeln("hi"); + } + + enum e1 + { + first, + second + } + + @chplcheck.ignore("IncorrectIndentation") + enum e2 + { + first + } + + @chplcheck.ignore("IncorrectIndentation") + enum e3 { + first + } + + enum e4 { + first, + second + } + + enum e5 { + first, second + } + + union u1 + { + var element: int; + proc firstProc() {} + } + + @chplcheck.ignore("IncorrectIndentation") + union u2 + { + var element: int; + + proc firstProc() {} + } + + @chplcheck.ignore("IncorrectIndentation") + union u3 { + var element: int; + + proc firstProc() {} + } + + union u4 { + var element: int; + + proc firstProc() {} + proc secondProc() {} + } + + union u5 { + var element: int; + + proc firstProc() {} proc secondProc() {} + } + + enum color { red, green, blue } // semicolon warning does not issue bad indentation + + // Since locations are incorrectly reported with 'public' and 'private', + // these shouldn't warn. + module M7 { + proc f1 {} + proc g1 {} + public proc f2 {} + public proc g2 {} + private proc f3 {} + private proc g3 {} + + use super.M1; + use super.M1; + public use super.M2; + public use super.M2; + private use super.M2; + private use super.M2; + } + + + @chplcheck.ignore("IncorrectIndentation") + module DirectChildrenNotIndented { + proc f1() + { + writeln("hi"); + writeln("??"); + } + + @chplcheck.ignore("IncorrectIndentation") + proc f2() + { + writeln("hi"); + } + + @chplcheck.ignore("IncorrectIndentation") + proc f3() { + writeln("hi"); + } + + proc f4() { + writeln("hi"); + writeln("hi"); + } + + proc f5() { + writeln("hi"); writeln("hi"); + } + + proc f6() { + @chplcheck.ignore("IncorrectIndentation") + for 1..10 do + writeln("hi"); + } + } +}