Style fix: fix comments at the end of function definitions.

JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
This commit is contained in:
László Langó
2016-01-29 13:57:23 +01:00
parent 41f6cbb3ac
commit d038284bff
23 changed files with 107 additions and 53 deletions
+1
View File
@@ -3,6 +3,7 @@ set rules {
jerry_braces_on_separate_line
jerry_braces_same_line_or_column
jerry_dereference_operator_always_on_right
jerry_comment_function_end
jerry_funcname_space_parentheses
jerry_identifier_no_space_bracket
jerry_indentation
@@ -0,0 +1,53 @@
#!/usr/bin/tclsh
# Copyright 2016 Samsung Electronics Co., Ltd.
# Copyright 2016 University of Szeged
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
foreach fileName [getSourceFileNames] {
set funcStart 0
set funcName {}
set lineNumber 1
foreach line [getAllLines $fileName] {
if {[regexp {^((static |const )*\w+ )*\w+ \(.*[,\)]} $line]} {
set type {}
set modifier {}
if {$funcStart == 0} {
regexp {^((static |const )*\w+ )*(\w+) \(} $line matched type modifier funcName
}
}
if {[regexp {^\{$} $line]} {
set funcStart 1
}
if {$funcStart == 1} {
if {[regexp {^\}$} $line]} {
report $fileName $lineNumber "missing comment at the end of function: /* $funcName */"
set funcStart 0
} elseif {[regexp {^\} /\*\s*\w+\s*\*/$} $line]} {
set comment {}
regexp {^\} /\*\s*(\w+)\s*\*/$} $line -> comment
if {$comment != $funcName} {
report $fileName $lineNumber "comment missmatch. (Current: $comment, Expected: $funcName)"
}
set funcStart 0
} elseif {[regexp {^\}.*;$} $line]} {
set funcStart 0
}
}
incr lineNumber
}
}