summaryrefslogtreecommitdiff
path: root/git-hooks
Commit message (Collapse)AuthorAgeFilesLines
* Do not check spelling of licensesHEADmasterKai Köhne2023-05-151-1/+1
| | | | | | | | | | The top-level LICENSES directory is reserved for standard license texts. It does not make much sense to complain about spelling there (for instance licence -> license) Change-Id: Id6eb682a71d7188a0b36ddf6e8601913f277d611 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
* sanitize-commit: add support for C++17 if-constexprMarc Mutz2023-05-091-1/+1
| | | | | | | | | | | | ... to flow-control-keyword white-space check, so if constexpr(foo) { doesn't go undetected anymore. Change-Id: I1dbdb5ffd1f1f4e0ce72914d7d75beb3f6c10889 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
* sanitize-commit: complain about missing Coverity-Id footersMarc Mutz2023-04-281-0/+9
| | | | | | Change-Id: Ib24710488f48b0466fe3c222aad996b506c47494 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
* Allow non-numeric branches which do not begin with wip/Daniel Smith2023-03-291-1/+8
| | | | | | | | | | | | | | | | | Some repos are better suited to tracking remote branch names from other projects, rather than following the Qt branching scheme. When these branches do not conform to \d+.\d+.\d+, they are not included in the %allHeads of the sanity bot. As such, attempting to cherry-pick to any of these non-conforming branches will be given a -2 by the bot since it is unaware of the branch, even though the pick target is valid. Provide an option per repo to bypass, allowing non-numeric branches. Fixes: QTQAINFRA-5449 Change-Id: I6ca7772703572fdcc010f31dc9bacbbf4fa5e6a2 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> Reviewed-by: Jukka Jokiniva <jukka.jokiniva@qt.io>
* Add additional language to autogenerated file detectionDaniel Smith2023-03-031-1/+1
| | | | | | | Fixes: QTQAINFRA-5306 Change-Id: I9a43bb402f001ea72c58098e3154744e16438c76 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Add a check for QT_DEPRECATED macrosDaniel Smith2023-02-071-0/+3
| | | | | | | | | | | If a QT_DEPRECATED macro is added anywhere, the uploader should be reminded to also provide patches which update usages of the deprecated function. Task-number: QTQAINFRA-5376 Change-Id: Ie232e54e123da0060a854dedbeecd276322e3410 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Add 6.5 to the list of LTS branches for sanity botDaniel Smith2023-01-171-1/+1
| | | | | | Change-Id: Idc65f649f33ed78e8ddd58d0a124d5b325168f55 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> Reviewed-by: Dimitrios Apostolou <jimis@qt.io>
* Include tqtc/lts- and lts- branches in the list of all headsDaniel Smith2023-01-171-1/+1
| | | | | | | | | | | When these branches are missing from the heads, the sanity bot wrongly claims "Cherry-pick's source is not an upstream commit" when picking from an LTS branch to anywhere. Fixes: QTQAINFRA-5361 Change-Id: I9c35b61ca0f913aa5ec956aa947b928cfe685fba Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> Reviewed-by: Dimitrios Apostolou <jimis@qt.io>
* sanity: Complain about Q_CLANG_QDOCTor Arne Vestbø2022-10-041-0/+3
| | | | | | | | | | | qdoc is always based on clang these days, so Q_CLANG_QDOC can be reduced to just Q_QDOC. Change-Id: I56293e37126eeb8bb7b7d74ad1e35016811a3d9c Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Kai Koehne <kai.koehne@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Complain when pick-to footers do not contain the latest stable branchDaniel Smith2022-06-301-0/+18
| | | | | | | | | | | | | If a change targets the latest-1 stable branch, but neglects to include the current latest, the sanity bot should give a -1 warning with a comment. This situation often arises in changes shortly after qt branches to a new stable branch, as it's easy to forget the latest branch target has moved forward. Task-number: QTQAINFRA-5035 Change-Id: I2067c9b1865bd290183d77e46bca2f491708ca2b Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Warn about header files with a common non-.h extensionLuca Di Sera2022-06-281-1/+4
| | | | | | | | | | | | | | | It is an implied convention in the Qt project that header files should use a ".h" extension. As this might non be known by a contributor (especially if the contributor is from outside the QtCompany) or escape review, possibly requiring a bigger amount of work to change later, a new warning in the commit sanitizer script was included to warn about new files that have some common header extension that is not ".h". Change-Id: I83a25d829a63811c08a11f2a337707c62423f699 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> Reviewed-by: Daniel Smith <Daniel.Smith@qt.io>
* Leave sanitize-commit's $target undefined when no branch is givenEdward Welbourne2022-05-031-2/+2
| | | | | | | | | | | | | | | | | | It was previously unconditionally set, either to false or to the branch passed on the command line; but code tests it using defined($target), which was thus always true. Apparently the intent was to leave it undefined when no branch was given. Exposed by configuring my local repositories for picked modules to have with-pickbot enabled. This script is used as post-commit hook, passing only one argument, without the extra arguments the Qt Sanity bot on Gerrit passes, notably the one that supplies $target's value. The with-pickbot code thus got exercised in a new way, leading to a bogus warning. Change-Id: If4e035300d6017a7398e995be96e3dee2a0969ed Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> Reviewed-by: Daniel Smith <Daniel.Smith@qt.io>
* add 6.2 to LTS branches of Sanity BotDaniel Smith2022-04-221-1/+1
| | | | | | Change-Id: Icd1c306a5d691cd1888122ed153fd08c0f7234e7 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* sanitize-commit: Don't complain about "Contents/MacOS"Joerg Bornemann2021-11-261-1/+1
| | | | | | | | | Within bundles we still have a "Contents/MacOS" subdirectory despite being "incorrect terminology". Use negative look-behind to ignore "MacOS" if it's preceded by "Contents/". Change-Id: I1b8d975950f8f5f1cf916fc65f8e99642e71108a Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Match Unicode either as such or as UTF-8Edward Welbourne2021-11-151-1/+4
| | | | | | | | | | | | This is a fix-up for commit 8b17acbfde3c6f86d29e62f5de14e6b9340ac3ce; it turns out perl5, at least on our current systems, is encoding the data we're parsing in UTF-8. (Parent commit was tested with onlinegdb's version of perl, which was using naked Unicode, not UTF-8, so we may need the Unicode-form of the check, too.) Task-number: QTQAINFRA-4630 Change-Id: Ic93f9fc1d0cd1d8f6bf6ec1e695454974a84f620 Reviewed-by: Daniel Smith <Daniel.Smith@qt.io>
* Ban Unicode Bi-directional override characters from all text filesDaniel Smith2021-11-151-0/+5
| | | | | | | | | | | | | | | | | | | | Since gerrit cannot selectively disable display of unicode characters the sanity bot should give a -2 on any change which includes blacklisted unicode characters used in the bi-directional override attack vector. These characters should not appear in any reasonable code in The Qt Project. See "Trojan Source: Invisible Vulnerabilities" Authors: Nicholas Boucher and Ross Anderson, 2021 eprint: 2111.00169 archivePrefix: arXiv primaryClass: cs.CR url: https://arxiv.org/abs/2111.00169 Fixes: QTQAINFRA-4630 Change-Id: I1fbec7890239cf7ec6bb5b9f9a2f64b6a13aa60f Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Give a -1 when pick-to on a release branch lacks a pick to stable branchDaniel Smith2021-10-281-0/+8
| | | | | | | | | | | | This change should help ensure that fixes submitted directly to a release branch (often due to release crunches) make their way upstream to the stable branch. This check is limited to numerically versioned branches, 6.2.0 release branch for example has an upstream stable branch of 6.2. Change-Id: I17f6576c63a40f89802bad97111560086cce1465 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
* sanitize-commit: remove override keywords from hintsOswald Buddenhagen2021-05-211-5/+5
| | | | | | | hints need no overrides by definition. Change-Id: Idd12ac9d2de56f0ab0c9939bf32814a066fa8d32 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* sanity: introduce notobjc_check flag variableTor Arne Vestbø2021-05-211-5/+4
| | | | | | | amends ac9c5658. Change-Id: I245729457f54a04eeb076ec04296827901fbd612 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
* sanity: Warn when using __OBJC__ in non-Objective-C/C++ source filesTor Arne Vestbø2021-05-191-1/+9
| | | | | | | | | | The define will never be defined (unless someone explicitly passes -x to change the language the compiler uses, but we don't do that), so using the define in C/C++ source files is most likely an error and will result in dead code. Change-Id: I1eb578b76b0294ce415fce67e6665388812ae651 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Warn if something change-log-like doesn't start with [ChangeLog]Edward Welbourne2021-05-041-0/+2
| | | | | | Fixes: QTQAINFRA-4439 Change-Id: I22d5d0419a3ef4e8c3ca493124ed0d8be877dd2d Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
* add 5.15 to LTS branchesOswald Buddenhagen2021-01-061-1/+1
| | | | | | | | qttranslations sticks to forward-merging rather than cherry-picking, so this still makes sense. Change-Id: I7544df15403a559ebb694e3d08e40aebfd5c2849 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Sanity-bot: Fix warning about undefined symbol $branchFriedemann Kleint2020-09-151-2/+2
| | | | | | | | | | | | | | Check on $target instead, fixing: Global symbol "$branch" requires explicit package name (did you forget to declare "my $branch"?) at qtrepotools/git-hooks/sanitize-commit line 508. Remove excessive braces from warning message. Amends a2ebc6aedfc217e2af4b02ae97c7a598e85daff9. Task-number: QTQAINFRA-3886 Change-Id: I10224936115fb80a82b858b2784557a6f2db7cbe Reviewed-by: Daniel Smith <Daniel.Smith@qt.io> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
* Sanity Bot: Allow branches to be globally excludedDaniel Smith2020-09-081-4/+6
| | | | | | | | | | | | | | | Occasionally, a branch may need to be globally excluded from sanity-bot review. Such is the case in refs/meta/config, which is an internal gerrit config branch, and will never conform to sanity-bot review rules. Updated syntax for excluded-projects: <project>[:<branch>] where project can be the wildcard '*' to exclude a branch from all projects. Fixes: QTQAINFRA-3880 Change-Id: I2f7fb436021a8c87bd82f3091758acff97bd3d24 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
* Sanity-bot: Make sure Pick-to footer doesn't contain source branchDaniel Smith2020-09-081-0/+3
| | | | | | | | | | | | The sanity bot should warn if the source branch is in the Pick-to footer since this would be redundant and cause a failed pick attempt by the cherry-pick bot. Only exact branches are matched, since it is possible to submit a change to a minor branch with a Pick-to footer that targets a bugfix branch. Fixes: QTQAINFRA-3886 Change-Id: I234d20205bd3896b7be631ba29db2efe895b9bd3 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
* Sanity: Exclude also testdata-* from copyright checkOrgad Shaneh2020-08-231-1/+1
| | | | | | | For example, testdata-qt in qbs/527d5a8ec54e44291d4968754bdf574ebe57822b Change-Id: I072327c111bb0ba010bc606fabf56a9ebc6c0d95 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
* Sanity: Exclude also testdata_ from copyright checkOrgad Shaneh2020-08-221-1/+1
| | | | | | | | | | | | https://codereview.qt-project.org/c/qt-creator/qt-creator/+/299771 added tests with directories named tests/cppmodelmanager/testdata_project1 and testdata_project2. As these directories contain test-related header files, they should not require copyright headers. Change-Id: I24ba03fbbf47dddd18d8d8d1a96498ad1301ea3a Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
* Allow periods in summary when 'etc' is the last wordDaniel Smith2020-08-141-1/+1
| | | | | | | | Fixes: QTQAINFRA-3866 Change-Id: I0872dc2880f3ceb60c6efeb15d72b6bf627c4051 Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Sanity-bot: Add /perfdata/ to the whitelist of test data directoriesDaniel Smith2020-07-101-1/+1
| | | | | | | | | | | "perfdata" should be an accepted testdata directory name, since it's logical to separate correctness data from performance data in test directories. Fixes: QTQAINFRA-3841 Change-Id: I3b1522a58c94e5b42774ecd8b0a658c2f8936ef4 Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
* Sanity-bot: Fix typo in commit message parserDaniel Smith2020-07-101-1/+1
| | | | | | | | | Committer name/email have never been checked for validity due to a typo. Change-Id: Ida571959bbe56d7c4ca2c0e20f50ad13dc81ce71 Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
* Gerrit-bot: Fix use of uninitialized variable when no sanity-reviewDaniel Smith2020-07-101-1/+2
| | | | | | | | | | | | If the Sanity-bot subprocess fails to generate a suitable output with the 'Sanity-Review' label, gerrit-bot restarts the process repeatedly, spamming the change in gerrit. Check for the uninitialized variable so the warning isn't thrown. Task-number: QTQAINFRA-3841 Change-Id: I9950e3242bc043d9d986f9e046d53a6ba1fecf17 Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
* Treat wip branches like dev to suppress cherry-pick messagesDaniel Smith2020-05-261-1/+1
| | | | | | | | | | | | | wip/* branches don't need to be notified of missing pick-to footers since users working on wip branches should know what they're doing. Even though cherry-pick bot is enabled in an entire repo, the usefulness of sanity-checking for pick-to footers is very limited in wip branches. The easiest way around this is to treat wip branches like dev when running in gerrit. Task-number: QTQAINFRA-3751 Change-Id: I81fd427e83ebcd703f9b1700bf00367544c98a0e Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
* take advantage of now having a proper ref->sha1 mappingOswald Buddenhagen2020-05-151-3/+2
| | | | | | | this makes things marginally faster, but mostly just more consistent. Change-Id: Ifdd84b54bb541ba13c9ff1fa349e0a2479f6060f Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* add validation according to the new cherry-picking policyOswald Buddenhagen2020-05-151-11/+61
| | | | | | | | Task-number: QTQAINFRA-3663 Started-by: Daniel Smith <daniel.smith@qt.io> Change-Id: Iafa560d52cbca4bbf490694982bc3cddaea08b20 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Daniel Smith <Daniel.Smith@qt.io>
* make gerrit-bot pass the branch name to sanitize-commitOswald Buddenhagen2020-05-152-18/+25
| | | | | | | | | | | | | guessing the target branch with the help of git-merge-base is unreliable when the user does a cross-branch push or the commit has simply an old base. therefore, explicitly pass in the branch if we already know it, which is the case on the server. Fixes: QTQAINFRA-3322 Started-by: Daniel Smith <daniel.smith@qt.io> Change-Id: I5fd1e827b9e169f4aa2eb3590bc4f252037d6ba0 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Daniel Smith <Daniel.Smith@qt.io>
* recognize space-separated tasks as well when complaining about themOswald Buddenhagen2020-05-151-2/+2
| | | | | Change-Id: I36eb87b815902b153134b1772f2a0707d4621d20 Reviewed-by: Daniel Smith <Daniel.Smith@qt.io>
* re-nest conditionsOswald Buddenhagen2020-05-121-11/+10
| | | | | | | this is clearer, and a tiny bit faster. Change-Id: I2bb0608876d18fa1241091abfbf940732c39d953 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* straighten out ChangeLog section state trackingOswald Buddenhagen2020-05-121-1/+5
| | | | | | | | | so far, footers in the middle of the changelog would suspend it, but not terminate it, which made no sense at all, given that the changelog is just a text section and footers separate text sections. Change-Id: I650c430700c8edc0c359ecc9c6b8b57f9632b5ae Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* fix handling of bogus change-log footersOswald Buddenhagen2020-05-081-3/+8
| | | | | | | | | | we cannot just pretend that a footer is a tag, as the semantics are entirely different, so there would be "interesting" follow-up effects. also, due to the cascading of the conditions, we'd never actually catch "Change-Log" footers. Change-Id: Ia4754316693e0afdac4d24d994b4d6c136977745 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* make the footer identification regex stricter againOswald Buddenhagen2020-05-081-1/+1
| | | | | | | | | | | | don't accept single words, as this leads to way too many false positives, as originally anticipated. instead, whitelist "Fixes" explicitly. amends ddd8ad86. Fixes: QTQAINFRA-2789 Change-Id: Iec23c24e942e0947b53162ab066f53394cabb851 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* suppress stderr output of git-merge-baseOswald Buddenhagen2020-05-081-2/+2
| | | | | | | | | | | when validating cherry-pick sources, we might be presented entirely unknown sha1s. don't spam stderr with the resulting error messages from git, as they are entirely expected. amends 51744f4f0. Change-Id: I9a5203ee1810ba6903eab9ad8bfb8f695e196ba5 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* rework creation of stable output for the autotestOswald Buddenhagen2020-05-081-9/+1
| | | | | | | | | | | instead of using tied hashes, just sort by line number. that's more thorough, cheaper, and less convoluted - so much that we can do it unconditionally. amends 1ae5efe70. Change-Id: Ieb5a6fc26379597cd30475b5725bed06205cb9c6 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Add Pick-to in the commit-msg hookOrgad Shaneh2020-04-211-1/+1
| | | | | | | This is needed for placing it before Change-Id. Change-Id: I9d1f0b220872941a7cb23f9c2aea5c990409ada3 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Expand the exemptions for test data filesEdward Welbourne2019-10-301-1/+1
| | | | | | | | | | | Along with not caring how messily they use space, we don't care if they end in a newline, lack a copyright notice or use terminology that might be mistaken for someone's trade-mark. Fixes: QTQAINFRA-2832 Change-Id: I08b919bf3f9c97e2d47598b69430d6fbf909f847 Reviewed-by: Orgad Shaneh <orgads@gmail.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
* Exempt tests/*/data/ as well as tests/*/testdata/ from the spacing testsEdward Welbourne2019-10-301-1/+1
| | | | | | | | | Plenty of existing tests use data/ rather than testdata/ as their data directories. Change-Id: I8398c35618313ec9571dd197da040b3f9671e42c Reviewed-by: Orgad Shaneh <orgads@gmail.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
* clang-format-pre-commit: Silence the noisy 'which' on WindowsFriedemann Kleint2019-10-141-2/+2
| | | | | Change-Id: I0fa8750ccff953dc690aee131f8b934704ad743d Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* clang-format-pre-commit: Find git-clang-format pointed to by LLVM_INSTALL_DIRFriedemann Kleint2019-10-141-1/+6
| | | | | | | | In a Qt setup, LLVM is pointed to by the variable but not in the path as not to auto-detect the Clang mkspec. Change-Id: If3dbaa158b7e9eb7e84745cf51afe0ea6e51aa1c Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* clang-format-pre-commit: Fix help text to list the likely correct commandFriedemann Kleint2019-10-141-1/+2
| | | | | Change-Id: Ie78af25b3ef855e3f88d9f075654649abe41fc4c Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Fix inverted logic in clang-format-pre-commitFrederik Gladhorn2019-10-111-1/+4
| | | | | | | And ignore when there are no relevant files, such as this commit. Change-Id: Ic8b747061822ad02538eacbcaa10f98332b6d9e7 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Prospective shell syntax fix for clang-pre-commit hookSimon Hausmann2019-10-101-1/+1
| | | | | | Change-Id: I231d81b599b2e8b0da135a53061ddb8173236c4b Reviewed-by: Leander Beernaert <leander.beernaert@qt.io> Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>