Skip to content

Commit

Permalink
Add an auto-fixit good file
Browse files Browse the repository at this point in the history
Signed-off-by: Danila Fedorin <[email protected]>
  • Loading branch information
DanilaFe committed Aug 22, 2024
1 parent cbd3769 commit 425813f
Show file tree
Hide file tree
Showing 2 changed files with 389 additions and 0 deletions.
1 change: 1 addition & 0 deletions test/chplcheck/IncorrectIndentation.good
Original file line number Diff line number Diff line change
Expand Up @@ -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]
388 changes: 388 additions & 0 deletions test/chplcheck/IncorrectIndentation.good-fixit
Original file line number Diff line number Diff line change
@@ -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");
}
}
}

0 comments on commit 425813f

Please sign in to comment.