Fix style issues and improve vera++ rules.
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
This commit is contained in:
@@ -2,7 +2,6 @@ set rules {
|
||||
jerry_always_curly
|
||||
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
|
||||
@@ -12,5 +11,7 @@ set rules {
|
||||
jerry_no_space_before_closing_parentheses
|
||||
jerry_no_tabs
|
||||
jerry_no_trailing_spaces
|
||||
jerry_pointer_declarator_space
|
||||
jerry_switch_case
|
||||
jerry_typecast_space_parentheses
|
||||
}
|
||||
|
||||
+4
-2
@@ -18,8 +18,10 @@
|
||||
foreach f [getSourceFileNames] {
|
||||
set lineNumber 1
|
||||
foreach line [getAllLines $f] {
|
||||
if {[regexp {\w\*\s\w+} $line]} {
|
||||
report $f $lineNumber "pointer dereference operator always should be aligned to right."
|
||||
if {[regexp {\w\*\s\w+} $line]
|
||||
|| [regexp {\w\*\)} $line]
|
||||
|| [regexp {\w\*$} $line]} {
|
||||
report $f $lineNumber "there should be a space between the referenced type and the pointer declarator."
|
||||
}
|
||||
incr lineNumber
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
#!/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.
|
||||
|
||||
proc check_part_of_the_file {file line_num col_start col_end} {
|
||||
if {$col_start == $col_end} {
|
||||
return
|
||||
}
|
||||
|
||||
set line [getLine $file $line_num]
|
||||
set line [string range $line $col_start $col_end]
|
||||
|
||||
if {[regexp {\)\w} $line]} {
|
||||
report $file $line_num "there should be exactly one space after right parentheses"
|
||||
}
|
||||
}
|
||||
|
||||
foreach fileName [getSourceFileNames] {
|
||||
set checkLine 1
|
||||
set checkColStart 0
|
||||
set seenOmitToken false
|
||||
foreach token [getTokens $fileName 1 0 -1 -1 {}] {
|
||||
set lineNumber [lindex $token 1]
|
||||
set colNumber [lindex $token 2]
|
||||
set tokenType [lindex $token 3]
|
||||
|
||||
if {$checkLine != $lineNumber} {
|
||||
if {!$seenOmitToken} {
|
||||
check_part_of_the_file $fileName $checkLine $checkColStart end
|
||||
}
|
||||
set checkColStart $colNumber
|
||||
set checkLine $lineNumber
|
||||
} elseif {$seenOmitToken} {
|
||||
set checkColStart $colNumber
|
||||
}
|
||||
|
||||
if {$tokenType in {ccomment cppcomment stringlit}} {
|
||||
check_part_of_the_file $fileName $checkLine $checkColStart $colNumber
|
||||
set seenOmitToken true
|
||||
} else {
|
||||
set seenOmitToken false
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user