Skip to content

Commit

Permalink
#265 Show that the desired output can already be reached
Browse files Browse the repository at this point in the history
Closing #265
  • Loading branch information
florianschanda committed May 16, 2023
1 parent 313e2e0 commit 05b1f82
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 150 deletions.
34 changes: 1 addition & 33 deletions tests/style/issue_265_alternative_indent/expected_out.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,39 +11,7 @@
<div></div>
<h1>Issues identified</h1>
<section>
<h2>test_from_ticket.m</h2>
<div class="message"><a href="matlab:opentoline('test_from_ticket.m', 1, 19)">test_from_ticket.m: line 1:</a> style: violates naming scheme for function</div>
<div class="message"><a href="matlab:opentoline('test_from_ticket.m', 1, 19)">test_from_ticket.m: line 1:</a> style: Could not find any copyright notice</div>
<div class="message"><a href="matlab:opentoline('test_from_ticket.m', 2)">test_from_ticket.m: line 2:</a> style: indentation not correct, should be 4 spaces, not 0</div>
<div class="message"><a href="matlab:opentoline('test_from_ticket.m', 3)">test_from_ticket.m: line 3:</a> style: indentation not correct, should be 4 spaces, not 0</div>
<div class="message"><a href="matlab:opentoline('test_from_ticket.m', 4)">test_from_ticket.m: line 4:</a> style: indentation not correct, should be 4 spaces, not 0</div>
<div class="message"><a href="matlab:opentoline('test_from_ticket.m', 5)">test_from_ticket.m: line 5:</a> style: indentation not correct, should be 4 spaces, not 0</div>
<div class="message"><a href="matlab:opentoline('test_from_ticket.m', 6)">test_from_ticket.m: line 6:</a> style: indentation not correct, should be 4 spaces, not 0</div>
<div class="message"><a href="matlab:opentoline('test_from_ticket.m', 8)">test_from_ticket.m: line 8:</a> style: indentation not correct, should be 4 spaces, not 0</div>
<div class="message"><a href="matlab:opentoline('test_from_ticket.m', 9)">test_from_ticket.m: line 9:</a> style: indentation not correct, should be 4 spaces, not 0</div>
<div class="message"><a href="matlab:opentoline('test_from_ticket.m', 11)">test_from_ticket.m: line 11:</a> style: indentation not correct, should be 4 spaces, not 0</div>
<div class="message"><a href="matlab:opentoline('test_from_ticket.m', 13)">test_from_ticket.m: line 13:</a> style: indentation not correct, should be 4 spaces, not 0</div>
<div class="message"><a href="matlab:opentoline('test_from_ticket.m', 14)">test_from_ticket.m: line 14:</a> style: indentation not correct, should be 4 spaces, not 0</div>
<div class="message"><a href="matlab:opentoline('test_from_ticket.m', 14, 16)">test_from_ticket.m: line 14:</a> style: = must be preceeded by whitespace</div>
<div class="message"><a href="matlab:opentoline('test_from_ticket.m', 14, 17)">test_from_ticket.m: line 14:</a> style: violates naming scheme for nested</div>
<div class="message"><a href="matlab:opentoline('test_from_ticket.m', 15, 5)">test_from_ticket.m: line 15:</a> style: indentation not correct, should be 8 spaces, not 4</div>
<div class="message"><a href="matlab:opentoline('test_from_ticket.m', 15, 81)">test_from_ticket.m: line 15:</a> style: line exceeds 80 characters</div>
<div class="message"><a href="matlab:opentoline('test_from_ticket.m', 16, 5)">test_from_ticket.m: line 16:</a> style: end statement with a semicolon</div>
<div class="message"><a href="matlab:opentoline('test_from_ticket.m', 16, 5)">test_from_ticket.m: line 16:</a> style: indentation not correct, should be 8 spaces, not 4</div>
<div class="message"><a href="matlab:opentoline('test_from_ticket.m', 17, 5)">test_from_ticket.m: line 17:</a> style: end statement with a semicolon</div>
<div class="message"><a href="matlab:opentoline('test_from_ticket.m', 17, 5)">test_from_ticket.m: line 17:</a> style: indentation not correct, should be 8 spaces, not 4</div>
<div class="message"><a href="matlab:opentoline('test_from_ticket.m', 18)">test_from_ticket.m: line 18:</a> style: indentation not correct, should be 4 spaces, not 0</div>
<div class="message"><a href="matlab:opentoline('test_from_ticket.m', 20)">test_from_ticket.m: line 20:</a> style: indentation not correct, should be 4 spaces, not 0</div>
<div class="message"><a href="matlab:opentoline('test_from_ticket.m', 21)">test_from_ticket.m: line 21:</a> style: indentation not correct, should be 4 spaces, not 0</div>
<div class="message"><a href="matlab:opentoline('test_from_ticket.m', 21, 16)">test_from_ticket.m: line 21:</a> style: = must be preceeded by whitespace</div>
<div class="message"><a href="matlab:opentoline('test_from_ticket.m', 21, 17)">test_from_ticket.m: line 21:</a> style: violates naming scheme for nested</div>
<div class="message"><a href="matlab:opentoline('test_from_ticket.m', 22, 5)">test_from_ticket.m: line 22:</a> style: indentation not correct, should be 8 spaces, not 4</div>
<div class="message"><a href="matlab:opentoline('test_from_ticket.m', 23, 5)">test_from_ticket.m: line 23:</a> style: end statement with a semicolon</div>
<div class="message"><a href="matlab:opentoline('test_from_ticket.m', 23, 5)">test_from_ticket.m: line 23:</a> style: indentation not correct, should be 8 spaces, not 4</div>
<div class="message"><a href="matlab:opentoline('test_from_ticket.m', 24, 5)">test_from_ticket.m: line 24:</a> style: end statement with a semicolon</div>
<div class="message"><a href="matlab:opentoline('test_from_ticket.m', 24, 5)">test_from_ticket.m: line 24:</a> style: indentation not correct, should be 8 spaces, not 4</div>
<div class="message"><a href="matlab:opentoline('test_from_ticket.m', 25)">test_from_ticket.m: line 25:</a> style: indentation not correct, should be 4 spaces, not 0</div>
</section>
<div>Everything is fine :)</div></section>
</main>
</body>
</html>
97 changes: 2 additions & 95 deletions tests/style/issue_265_alternative_indent/expected_out.txt
Original file line number Diff line number Diff line change
@@ -1,98 +1,5 @@
=== 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)
MISS_HIT Style Summary: 1 file(s) analysed, everything seems fine

=== HTML MODE ===
MISS_HIT Style Summary: 1 file(s) analysed, 31 style issue(s)
MISS_HIT Style Summary: 1 file(s) analysed, everything seems fine
5 changes: 5 additions & 0 deletions tests/style/issue_265_alternative_indent/miss_hit.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
indent_function_file_body: false
suppress_rule: "end_of_statements"
suppress_rule: "naming_functions"
suppress_rule: "copyright_notice"
suppress_rule: "line_length"
4 changes: 2 additions & 2 deletions tests/style/issue_265_alternative_indent/test_from_ticket.m
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@
%% -------- local functions -------

% comment for relatively short localfun 1
function output=localfun1(input)
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)
function output = localfun2(input)
% short comment on
statement1
statement2
Expand Down
40 changes: 20 additions & 20 deletions tests/style/issue_265_alternative_indent/test_from_ticket.m_fixed
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
function output = mainfun(input)
%
% docstring for mainfun
% copyright ...
% the main-function should be flattened without indentation
%
%
% docstring for mainfun
% copyright ...
% the main-function should be flattened without indentation
%

statement1;
statement2;
statement1;
statement2;

%% -------- local functions -------
%% -------- 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 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
% comment for relatively short localfun 2
function output = localfun2(input)
% short comment on
statement1
statement2
end

end

0 comments on commit 05b1f82

Please sign in to comment.