forked from qt-creator/qt-creator
Conflicts: src/libs/utils/ipaddresslineedit.cpp src/libs/utils/logging.h src/plugins/analyzerbase/AnalyzerBase.pluginspec.in src/plugins/android/Android.pluginspec.in src/plugins/android/androiddeploystep.cpp src/plugins/android/androiddeploystep.h src/plugins/android/androiddeploystepfactory.cpp src/plugins/android/androiddeploystepwidget.cpp src/plugins/android/androidpackagecreationfactory.cpp src/plugins/android/androidpackagecreationstep.cpp src/plugins/android/androidpackagecreationstep.h src/plugins/android/androidpackagecreationwidget.cpp src/plugins/android/androidpackagecreationwidget.h src/plugins/android/javafilewizard.cpp src/plugins/autotoolsprojectmanager/AutotoolsProjectManager.pluginspec.in src/plugins/baremetal/BareMetal.pluginspec.in src/plugins/bazaar/Bazaar.pluginspec.in src/plugins/beautifier/Beautifier.pluginspec.in src/plugins/bineditor/BinEditor.pluginspec.in src/plugins/bookmarks/Bookmarks.pluginspec.in src/plugins/clangcodemodel/ClangCodeModel.pluginspec.in src/plugins/clangcodemodel/clanghighlightingsupport.cpp src/plugins/clangcodemodel/clangsymbolsearcher.cpp src/plugins/classview/ClassView.pluginspec.in src/plugins/clearcase/ClearCase.pluginspec.in src/plugins/cmakeprojectmanager/CMakeProjectManager.pluginspec.in src/plugins/cmakeprojectmanager/cmakeeditorfactory.cpp src/plugins/cmakeprojectmanager/cmakehighlighter.cpp src/plugins/coreplugin/Core.pluginspec.in src/plugins/cpaster/CodePaster.pluginspec.in src/plugins/cppeditor/CppEditor.pluginspec.in src/plugins/cppeditor/cppfilewizard.cpp src/plugins/cpptools/CppTools.pluginspec.in src/plugins/cpptools/cpphighlightingsupportinternal.cpp src/plugins/cpptools/cppmodelmanagerinterface.cpp src/plugins/cpptools/cppmodelmanagerinterface.h src/plugins/cvs/CVS.pluginspec.in src/plugins/debugger/Debugger.pluginspec.in src/plugins/designer/Designer.pluginspec.in src/plugins/diffeditor/DiffEditor.pluginspec.in src/plugins/emacskeys/EmacsKeys.pluginspec.in src/plugins/fakevim/FakeVim.pluginspec.in src/plugins/genericprojectmanager/GenericProjectManager.pluginspec.in src/plugins/git/Git.pluginspec.in src/plugins/git/gitorious/gitorious.cpp src/plugins/git/gitorious/gitorious.h src/plugins/git/gitorious/gitoriousclonewizard.cpp src/plugins/git/gitorious/gitorioushostwidget.cpp src/plugins/git/gitorious/gitorioushostwidget.h src/plugins/git/gitorious/gitorioushostwizardpage.cpp src/plugins/git/gitorious/gitoriousprojectwidget.cpp src/plugins/git/gitorious/gitoriousprojectwidget.h src/plugins/git/gitorious/gitoriousprojectwizardpage.cpp src/plugins/git/gitorious/gitoriousprojectwizardpage.h src/plugins/git/gitorious/gitoriousrepositorywizardpage.cpp src/plugins/git/gitorious/gitoriousrepositorywizardpage.h src/plugins/glsleditor/GLSLEditor.pluginspec.in src/plugins/glsleditor/glsleditorfactory.cpp src/plugins/glsleditor/glslfilewizard.cpp src/plugins/helloworld/HelloWorld.pluginspec.in src/plugins/help/Help.pluginspec.in src/plugins/imageviewer/ImageViewer.pluginspec.in src/plugins/ios/Ios.pluginspec.in src/plugins/macros/Macros.pluginspec.in src/plugins/mercurial/Mercurial.pluginspec.in src/plugins/perforce/Perforce.pluginspec.in src/plugins/projectexplorer/ProjectExplorer.pluginspec.in src/plugins/pythoneditor/PythonEditor.pluginspec.in src/plugins/pythoneditor/pythoneditorwidget.cpp src/plugins/pythoneditor/wizard/pythonfilewizard.cpp src/plugins/qbsprojectmanager/QbsProjectManager.pluginspec.in src/plugins/qbsprojectmanager/defaultpropertyprovider.cpp src/plugins/qmakeprojectmanager/QmakeProjectManager.pluginspec.in src/plugins/qmakeprojectmanager/profileeditorfactory.cpp src/plugins/qmldesigner/QmlDesigner.pluginspec.in src/plugins/qmljseditor/QmlJSEditor.pluginspec.in src/plugins/qmljseditor/qmljseditorfactory.cpp src/plugins/qmljstools/QmlJSTools.pluginspec.in src/plugins/qmlprofiler/QmlProfiler.pluginspec.in src/plugins/qmlprojectmanager/QmlProjectManager.pluginspec.in src/plugins/qnx/Qnx.pluginspec.in src/plugins/qtsupport/QtSupport.pluginspec.in src/plugins/remotelinux/RemoteLinux.pluginspec.in src/plugins/resourceeditor/ResourceEditor.pluginspec.in src/plugins/resourceeditor/resourcewizard.h src/plugins/subversion/Subversion.pluginspec.in src/plugins/tasklist/TaskList.pluginspec.in src/plugins/texteditor/TextEditor.pluginspec.in src/plugins/texteditor/basetexteditor_p.h src/plugins/texteditor/basetextmark.cpp src/plugins/texteditor/codeassist/basicproposalitemlistmodel.h src/plugins/texteditor/codeassist/defaultassistinterface.h src/plugins/texteditor/codeassist/iassistproposalitem.cpp src/plugins/texteditor/itexteditor.cpp src/plugins/texteditor/itexteditor.h src/plugins/texteditor/itextmark.cpp src/plugins/texteditor/plaintexteditor.cpp src/plugins/texteditor/plaintexteditor.h src/plugins/texteditor/texteditoractionhandler.cpp src/plugins/todo/Todo.pluginspec.in src/plugins/updateinfo/UpdateInfo.pluginspec.in src/plugins/valgrind/Valgrind.pluginspec.in src/plugins/vcsbase/VcsBase.pluginspec.in src/plugins/welcome/Welcome.pluginspec.in src/plugins/winrt/WinRt.pluginspec.in tests/auto/debugger/temporarydir.h Change-Id: I254af8be8119fe9855287909e17d4b8ca9d2fc2f
124 lines
2.9 KiB
Perl
124 lines
2.9 KiB
Perl
#!/usr/bin/perl -w
|
|
|
|
# Report possible problems with copy right headers
|
|
#
|
|
# Sample usage:
|
|
# find . -type f | xargs ./scripts/hasCopyright.pl
|
|
|
|
use strict;
|
|
|
|
shift; # remove script
|
|
|
|
sub canIgnoreNoCopyright {
|
|
my $file = shift;
|
|
return 1 if ($file =~ /\.png$/ or
|
|
$file =~ /\.ico$/ or
|
|
$file =~ /\.svg$/ or
|
|
$file =~ /\.xpm$/ or
|
|
$file =~ /\.dia$/ or
|
|
$file =~ /\/Doxyfile$/ or
|
|
$file =~ /\.qmlproject$/ or
|
|
$file =~ /\.pr[oi]$/ or
|
|
$file =~ /\.qbs$/ or
|
|
$file =~ /\.qrc$/ or
|
|
$file =~ /\.txt$/i or
|
|
$file =~ /\/README[^\/]*$/i or
|
|
$file =~ /\/LICENSE.LGPLv21$/i or
|
|
$file =~ /\/LICENSE.LGPLv3$/i or
|
|
$file =~ /\.ui$/i or
|
|
$file =~ /\.xml$/ or
|
|
$file =~ /\.css$/ or
|
|
$file =~ /\.metainfo$/ or
|
|
$file =~ /\.json$/ or
|
|
$file =~ /\.pl$/ or
|
|
$file =~ /\.py$/ or
|
|
$file =~ /\.sh$/ or
|
|
$file =~ /\.bat$/ or
|
|
$file =~ /\.patch$/ or
|
|
$file =~ /\.sed$/ or
|
|
$file =~ /\.pro\.user$/ or
|
|
$file =~ /\.plist$/ or
|
|
$file =~ /\.qdocconf$/i or
|
|
$file =~ /\.qdocinc/);
|
|
return 0;
|
|
}
|
|
|
|
while (1) {
|
|
my $file = shift;
|
|
last unless $file;
|
|
|
|
my $hasCopyright = 0;
|
|
my $hasCurrent = 0;
|
|
my $hasContact = 0;
|
|
my $hasCommercial = 0;
|
|
my $hasLGPL = 0;
|
|
my $hasGPL = 0;
|
|
my $hasDigia = 0;
|
|
my $linecount = 0;
|
|
|
|
if ($file !~ /\.png$/) {
|
|
open(my $fh, "<", $file) or die "Could not open $file.\n";
|
|
|
|
while (<$fh>) {
|
|
$linecount++;
|
|
last if ($linecount > 50);
|
|
|
|
$hasCopyright = 1 if $_ =~ /Copyright/i;
|
|
$hasCurrent = 1 if $_ =~ /\(c\).*\s2014/i;
|
|
|
|
$hasContact = 1 if $_ =~ /Contact: http:\/\/www.qt-project.org\/legal/;
|
|
$hasCommercial = 1 if $_ =~ /Commercial (License )?Usage/;
|
|
$hasDigia = 1 if $_ =~ /Digia Plc/;
|
|
$hasLGPL = 1 if $_ =~ /GNU Lesser General Public License Usage/;
|
|
$hasGPL = 1 if $_ =~ /GNU General Public License Usage/;
|
|
}
|
|
close $fh;
|
|
}
|
|
|
|
unless ($hasCopyright) {
|
|
print "$file\t";
|
|
if (canIgnoreNoCopyright($file)) {
|
|
print "Warning\t";
|
|
} else {
|
|
print "ERROR\t";
|
|
}
|
|
print "No copyright\n";
|
|
next;
|
|
}
|
|
|
|
unless ($hasCurrent) {
|
|
print "$file\tERROR\tcopyright outdated\n";
|
|
next;
|
|
}
|
|
|
|
unless ($hasDigia) {
|
|
print "$file\tERROR\tNo digia\n";
|
|
next;
|
|
}
|
|
|
|
if (!$hasContact && $file !~ /\.json\.in$/) {
|
|
print "$file\tERROR\tWrong contact\n";
|
|
next;
|
|
}
|
|
|
|
unless ($hasCommercial) {
|
|
print "$file\tERROR\tNo commercial license\n";
|
|
next;
|
|
}
|
|
|
|
unless ($hasLGPL) {
|
|
print "$file\tERROR\tNo LGPL license\n";
|
|
next;
|
|
}
|
|
|
|
if ($hasGPL) {
|
|
print "$file\tERROR\tHas GPL license\n";
|
|
next;
|
|
}
|
|
|
|
print "$file\tinfo\tCopyright OK\n";
|
|
|
|
} # loop over files
|
|
|
|
exit 0;
|