-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3957b9e
commit d27d416
Showing
54 changed files
with
343 additions
and
177 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,9 @@ | ||
buildScripts | ||
installer | ||
qrrepo | ||
qrutils | ||
plugins | ||
qrtest | ||
bin | ||
docs | ||
umlDocumentation | ||
qrmc | ||
thirdparty | ||
.moc | ||
.ui | ||
plugins | ||
qrtest | ||
qrutils | ||
qrmc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,4 +7,5 @@ set rules { | |
NoSpacesAtTheStart | ||
NoRelativePathsInIncludes | ||
OpeningParethesisForClass | ||
NullsForbidden | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
# Copyright 2015 Cybertech Labs Ltd. | ||
# | ||
# 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 ClassSection { old line } { | ||
if { [regexp {public:} $line] || [regexp {public slots:} $line] || [regexp {signals:} $line] } { | ||
return "public" | ||
} | ||
|
||
if { [regexp {protected:} $line] || [regexp {protected slots:} $line] } { | ||
return "protected" | ||
} | ||
|
||
if { [regexp {private:} $line] || [regexp {private slots:} $line] } { | ||
return "private" | ||
} | ||
|
||
return $old | ||
} | ||
|
||
proc MayBeMethodDeclaration { line inClass } { | ||
if { ![regexp { \w+\(([\w:]+ [*& ]*\w+.*)?\)} $line] && ![regexp {\t\w+\([\w:]+ [*& ]*\w+.*\)} $line]} { | ||
# Regular method (space before name, name, optional parameters) or constructor (tab before name, name, parameters, since parameterless constructors may be not documented) | ||
return 0 | ||
} | ||
|
||
if { $inClass == 0 } { | ||
return 0 | ||
} | ||
|
||
return 1 | ||
} | ||
|
||
proc ShallHaveComment { line previousComment currentSection inClass } { | ||
if { [string length $previousComment] > 0 } { | ||
return 0 | ||
} | ||
|
||
if { [string compare $currentSection "private"] == 0 || [string compare $currentSection "protected"] == 0 } { | ||
return 0 | ||
} | ||
|
||
if { [regexp {override} $line] } { | ||
return 0 | ||
} | ||
|
||
if { [regexp {^[\t]*///} $line] } { | ||
return 0 | ||
} | ||
|
||
return 1 | ||
} | ||
|
||
proc CheckComments { fileName } { | ||
if {![regexp -nocase {.*.h$} $fileName] } { return } | ||
set lineCount 1 | ||
set previousComment "" | ||
set currentSection "" | ||
set inClass 0 | ||
foreach line [getAllLines $fileName] { | ||
set currentSection [ClassSection $currentSection $line] | ||
if { [regexp {^\t*class[^;]*$} $line] } { | ||
set inClass 1 | ||
if { [string length $previousComment] == 0} { | ||
report $fileName $lineCount "Classes must have comments in doxygen style (starting with ///)" | ||
} | ||
} | ||
|
||
if { [MayBeMethodDeclaration $line $inClass] && [ShallHaveComment $line $previousComment $currentSection $inClass ] } { | ||
report $fileName $lineCount "Methods must have comments in doxygen style (starting with ///)" | ||
} | ||
|
||
if { [regexp {///} $line] } { | ||
set previousComment [concat $previousComment $line] | ||
} else { | ||
set previousComment "" | ||
} | ||
|
||
incr lineCount | ||
} | ||
} | ||
|
||
foreach fileName [getSourceFileNames] { | ||
CheckComments $fileName | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Copyright 2014 Cybertech Labs Ltd. | ||
# | ||
# 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 ForeachsForbidden { fileName } { | ||
set lineCount 1 | ||
foreach line [getAllLines $fileName] { | ||
if { [regexp {foreach} $line] } { | ||
report $fileName $lineCount "'foreach' is forbidden, use 'for' range loops instead" | ||
} | ||
incr lineCount | ||
} | ||
} | ||
|
||
foreach fileName [getSourceFileNames] { | ||
ForeachsForbidden $fileName | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Copyright 2014 Cybertech Labs Ltd. | ||
# | ||
# 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 NullsForbidden { fileName } { | ||
set lineCount 1 | ||
foreach line [getAllLines $fileName] { | ||
if { [regexp {NULL} $line] } { | ||
report $fileName $lineCount "NULL is forbidden, use nullptr instead" | ||
} | ||
incr lineCount | ||
} | ||
} | ||
|
||
foreach fileName [getSourceFileNames] { | ||
NullsForbidden $fileName | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Copyright 2015 Cybertech Labs Ltd. | ||
# | ||
# 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 CheckOwnership { fileName } { | ||
if {![regexp -nocase {.*.h$} $fileName] } { return } | ||
set lineCount 1 | ||
set previousComment "" | ||
foreach line [getAllLines $fileName] { | ||
if { [regexp {.*\* [\w]*;} $line] } { | ||
report $fileName $lineCount "'*' shall be attached to identifier, not type" | ||
} | ||
|
||
if { [regexp {.* \*[\w]*;} $line] } { | ||
if { ![regexp {ownership} [string tolower $line] ] && ![regexp {ownership} [string tolower $previousComment] ] } { | ||
report $fileName $lineCount "Raw pointers must have a comment with ownership information - does object have ownership over pointed object or not (so will it delete pointed object itself or not)" | ||
} | ||
} | ||
|
||
if { [regexp {///} $line] } { | ||
set previousComment [concat $previousComment $line] | ||
} else { | ||
set previousComment "" | ||
} | ||
|
||
incr lineCount | ||
} | ||
} | ||
|
||
foreach fileName [getSourceFileNames] { | ||
CheckOwnership $fileName | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.