From 313e2e0b96d0de203c52b0d89cb4b6349c729a23 Mon Sep 17 00:00:00 2001 From: Florian Schanda Date: Tue, 16 May 2023 15:25:41 +0200 Subject: [PATCH] #265 Add test from ticket --- .../expected_out.html | 49 ++++++++++ .../expected_out.txt | 98 +++++++++++++++++++ .../test_from_ticket.m | 27 +++++ .../test_from_ticket.m_fixed | 27 +++++ 4 files changed, 201 insertions(+) create mode 100644 tests/style/issue_265_alternative_indent/expected_out.html create mode 100644 tests/style/issue_265_alternative_indent/expected_out.txt create mode 100644 tests/style/issue_265_alternative_indent/test_from_ticket.m create mode 100644 tests/style/issue_265_alternative_indent/test_from_ticket.m_fixed diff --git a/tests/style/issue_265_alternative_indent/expected_out.html b/tests/style/issue_265_alternative_indent/expected_out.html new file mode 100644 index 0000000..6f3b89c --- /dev/null +++ b/tests/style/issue_265_alternative_indent/expected_out.html @@ -0,0 +1,49 @@ + + + + + +MISS_HIT Report + + +
MISS_HIT Report
+
+
+

Issues identified

+
+

test_from_ticket.m

+
test_from_ticket.m: line 1: style: violates naming scheme for function
+
test_from_ticket.m: line 1: style: Could not find any copyright notice
+
test_from_ticket.m: line 2: style: indentation not correct, should be 4 spaces, not 0
+
test_from_ticket.m: line 3: style: indentation not correct, should be 4 spaces, not 0
+
test_from_ticket.m: line 4: style: indentation not correct, should be 4 spaces, not 0
+
test_from_ticket.m: line 5: style: indentation not correct, should be 4 spaces, not 0
+
test_from_ticket.m: line 6: style: indentation not correct, should be 4 spaces, not 0
+
test_from_ticket.m: line 8: style: indentation not correct, should be 4 spaces, not 0
+
test_from_ticket.m: line 9: style: indentation not correct, should be 4 spaces, not 0
+
test_from_ticket.m: line 11: style: indentation not correct, should be 4 spaces, not 0
+
test_from_ticket.m: line 13: style: indentation not correct, should be 4 spaces, not 0
+
test_from_ticket.m: line 14: style: indentation not correct, should be 4 spaces, not 0
+
test_from_ticket.m: line 14: style: = must be preceeded by whitespace
+
test_from_ticket.m: line 14: style: violates naming scheme for nested
+
test_from_ticket.m: line 15: style: indentation not correct, should be 8 spaces, not 4
+
test_from_ticket.m: line 15: style: line exceeds 80 characters
+
test_from_ticket.m: line 16: style: end statement with a semicolon
+
test_from_ticket.m: line 16: style: indentation not correct, should be 8 spaces, not 4
+
test_from_ticket.m: line 17: style: end statement with a semicolon
+
test_from_ticket.m: line 17: style: indentation not correct, should be 8 spaces, not 4
+
test_from_ticket.m: line 18: style: indentation not correct, should be 4 spaces, not 0
+
test_from_ticket.m: line 20: style: indentation not correct, should be 4 spaces, not 0
+
test_from_ticket.m: line 21: style: indentation not correct, should be 4 spaces, not 0
+
test_from_ticket.m: line 21: style: = must be preceeded by whitespace
+
test_from_ticket.m: line 21: style: violates naming scheme for nested
+
test_from_ticket.m: line 22: style: indentation not correct, should be 8 spaces, not 4
+
test_from_ticket.m: line 23: style: end statement with a semicolon
+
test_from_ticket.m: line 23: style: indentation not correct, should be 8 spaces, not 4
+
test_from_ticket.m: line 24: style: end statement with a semicolon
+
test_from_ticket.m: line 24: style: indentation not correct, should be 8 spaces, not 4
+
test_from_ticket.m: line 25: style: indentation not correct, should be 4 spaces, not 0
+
+
+ + diff --git a/tests/style/issue_265_alternative_indent/expected_out.txt b/tests/style/issue_265_alternative_indent/expected_out.txt new file mode 100644 index 0000000..4d01584 --- /dev/null +++ b/tests/style/issue_265_alternative_indent/expected_out.txt @@ -0,0 +1,98 @@ +=== PLAIN MODE === +In test_from_ticket.m, line 1 +| function output = mainfun(input) +| ^^^^^^^ style: violates naming scheme for function [naming_functions] +In test_from_ticket.m, line 1 +| function output = mainfun(input) +| ^^^^^^^ style: Could not find any copyright notice [copyright_notice] +In test_from_ticket.m, line 2 +| % +| ^ style: indentation not correct, should be 4 spaces, not 0 [fixed] [indentation] +In test_from_ticket.m, line 3 +| % docstring for mainfun +| ^^^^^^^^^^^^^^^^^^^^^^^ style: indentation not correct, should be 4 spaces, not 0 [fixed] [indentation] +In test_from_ticket.m, line 4 +| % copyright ... +| ^^^^^^^^^^^^^^^ style: indentation not correct, should be 4 spaces, not 0 [fixed] [indentation] +In test_from_ticket.m, line 5 +| % the main-function should be flattened without indentation +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ style: indentation not correct, should be 4 spaces, not 0 [fixed] [indentation] +In test_from_ticket.m, line 6 +| % +| ^ style: indentation not correct, should be 4 spaces, not 0 [fixed] [indentation] +In test_from_ticket.m, line 8 +| statement1; +| ^^^^^^^^^^ style: indentation not correct, should be 4 spaces, not 0 [fixed] [indentation] +In test_from_ticket.m, line 9 +| statement2; +| ^^^^^^^^^^ style: indentation not correct, should be 4 spaces, not 0 [fixed] [indentation] +In test_from_ticket.m, line 11 +| %% -------- local functions ------- +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ style: indentation not correct, should be 4 spaces, not 0 [fixed] [indentation] +In test_from_ticket.m, line 13 +| % comment for relatively short localfun 1 +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ style: indentation not correct, should be 4 spaces, not 0 [fixed] [indentation] +In test_from_ticket.m, line 14 +| function output=localfun1(input) +| ^^^^^^^^ style: indentation not correct, should be 4 spaces, not 0 [fixed] [indentation] +In test_from_ticket.m, line 14 +| function output=localfun1(input) +| ^ style: = must be preceeded by whitespace [fixed] [whitespace_assignment] +In test_from_ticket.m, line 14 +| function output=localfun1(input) +| ^^^^^^^^^ style: violates naming scheme for nested [naming_functions] +In test_from_ticket.m, line 15 +| % local-functions, or functions with an "end" at the bottom should be indented +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ style: indentation not correct, should be 8 spaces, not 4 [fixed] [indentation] +In test_from_ticket.m, line 15 +| % local-functions, or functions with an "end" at the bottom should be indented +| ^^^ style: line exceeds 80 characters [line_length] +In test_from_ticket.m, line 16 +| statement1 +| ^^^^^^^^^^ style: end statement with a semicolon [fixed] [end_of_statements] +In test_from_ticket.m, line 16 +| statement1 +| ^^^^^^^^^^ style: indentation not correct, should be 8 spaces, not 4 [fixed] [indentation] +In test_from_ticket.m, line 17 +| statement2 +| ^^^^^^^^^^ style: end statement with a semicolon [fixed] [end_of_statements] +In test_from_ticket.m, line 17 +| statement2 +| ^^^^^^^^^^ style: indentation not correct, should be 8 spaces, not 4 [fixed] [indentation] +In test_from_ticket.m, line 18 +| end +| ^^^ style: indentation not correct, should be 4 spaces, not 0 [fixed] [indentation] +In test_from_ticket.m, line 20 +| % comment for relatively short localfun 2 +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ style: indentation not correct, should be 4 spaces, not 0 [fixed] [indentation] +In test_from_ticket.m, line 21 +| function output=localfun2(input) +| ^^^^^^^^ style: indentation not correct, should be 4 spaces, not 0 [fixed] [indentation] +In test_from_ticket.m, line 21 +| function output=localfun2(input) +| ^ style: = must be preceeded by whitespace [fixed] [whitespace_assignment] +In test_from_ticket.m, line 21 +| function output=localfun2(input) +| ^^^^^^^^^ style: violates naming scheme for nested [naming_functions] +In test_from_ticket.m, line 22 +| % short comment on +| ^^^^^^^^^^^^^^^^^^ style: indentation not correct, should be 8 spaces, not 4 [fixed] [indentation] +In test_from_ticket.m, line 23 +| statement1 +| ^^^^^^^^^^ style: end statement with a semicolon [fixed] [end_of_statements] +In test_from_ticket.m, line 23 +| statement1 +| ^^^^^^^^^^ style: indentation not correct, should be 8 spaces, not 4 [fixed] [indentation] +In test_from_ticket.m, line 24 +| statement2 +| ^^^^^^^^^^ style: end statement with a semicolon [fixed] [end_of_statements] +In test_from_ticket.m, line 24 +| statement2 +| ^^^^^^^^^^ style: indentation not correct, should be 8 spaces, not 4 [fixed] [indentation] +In test_from_ticket.m, line 25 +| end +| ^^^ style: indentation not correct, should be 4 spaces, not 0 [fixed] [indentation] +MISS_HIT Style Summary: 1 file(s) analysed, 31 style issue(s) + +=== HTML MODE === +MISS_HIT Style Summary: 1 file(s) analysed, 31 style issue(s) diff --git a/tests/style/issue_265_alternative_indent/test_from_ticket.m b/tests/style/issue_265_alternative_indent/test_from_ticket.m new file mode 100644 index 0000000..957da86 --- /dev/null +++ b/tests/style/issue_265_alternative_indent/test_from_ticket.m @@ -0,0 +1,27 @@ +function output = mainfun(input) +% +% docstring for mainfun +% copyright ... +% the main-function should be flattened without indentation +% + +statement1; +statement2; + +%% -------- local functions ------- + +% comment for relatively short localfun 1 +function output=localfun1(input) + % local-functions, or functions with an "end" at the bottom should be indented + statement1 + statement2 +end + +% comment for relatively short localfun 2 +function output=localfun2(input) + % short comment on + statement1 + statement2 +end + +end diff --git a/tests/style/issue_265_alternative_indent/test_from_ticket.m_fixed b/tests/style/issue_265_alternative_indent/test_from_ticket.m_fixed new file mode 100644 index 0000000..ae66e23 --- /dev/null +++ b/tests/style/issue_265_alternative_indent/test_from_ticket.m_fixed @@ -0,0 +1,27 @@ +function output = mainfun(input) + % + % docstring for mainfun + % copyright ... + % the main-function should be flattened without indentation + % + + statement1; + statement2; + + %% -------- local functions ------- + + % comment for relatively short localfun 1 + function output = localfun1(input) + % local-functions, or functions with an "end" at the bottom should be indented + statement1; + statement2; + end + + % comment for relatively short localfun 2 + function output = localfun2(input) + % short comment on + statement1; + statement2; + end + +end