summaryrefslogtreecommitdiff
path: root/util/lint
AgeCommit message (Collapse)Author
2022-11-24util/lint: Ignore fmd files when evaluating Kconfig symbolsMartin Roth
Signed-off-by: Martin Roth <martin.roth@amd.corp-partner.google.com> Change-Id: I5e3ff8ee10fdd3514033e72bd0c2664a4b2f5310 Reviewed-on: https://review.coreboot.org/c/coreboot/+/69918 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Arthur Heymans <arthur@aheymans.xyz> Reviewed-by: Elyes Haouas <ehaouas@noos.fr>
2022-11-24lint/checkpatch: Add XA_STATE and XA_STATE_ORDER to the macro declarationElyes Haouas
This reduce the difference with linux v6.0-rc3. Signed-off-by: Elyes Haouas <ehaouas@noos.fr> Change-Id: Ica20264d744ea8f77b56c63d29e1fafc2e68a869 Reviewed-on: https://review.coreboot.org/c/coreboot/+/67338 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Martin L Roth <gaumless@gmail.com>
2022-11-22util: Add SPDX license headers to MakefilesMartin Roth
Signed-off-by: Martin Roth <gaumless@gmail.com> Change-Id: I7cf35132df0bc23f7b6f78014ddd72d58ea2ab8a Reviewed-on: https://review.coreboot.org/c/coreboot/+/68983 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Matt DeVillier <matt.devillier@amd.corp-partner.google.com> Reviewed-by: Elyes Haouas <ehaouas@noos.fr> Reviewed-by: Eric Lai <eric_lai@quanta.corp-partner.google.com>
2022-11-04checkpatch: add Co-authored-by to signature listMichael Niewöhner
Co-authored-by is commonly used for changes that have more than one author. Add it to the list to make Jenkins happy. Change-Id: I7f66824febe3be756c64ebf44c94bc653a66f1e1 Signed-off-by: Michael Niewöhner <foss@mniewoehner.de> Reviewed-on: https://review.coreboot.org/c/coreboot/+/69166 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Patrick Georgi <patrick@coreboot.org>
2022-10-29util/lint: fall back to regular grep in kconfig_lintSolomon Alan-Dei
Automatically fall back to using regular grep if working outside a git repository and the option to use regular grep is not specified Signed-off-by: Solomon Alan-Dei <alandei.solomon@gmail.com> Change-Id: I0cdecf01a0e74c30947c4fe7e7c7d9457a5165a1 Reviewed-on: https://review.coreboot.org/c/coreboot/+/66637 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Martin L Roth <gaumless@gmail.com>
2022-10-28lint/checkpatch: consider leading + in the line length limit checkMichael Niewöhner
The line length limit in coreboot's coding style guidelines applies to the final file, while checkpatch currently checks the patch line length. Since patches´ lines start with a `+` (only added content is checked), the line length being checked is one character longer than the actual content. Increase max_line_length by 1 to take this into account. Change-Id: I8da45bb0d5fbe7d0e12c8b181cf01e5685186bf6 Signed-off-by: Michael Niewöhner <foss@mniewoehner.de> Reviewed-on: https://review.coreboot.org/c/coreboot/+/68869 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Tim Wawrzynczak <inforichland@gmail.com>
2022-10-21util/lint: Fix linting outside of git reposMartin Roth
If the coreboot code is not in a git repository, the linters switch from using `git ls-files` to find. This requires some changes to prevent the linters from looking at the wrong files which are automatically excluded by git. Signed-off-by: Martin Roth <gaumless@gmail.com> Change-Id: I81d138760c29a7c476280bb9d963f6be99c75d6d Reviewed-on: https://review.coreboot.org/c/coreboot/+/68475 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Elyes Haouas <ehaouas@noos.fr> Reviewed-by: Paul Menzel <paulepanter@mailbox.org> Reviewed-by: Fred Reitberger <reitbergerfred@gmail.com> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
2022-10-10util/lint/lint-stable-003-whitespace: Fix shell variable nameFred Reitberger
Fix shell variable "LINTDIR" so that helper_functions.sh can be found. TEST=`./util/lint/lint lint-stable --junit` no longer prints "cannot open /helper_functions.sh: No such file" Signed-off-by: Fred Reitberger <reitbergerfred@gmail.com> Change-Id: I68f2e65fa1c9297ad6b58b77576deaeef8bd76e3 Reviewed-on: https://review.coreboot.org/c/coreboot/+/68225 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Elyes Haouas <ehaouas@noos.fr>
2022-09-30util/lint: Update tools that use git to use a libraryMartin Roth
Each of the tools that used git had similar functionality. This combines all of that into a single script that gets sourced by each. This makes maintenance much easier. By doing this and updating each of the scripts to do the correct thing if the script isn't being run in a git repository, it makes them work much better for the releases, which are just released as a tarball, without any attached git repository. Change-Id: I61ba1cc4f7205e0d4baf993588bbc774120405cb Signed-off-by: Martin Roth <martin@coreboot.org> Reviewed-on: https://review.coreboot.org/c/coreboot/+/64973 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Elyes Haouas <ehaouas@noos.fr>
2022-09-30util/lint: Update spelling.txt, add makefile to sort itMartin Roth
- Update spelling.txt with Lintian changes - Remove words that are going to mess up code - Add comments to the header about what words should be removed, along with where the files - Add Makefile to sort the list Note that this undoes some of the sorting that Patrick introduced in commit CB:38632 - ID: 805b291830 I just cannot reproduce his sort order, even using the script he put into the commit message. Signed-off-by: Martin Roth <gaumless@gmail.com> Change-Id: Ic131d5b08409f43eb700dcc8f125af00cff53d71 Reviewed-on: https://review.coreboot.org/c/coreboot/+/64893 Reviewed-by: Elyes Haouas <ehaouas@noos.fr> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2022-09-14util/lint: Add a check for touchpads using the "probed" flagMatt DeVillier
As of commit 2cf52d80a6ec ("mb/*/{device,override}tree: Set touchpads to use detect (vs probed) flag") all touchpads in the tree have been switched from using the 'probed' flag to 'detect.' Add a lint check to ensure no touchpads are added with the probed flag. TEST=manually change one touchpad to use 'probed' flag and ensure lint check catches it. Change-Id: Ie0aee2e3778fc56c6c21c97995738a147a1fa0d4 Signed-off-by: Matt DeVillier <matt.devillier@amd.corp-partner.google.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/67486 Reviewed-by: Martin Roth <martin.roth@amd.corp-partner.google.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Felix Held <felix-coreboot@felixheld.de>
2022-09-07util/lint/lint: Add -I option to invert test resultsMartin Roth
To test the linters, we want to invert the results so that any test that passes shows up as a failure. This will allow us to verify that all of the linters are working correctly. This will be tested nightly as well as on changes to the lint tools. Signed-off-by: Martin Roth <gaumless@gmail.com> Change-Id: Ia8024c6ab0c91fd9f630f37dc802ed3bc6b4608c Reviewed-on: https://review.coreboot.org/c/coreboot/+/67193 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Raul Rangel <rrangel@chromium.org>
2022-09-06lint/checkpatch: Fix incorrect camelcase detection on numeric constantElyes Haouas
This reduce the difference with linux v6.0-rc3. Signed-off-by: Elyes Haouas <ehaouas@noos.fr> Change-Id: I15e1a935665c38b8a2109d412b1d16f935cbb402 Reviewed-on: https://review.coreboot.org/c/coreboot/+/67337 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Martin L Roth <gaumless@gmail.com>
2022-09-06util/lint/lint-stable-019-header-files: add testMartin Roth
Add a test to make sure that the linter fails correctly. Signed-off-by: Martin Roth <gaumless@gmail.com> Change-Id: I971951d4248dd10abe4c622025fdaf86e014c6cc Reviewed-on: https://review.coreboot.org/c/coreboot/+/67351 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Elyes Haouas <ehaouas@noos.fr>
2022-09-06util/lint: Add rules.h & compiler.h to 019-header-files linterMartin Roth
The rules.h & compiler.h includes were removed in previous commits, so add the checks to keep them out to the linter. Signed-off-by: Martin Roth <gaumless@gmail.com> Change-Id: If4964ff26f5e83abbbdd26c2b1cd9a2eab5a0a0d Reviewed-on: https://review.coreboot.org/c/coreboot/+/67350 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Elyes Haouas <ehaouas@noos.fr>
2022-09-05util/lint: ignore util/goswid, a new submoduleMartin Roth
git submodules should be ignored when parsing the coreboot tree for lint errors. Those should be handled in their own commit checks. Signed-off-by: Martin Roth <gaumless@gmail.com> Change-Id: I62b58f0c536312fe4677855bca8f44bc7d3ebc85 Reviewed-on: https://review.coreboot.org/c/coreboot/+/67327 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Elyes Haouas <ehaouas@noos.fr>
2022-09-04util/lint: Add lint tests to make sure they fail correctlyMartin Roth
Change-Id: I1ff3302acdd5bc5d17a5d394d953b6877750b6a6 Signed-off-by: Martin Roth <martin@coreboot.org> Reviewed-on: https://review.coreboot.org/c/coreboot/+/64974 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Raul Rangel <rrangel@chromium.org>
2022-09-03util/lint/lint: Reformat usageMartin Roth
Signed-off-by: Martin Roth <gaumless@gmail.com> Change-Id: I684d374bd02a42e178383c26936e137e173f8f7e Reviewed-on: https://review.coreboot.org/c/coreboot/+/67192 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Elyes Haouas <ehaouas@noos.fr>
2022-09-03util/lint/lint: Add command line parsingMartin Roth
The lint script just did very basic argument parsing and required the sub-command and --junit argument to be in specific locations. I'm adding additional commands, so the first step is to add true command line parsing. Signed-off-by: Martin Roth <gaumless@gmail.com> Change-Id: I7118c29e6c5d785b35a7ae12cf5984c43ebc3ab9 Reviewed-on: https://review.coreboot.org/c/coreboot/+/67191 Reviewed-by: Raul Rangel <rrangel@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2022-08-22lint-000-license-headers: Add src/sbom/TAGS to exception listFelix Singer
Commit 6dac0c54cd0b makes the linter checking for license headers on all files from the src directory. Since this TAGS file doesn't have one, it's causing a linter error and it makes the QA system complain. However, the TAGS file doesn't need a license header and thus add it to the exception list. Usually the build tests detect such issues, but commit 1d7a9debf241, which introduced that file, was merged independently from the other commit, which modifies the linter. Also, the patch that is introducing this file was based on an older commit at which the patch modifying the linter wasn't merged yet and so this issue was hidden. Change-Id: I78da3fa70c39b709478a384da8769fc058ca18ce Signed-off-by: Felix Singer <felixsinger@posteo.net> Reviewed-on: https://review.coreboot.org/c/coreboot/+/66938 Reviewed-by: Angel Pons <th3fanbus@gmail.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2022-08-17util/lint: Check files of all sizes for licensesMartin Roth
Signed-off-by: Martin Roth <martin.roth@amd.corp-partner.google.com> Change-Id: Ib97d009c056b487136f20e5341b31183c65ef761 Reviewed-on: https://review.coreboot.org/c/coreboot/+/66504 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Marshall Dawson <marshalldawson3rd@gmail.com>
2022-08-17util/lint: Update to check all of src for license headersMartin Roth
This wasn't done previously because not all files in the src directory had the correct headers. Doing this earlier would have broken the build. Signed-off-by: Martin Roth <martin.roth@amd.corp-partner.google.com> Change-Id: Ia6d7a7a17116e4c8e55354783085355fd45ff87a Reviewed-on: https://review.coreboot.org/c/coreboot/+/66505 Reviewed-by: Paul Menzel <paulepanter@mailbox.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Marshall Dawson <marshalldawson3rd@gmail.com>
2022-08-11util/lint: Add .gitignore files to list that don't need a licenseMartin Roth
Signed-off-by: Martin Roth <martin.roth@amd.corp-partner.google.com> Change-Id: I568a357b40e8bb69b2b26752d241f06adfbe029e Reviewed-on: https://review.coreboot.org/c/coreboot/+/66503 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Marshall Dawson <marshalldawson3rd@gmail.com> Reviewed-by: Matt DeVillier <matt.devillier@amd.corp-partner.google.com>
2022-08-10util/lint & LICENSES: Add PDDC as a "license" for corebootMartin Roth
The Creative Commons Public Domain Dedication and Certification is not a license in the common sense in that it's stating that the associated file is already in the public domain (having no copyright), and is not actually putting it in the public domain like the CC-C0 license does. The use for this in coreboot is for unlicensable files - either blank files or files with no creative content. This allows these files to have the SPDX identifier to identify them as having no known copyright for open source license compliance. If CC-PDM-1.0 is ever included in the list of SPDX licenses, that would probably fit better, but because the public domain mark isn't actually a license, and because "public domain" isn't well defined, CC-PDM was rejected as a SPDX identifier. For further information: https://web.archive.org/web/20201018194411/https://github.com/spdx/license-list-XML/issues/988 Change-Id: Ibb300ecd066cde2a016195c2beca76a460c588e3 Signed-off-by: Martin Roth <martin.roth@amd.corp-partner.google.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/66496 Reviewed-by: Elyes Haouas <ehaouas@noos.fr> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Michael Niewöhner <foss@mniewoehner.de>
2022-08-10util/lint & LICENSES: Add GCC-exception-3.1 to license exceptionsMartin Roth
The gcov files in the lib directory are licensed GPL 3.0 with the GCC runtime library exception. Add this as a valid license so that the files can get a correct SPDX identifier. Signed-off-by: Martin Roth <martin.roth@amd.corp-partner.google.com> Change-Id: I1cf9c3125592741923c9b4481038055f24fe6ab1 Reviewed-on: https://review.coreboot.org/c/coreboot/+/66495 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Paul Menzel <paulepanter@mailbox.org> Reviewed-by: Elyes Haouas <ehaouas@noos.fr> Reviewed-by: Michael Niewöhner <foss@mniewoehner.de>
2022-07-19lint/checkpatch: Add check for used comma where semicolon could beElyes Haouas
This reduce the difference with linux v5.19-rc7. Signed-off-by: Elyes Haouas <ehaouas@noos.fr> Change-Id: I6d3a49378008bad61b2a18bd8cb28be952a18006 Reviewed-on: https://review.coreboot.org/c/coreboot/+/65837 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Martin L Roth <gaumless@tutanota.com>
2022-07-19lint/checkpatch: Add a check for use of self-assignmentsElyes Haouas
This reduce the difference with linux v5.19-rc7. Signed-off-by: Elyes Haouas <ehaouas@noos.fr> Change-Id: If47a7826ee67a2be25a4caa2a447484e5f11411b Reviewed-on: https://review.coreboot.org/c/coreboot/+/65836 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Martin L Roth <gaumless@tutanota.com>
2022-07-19lint/checkpatch: Add a check for existence of a commit logElyes Haouas
This reduce the difference with linux v5.19-rc7. Signed-off-by: Elyes Haouas <ehaouas@noos.fr> Change-Id: I4e3b98140d900c5717f4badde71c7be88fd1e23a Reviewed-on: https://review.coreboot.org/c/coreboot/+/65835 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Martin L Roth <gaumless@tutanota.com>
2022-07-19lint/checkpatch: Update 'Check patch "separator" and "signoff"'Elyes Haouas
This reduce the difference with linux v5.19-rc7. Signed-off-by: Elyes Haouas <ehaouas@noos.fr> Change-Id: Id3d7375216af5bf75ed7ce61fa8ea2dfebe8ac77 Reviewed-on: https://review.coreboot.org/c/coreboot/+/65834 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Martin L Roth <gaumless@tutanota.com>
2022-07-19lint/checkpatch: Update 'check for unwanted Gerrit info'Elyes Haouas
This reduce the difference with linux v5.19-rc7. Signed-off-by: Elyes Haouas <ehaouas@noos.fr> Change-Id: I856bfa0f0d39fda549671b1029cccdc39f831bab Reviewed-on: https://review.coreboot.org/c/coreboot/+/65833 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Martin L Roth <gaumless@tutanota.com>
2022-07-19lint/checkpatch: Update 'uncoalesced string fragments'Elyes Haouas
This reduce the difference with linux v5.19-rc7. Signed-off-by: Elyes Haouas <ehaouas@noos.fr> Change-Id: I21b2a0d87cbf610fc48e273ed78ab779ad4a6932 Reviewed-on: https://review.coreboot.org/c/coreboot/+/65832 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Martin L Roth <gaumless@tutanota.com>
2022-07-19lint/checkpatch: Update 'concatenated string without spaces between elements'Elyes Haouas
This reduce the difference with linux v5.19-rc7. Signed-off-by: Elyes Haouas <ehaouas@noos.fr> Change-Id: I04e58aca4a30e82f3da0cda08403d0daf3b5fb10 Reviewed-on: https://review.coreboot.org/c/coreboot/+/65831 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Martin L Roth <gaumless@tutanota.com>
2022-07-19lint/checkpatch: Update 'check indentation of a line with a break'Elyes Haouas
This reduce the difference with linux v5.19-rc7. Signed-off-by: Elyes Haouas <ehaouas@noos.fr> Change-Id: I79170a45cd8184ebc816b4f16656a3cfdc257f60 Reviewed-on: https://review.coreboot.org/c/coreboot/+/65828 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Martin L Roth <gaumless@tutanota.com>
2022-07-19lint/checkpatch: Update 'check for logical continuations'Elyes Haouas
This reduce the difference with linux v5.19-rc7. Signed-off-by: Elyes Haouas <ehaouas@noos.fr> Change-Id: I222e3378ded4cd73d0141cd1e38ac3282d311cc4 Reviewed-on: https://review.coreboot.org/c/coreboot/+/65827 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Martin L Roth <gaumless@tutanota.com>
2022-07-19lint/checkpatch: Update 'check for adding lines without a newline'Elyes Haouas
This reduce the difference with linux v5.19-rc7. Signed-off-by: Elyes Haouas <ehaouas@noos.fr> Change-Id: I1bd68e9a6609a3dfa7dc856f24e4b616714d9990 Reviewed-on: https://review.coreboot.org/c/coreboot/+/65826 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Martin L Roth <gaumless@tutanota.com>
2022-07-19lint/checkpatch: Update 'check for assignments on the start of a line'Elyes Haouas
This reduce the difference with linux v5.19-rc7. Signed-off-by: Elyes Haouas <ehaouas@noos.fr> Change-Id: Ia7d4b0176bad849e79f037f74c3d99ce9eb061c0 Reviewed-on: https://review.coreboot.org/c/coreboot/+/65825 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Martin L Roth <gaumless@tutanota.com>
2022-06-22util/lint: Add coreboot specific dictionary fileMartin Roth
This is a wordlist that I've compiled to use in spellcheckers to ignore all of the coreboot specific terms. Signed-off-by: Martin Roth <gaumless@gmail.com> Change-Id: I718519000eaf31786380474eb71b99ca442e3bed Reviewed-on: https://review.coreboot.org/c/coreboot/+/64809 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Elyes Haouas <ehaouas@noos.fr> Reviewed-by: Felix Singer <felixsinger@posteo.net>
2022-05-29util/lint/checkpatch: Add alloc functions to alloc with multiplies checkElyes Haouas
This reduce difference with linux v5.18. Change-Id: Id9412f7b6c0b9f76b39a094142aaded5c2aa1059 Signed-off-by: Elyes Haouas <ehaouas@noos.fr> Reviewed-on: https://review.coreboot.org/c/coreboot/+/64740 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Martin L Roth <gaumless@tutanota.com>
2022-05-29util/lint/checkpatch: Update 'Check for compiler attributes'Elyes Haouas
This reduce difference with linux v5.18. Signed-off-by: Elyes Haouas <ehaouas@noos.fr> Change-Id: I817630321587dec515cd94aa7b73a17819526190 Reviewed-on: https://review.coreboot.org/c/coreboot/+/64604 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Martin L Roth <gaumless@tutanota.com>
2022-05-29util/lint/checkpatch.pl: Use 'allocFunctions'Elyes Haouas
This reduce difference with linux v5.18. Change-Id: I1fc71b9cb6a4e4f8b27fbe6d45f4fa4e2c236157 Signed-off-by: Elyes Haouas <ehaouas@noos.fr> Reviewed-on: https://review.coreboot.org/c/coreboot/+/64603 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Martin L Roth <gaumless@tutanota.com>
2022-05-28util/lint/checkpatch: Warn on period at the end of commit subjectMartin Roth
This gives a warning when there's a period at the end of the commit subject line. Change-Id: If95bef3ba01e0ac13ce18045928081040abef4fd Signed-off-by: Martin Roth <martin@coreboot.org> Reviewed-on: https://review.coreboot.org/c/coreboot/+/63032 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Elyes Haouas <ehaouas@noos.fr> Reviewed-by: Paul Menzel <paulepanter@mailbox.org>
2022-05-28util/lint: Subtract the patch format string from subject lengthMartin Roth
Checkpatch was looking for a 65 character length, but format-patch adds the text "Subject: [PATCH] " before the actual subject. Checkpatch needs to account for that when looking at the line length. Lines 2863 & 2864 have their indentation fixed as well. Signed-off-by: Martin Roth <gaumless@gmail.com> Change-Id: I2f2ee6e0f1b14ae6393ed7e64ba1266aa9debc7d Reviewed-on: https://review.coreboot.org/c/coreboot/+/64656 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Elyes Haouas <ehaouas@noos.fr>
2022-05-28util/lint: Add commit message parsing to checkpatch_json scriptMartin Roth
The commit message wasn't being parsed because there's no filename associated with it in the patch output. This change adds the "filename" for the commit message in Gerrit for any errors that have a line number but no filename. calculations is intentionally misspelled as cacluations as a test. Change-Id: Ie7a2ef06419c7090c8e44b3b734b1edf966597cc Signed-off-by: Martin Roth <martin@coreboot.org> Reviewed-on: https://review.coreboot.org/c/coreboot/+/63031 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Elyes Haouas <ehaouas@noos.fr>
2022-05-24util/lint/checkpatch.pl: Reduce difference with linux v5.18Elyes Haouas
Signed-off-by: Elyes Haouas <ehaouas@noos.fr> Change-Id: Id5eb4823399088746a34721a9855bbaf5f97b7b6 Reviewed-on: https://review.coreboot.org/c/coreboot/+/64572 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Martin L Roth <gaumless@tutanota.com>
2022-05-16Allow trailing whitespaces in .md filesMaximilian Brune
Two trailing whitesspaces have an actual meaning in Markdown files (a new line). Signed-off-by: Maximilian Brune <maximilian.brune@9elements.com> Change-Id: Ibdb92ee857ee4ad32b6afb84ace427b27b41bb7c Reviewed-on: https://review.coreboot.org/c/coreboot/+/64032 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Martin L Roth <gaumless@tutanota.com>
2022-05-16util/lint/lint-stable-019: Update grep '\s' to [[:blank:]]Martin Roth
For some reason, the '\s' syntax is causing an error for me under freebsd. It's entirely possible that I'm doing something wrong, but this change should be fine regardless. Freebsd's grep, GNU grep, and git grep all handle posix regex classes, so this change should be transparent. Signed-off-by: Martin Roth <gaumless@gmail.com> Change-Id: I489ec13b4ea2e9c17692888e42b8741763b1a2c5 Reviewed-on: https://review.coreboot.org/c/coreboot/+/63532 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Felix Singer <felixsinger@posteo.net>
2022-05-16util/lint/checkpatch.pl: Fix "uninitialized value" error messageElyes Haouas
Change-Id: I74807f240779060158c6769f63a6e9438a6e5fbe Signed-off-by: Elyes Haouas <ehaouas@noos.fr> Reviewed-on: https://review.coreboot.org/c/coreboot/+/64173 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Martin L Roth <gaumless@tutanota.com>
2022-05-16util/lint/checkpatch.pl: Fix "Invalid color mode" error messageElyes Haouas
Remove duplicated code: "if ($color =~ /^[01]$/) { $color = !$color; } elsif ($color =~ /^always$/i) { $color = 1; } elsif ($color =~ /^never$/i) { $color = 0; } elsif ($color =~ /^auto$/i) { $color = (-t STDOUT); } else { die "$P: Invalid color mode: $color\n"; }" Change-Id: I5713c364edea806e58df26c3a37b4bba7603ed0a Signed-off-by: Elyes Haouas <ehaouas@noos.fr> Reviewed-on: https://review.coreboot.org/c/coreboot/+/64172 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Martin L Roth <gaumless@tutanota.com>
2022-04-24util/lint/checkpatch.pl: Update lines related to CONST_STRUCTElyes Haouas
Update to v5.18-2 version. Signed-off-by: Elyes Haouas <ehaouas@noos.fr> Change-Id: I0fe2ec6a74a4b8c70452fbf05d534a37e1ea2c26 Reviewed-on: https://review.coreboot.org/c/coreboot/+/63582 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Martin L Roth <martinroth@google.com>
2022-04-24util/lint/checkpatch.pl: Add strlcpy checkElyes Haouas
Update to v5.18-2 Signed-off-by: Elyes Haouas <ehaouas@noos.fr> Change-Id: Ic4eaa3f26bcd60ea509a52d5715c7ce1f43b6d3d Reviewed-on: https://review.coreboot.org/c/coreboot/+/63581 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Martin L Roth <martinroth@google.com>
2022-04-24util/lint/checkpatch.pl: Update C99_COMMENT_TOLERANCE linesElyes Haouas
Update to v5.18-2 version. Signed-off-by: Elyes Haouas <ehaouas@noos.fr> Change-Id: If230fa5cd01ab3ce91d8c910667c3d609cf978b0 Reviewed-on: https://review.coreboot.org/c/coreboot/+/63580 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Martin L Roth <martinroth@google.com>
2022-04-24util/lint/checkpatch.pl: Update TYPECAST_INT_CONSTANT linesElyes Haouas
Update to v5.18-2 version. Signed-off-by: Elyes Haouas <ehaouas@noos.fr> Change-Id: I8ed89e53f647b1b071abff33a434fb3b8dbb1de1 Reviewed-on: https://review.coreboot.org/c/coreboot/+/63579 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Martin L Roth <martinroth@google.com>
2022-04-24util/lint/checkpatch.pl: Update the check of repeated wordsElyes Haouas
Update to v5.18-2 version. Signed-off-by: Elyes Haouas <ehaouas@noos.fr> Change-Id: I7f5e597bb76e1b9feeb2d6ea290626f45e9fe6c0 Reviewed-on: https://review.coreboot.org/c/coreboot/+/63577 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Martin L Roth <martinroth@google.com>
2022-04-24lint/checkpatch.pl: Update to v5.18-2 lines related to "CONFIG_"Elyes Haouas
Signed-off-by: Elyes Haouas <ehaouas@noos.fr> Change-Id: I8589d053871ad9ac64ae2f8fc380710be8e4556b Reviewed-on: https://review.coreboot.org/c/coreboot/+/63576 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Martin L Roth <martinroth@google.com>
2022-04-24util/lint/checkpatch.pl: Update lines related to max_line_lengthElyes Haouas
Upadate to v5.18-2 version. Signed-off-by: Elyes Haouas <ehaouas@noos.fr> Change-Id: Ib9927bfa98e20d4b621bf7abecec234b4754ee9c Reviewed-on: https://review.coreboot.org/c/coreboot/+/63439 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Martin L Roth <martinroth@google.com>
2022-04-24util/lint/checkpatch.pl: Update lines related to tabsizeElyes Haouas
Update to v5.18-2 version. Signed-off-by: Elyes Haouas <ehaouas@noos.fr> Change-Id: I6651a3f8e79beca2e1235fe8de3217875f81ba2b Reviewed-on: https://review.coreboot.org/c/coreboot/+/63438 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Martin L Roth <martinroth@google.com>
2022-04-24util/lint/checkpatch.pl: Update to v5.18-2 lines related to verbosityElyes Haouas
Signed-off-by: Elyes Haouas <ehaouas@noos.fr> Change-Id: I66f38cb01e58ee241bf58c4db83693029ddebcfa Reviewed-on: https://review.coreboot.org/c/coreboot/+/63437 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Martin L Roth <martinroth@google.com>
2022-04-11util/lint/checkpatch.pl: Update to v5.18-2 lines related to "codespell"Elyes Haouas
Change-Id: I55cc4255ea88723c813a04d87e4c028c64f92dbd Signed-off-by: Elyes Haouas <ehaouas@noos.fr> Reviewed-on: https://review.coreboot.org/c/coreboot/+/63435 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Martin Roth <martinroth@google.com>
2022-03-25util/lint/checkpatch: Update commit message & subject line limitsMartin Roth
The commit message has a (soft) line length limit of 72 characters and the subject has a (soft) line limit of 65 characters. This change updates checkpatch to warn at those limits. Note that neither of these are hard limits because git & gerrit can both handle longer lines, it just doesn't look good. Change-Id: I4ef131a65254e2b184b05e0215969aef97e12712 Signed-off-by: Martin Roth <martin@coreboot.org> Reviewed-on: https://review.coreboot.org/c/coreboot/+/63029 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Paul Menzel <paulepanter@mailbox.org> Reviewed-by: Elyes Haouas <ehaouas@noos.fr> Reviewed-by: Felix Singer <felixsinger@posteo.net>
2022-02-01util/lint/checkpatch.pl: Use "git_command"Elyes HAOUAS
This is to reduce difference with linux v5.16. Change-Id: I7abd4d8eed856eee841422515db2ff7f50ecd0a4 Signed-off-by: Elyes HAOUAS <ehaouas@noos.fr> Reviewed-on: https://review.coreboot.org/c/coreboot/+/61471 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Martin Roth <martinroth@google.com>
2022-01-31util/lint/checkpatch.pl: Use "gitroot"Elyes HAOUAS
This is to reduce difference with linux v5.16. Change-Id: I3bdf880c8b6068467665865b7cf1249d1047e833 Signed-off-by: Elyes HAOUAS <ehaouas@noos.fr> Reviewed-on: https://review.coreboot.org/c/coreboot/+/61470 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Martin Roth <martinroth@google.com>
2022-01-31util/lint/checkpatch: Update "check for missing blank lines after declarations"Elyes HAOUAS
This is to reduce difference with linux v5.16. Change-Id: I1b7bc2b4ec832f0abeda215c381856a5ec153883 Signed-off-by: Elyes HAOUAS <ehaouas@noos.fr> Reviewed-on: https://review.coreboot.org/c/coreboot/+/61469 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Martin Roth <martinroth@google.com>
2022-01-31util/lint/checkpatch.pl: Update 'commit message line length limit'Elyes HAOUAS
Also add "coreboot" comment on our modification. Change-Id: Ida58a92457e25bac7fb89bb5882e7647f388ec01 Signed-off-by: Elyes HAOUAS <ehaouas@noos.fr> Reviewed-on: https://review.coreboot.org/c/coreboot/+/61468 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Martin Roth <martinroth@google.com>
2022-01-31util/lint/checkpatch.pl: Remove unneeded whitespaces and fix some typosElyes HAOUAS
This is to reduce difference with linux v5.16. Change-Id: I4aa7abce83b41ccd5129717cd3bf85be19ec4807 Signed-off-by: Elyes HAOUAS <ehaouas@noos.fr> Reviewed-on: https://review.coreboot.org/c/coreboot/+/61467 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Martin Roth <martinroth@google.com>
2022-01-31util/lint/checkpatch.pl: Use "perl_version_ok"Elyes HAOUAS
Also use '$minimum_perl_version'. This is to reduce difference with linux v5.16. Change-Id: I7c2f5d5c9853dc8ddc8f89a5e2edd6c8613ba790 Signed-off-by: Elyes HAOUAS <ehaouas@noos.fr> Reviewed-on: https://review.coreboot.org/c/coreboot/+/61466 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Martin Roth <martinroth@google.com>
2022-01-31util/lint/checkpatch.pl: Use "tabsize"Elyes HAOUAS
This is to reduce difference with linux v5.16. Change-Id: Ifeb9c4406737fa24f9bd803af48d8b8d17654940 Signed-off-by: Elyes HAOUAS <ehaouas@noos.fr> Reviewed-on: https://review.coreboot.org/c/coreboot/+/60874 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Martin Roth <martinroth@google.com>
2022-01-31util/lint: Remove SuperIO from checkpatch spellcheckMartin Roth
Patch 423e9e0fc0: Documentation/lint: Use Super I/O instead of SuperIO added the word SuperIO to the checkpatch spelling list. There were unfortunately some issues with this. 1) This introduced a problem because the comparison is used in different cases in different places. The misspelled word is compared ignoring the case, but when looking for the correct word, it looks through the list for the misspelling in all lowercase. When it couldn't find the word "superio" in the list, the variable came back uninitialized. 2) The spellcheck feature isn't enabled in checkpatch unless the option --strict is enabled, so this wasn't getting reported anyway. 3) SuperIO (or superio) will match the KCONFIG options such as CONFIG_SUPERIO_NUVOTON_NCT5104D, and suggest "Super I/O" which doesn't make any sense. Signed-off-by: Martin Roth <gaumless@gmail.com> Change-Id: I464305af539926ac8a45c9c0d59eeb2c78dea17a Reviewed-on: https://review.coreboot.org/c/coreboot/+/61434 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Paul Menzel <paulepanter@mailbox.org> Reviewed-by: HAOUAS Elyes <ehaouas@noos.fr>
2022-01-28util/lint/lint-stable-003-whitespace: add exception for gif filesFred Reitberger
Adding gif files to the whitespace exclude list, to prevent issue where commits were failing due to binary files. Change-Id: I56679780348579d01c81c6f1677e4ea456315c9e Signed-off-by: Fred Reitberger <reitbergerfred@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/61460 Reviewed-by: Felix Held <felix-coreboot@felixheld.de> Reviewed-by: Matt DeVillier <matt.devillier@gmail.com> Reviewed-by: Paul Menzel <paulepanter@mailbox.org> Reviewed-by: Nico Huber <nico.h@gmx.de> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2021-12-10util/lint/checkpatch: Decrease commit message line length limit to 72Paul Menzel
Currently, `checkpatch.pl`, imported from the Linux project, checks for 75 characters per line [2]: > Suggest line wrapping at 75 columns so the default git commit log > indentation of 4 plus the commit message text still fits on an 80 > column screen. But Gerrit’s Web interface and its commit hooks use with 72 characters per line [2]: remote: commit 35bb56d: warning: too many message lines longer than 72 characters; manually wrap lines remote: remote: SUCCESS remote: remote: https://review.coreboot.org/c/coreboot/+/60004 [DO NOT SUBMIT] Gerrit commit msg line length test [NEW] So, decrease the suggested length from 75 to 72 characters per line. [1]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=2a076f40d8c9be95bee7bcf18436655e1140447f [2]: https://review.coreboot.org/60004 Change-Id: Ic9c686cb1a902259b18377b76b5c999e94660fed Signed-off-by: Paul Menzel <pmenzel@molgen.mpg.de> Reviewed-on: https://review.coreboot.org/c/coreboot/+/60006 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Martin Roth <martinroth@google.com>
2021-11-19Documentation/lint: Use Super I/O instead of SuperIOPatrick Georgi
Change-Id: Idb16092b687ebffb319bc1908f08f350d612d36a Signed-off-by: Patrick Georgi <pgeorgi@google.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/39451 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Paul Menzel <paulepanter@mailbox.org> Reviewed-by: Martin Roth <martinroth@google.com>
2021-11-19util/lint: Fix linters to work with coreboot-configuratorSean Rhodes
* Exclude .gif files from newline checking * Exclude coreboot-configurator from checkpatch checking Signed-off-by: Sean Rhodes <sean@starlabs.systems> Change-Id: I1b07b7b05340409e5c1695cc7bbdea68f8190097 Reviewed-on: https://review.coreboot.org/c/coreboot/+/59096 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Patrick Georgi <patrick@coreboot.org>
2021-11-09util/lint/kconfig_lint: Fix off by one error that missed last lineMartin Roth
This error prevented the last line of the Kconfig tree from being printed or added to the output file. This is a significant problem if you try to use the generated file as the kconfig source, because it changes CONFIG_HAVE_RAMSTAGE from defaulting to yes to defaulting to NO. This causes the build to stop working. Signed-off-by: Martin Roth <martin@coreboot.org> Change-Id: I3ec11f1ac59533a078fd3bd4d0dbee9df825a97a Reviewed-on: https://review.coreboot.org/c/coreboot/+/58992 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Nico Huber <nico.h@gmx.de>
2021-10-20kconfig_lint: use just one variable for keeping track of choicesMichael Niewöhner
Instead of using two variables, one for the boolean value and one for the path, use just one with the path. Since an empty string evalutes to false, this simplification does not change behaviour. Signed-off-by: Michael Niewöhner <foss@mniewoehner.de> Change-Id: I2f1171789af6815094446f107f3c634332a3427e Reviewed-on: https://review.coreboot.org/c/coreboot/+/58401 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Martin Roth <martinroth@google.com>
2021-10-20kconfig_lint: put $inside_choice together right in the first placeMichael Niewöhner
Instead of substituting the delimiter later, put $inside_choice together right in the first place. Signed-off-by: Michael Niewöhner <foss@mniewoehner.de> Change-Id: Ia713510a683101c48c86a1c3722ebb1607a29288 Reviewed-on: https://review.coreboot.org/c/coreboot/+/58400 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Martin Roth <martinroth@google.com>
2021-10-18kconfig_lint: Drop overly restrictive rule about choice configsNico Huber
This rule was creating trouble: * A symbol may only be declared inside or outside a choice. The linter treats every occurence of a `config` entry as a symbol declaration, even when it's just setting a default or adding selects. This is not easy to fix as the symbol objects are not created first and then added to the $symbols array when we know what kind of decla- ration we have, but are created incrementally inside this global list. Change-Id: I48a17f6403470251be6b6d44bb82a8bdcbefe9f6 Signed-off-by: Nico Huber <nico.h@gmx.de> Reviewed-on: https://review.coreboot.org/c/coreboot/+/56410 Reviewed-by: Michael Niewöhner <foss@mniewoehner.de> Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Martin Roth <martinroth@google.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2021-09-23kconfig_lint: restrict definition of defaults for choice elementsMichael Niewöhner
Defining defaults for symbols used inside choices is not allowed. Add a check for this, so we can drop the existent, overly restrictive checks in the follow-up change. Change-Id: I45bce2633dbd168fceb81ceae9b68621b28526e8 Signed-off-by: Michael Niewöhner <foss@mniewoehner.de> Reviewed-on: https://review.coreboot.org/c/coreboot/+/57715 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Felix Singer <felixsinger@posteo.net> Reviewed-by: Martin Roth <martinroth@google.com>
2021-06-08lint: checkpatch: Add SUSPICIOUS_CODE_INDENT testJulius Werner
This patch adds a new test to checkpatch that identifies cases where a line after a conditional statement is incorrectly intended (possibly indicating the mistake of forgetting to add braces), like this: if (a) b; c; Unfortunately, it seems like checkpatch is partially unmaintained in upstream Linux at the moment with maintainers either not responding at all or not even willing to look at new patches [1]. Since detecting this error class is important to coreboot, let's just carry this feature locally for now. [1] https://lkml.org/lkml/2021/4/15/1488 Signed-off-by: Julius Werner <jwerner@chromium.org> Change-Id: I7bb90b56dfc7582271d2b82cb42a2c1df477054f Reviewed-on: https://review.coreboot.org/c/coreboot/+/51838 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Paul Menzel <paulepanter@mailbox.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Nico Huber <nico.h@gmx.de>
2021-04-18util/kconfig_lint: Update handle_expressions()Nico Huber
More relational operators were added to Kconfig in 2015. Now we can make use of them. Change-Id: I640e5c3ee1485348f09fcb0b0d5035eb53a2c98e Signed-off-by: Nico Huber <nico.h@gmx.de> Reviewed-on: https://review.coreboot.org/c/coreboot/+/52068 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
2021-04-18util/kconfig_lint: Turn handle_expressions() into a parserNico Huber
I wished there was a way to do this in smaller steps, but with every line fixed an error somewhere else became visible. Here is a (probably incomplete) list of the issues: * Only one set of parentheses was supported. This is a hard to solve problem without a real parser (one solution is to use an recursive RE, see below). * The precedence order was wrong. Might have been adapted just to give a positive result for the arbitrary state of the tree. * Numbered match variables (e.g. $1, $2, etc.) are not local. Calling handle_expressions() recursively once with $1, then with $2, resulted in using the final $2 after the first recursive call (garbage, practically). Also, symbol and expression parsing was mixed, making things harder to follow. To remedy the issues: * Split handle_symbol() out. It is called with whitespace stripped, to keep the uglier REs in handle_expressions(). * Match balanced parentheses and quotes when splitting expressions. In this recursive RE /(\((?:[^\(\)]++|(?-1))*\))/ the `(?-1)` references the outer-most group, thus the whole expression itself. So it matches a pair of parentheses with a mix of non-parentheses and the recursive rule itself inside. This allows us to: * Order the expression matches according to their precedence rules. Now we can match `<expr> '||' <expr>` first as we should and everything else falls into its place. * Remove the bail-out that silenced the undefined behavior. Change-Id: Ibc1be79adc07792f0721f0dc08b50422b6da88a9 Signed-off-by: Nico Huber <nico.h@gmx.de> Reviewed-on: https://review.coreboot.org/c/coreboot/+/52067 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
2021-04-15checkpatch_json: Mark robotic comments as roboticPatrick Georgi
Gerrit now knows to differentiate between "regular" comments and "robot" comments, with some later changes to the UI in the pipeline (e.g. to filter out robot messages) Change-Id: I3a545d1cf6c04b331964becd2b24eb38018394eb Signed-off-by: Patrick Georgi <pgeorgi@google.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/51504 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org> Reviewed-by: Paul Menzel <paulepanter@mailbox.org>
2021-04-13lint: MAINTAINERS: check path matches to not only cover the directoryMichael Niewöhner
Gerrit is able to add reviewers based on entries in the `MAINTAINERS` file. For inclusion and exclusion matches either paths or regular expressions can be used. The syntax is described in the header of the file. When matching a path, there are two sensible possibilities: - `path/to/file` matches a file. - `path/to/dir/` matches a folder including its contents recursively. - `path/to/dir/*` matches all files in that folder, without recursing into its subfolders. The trailing slash in the second example is essential. Without it, only the directory entry itself matches when, for example, the folder gets deleted, renamed or its permissions get modified. Reviewers in the list won't get added to changes of any files or directories below that path. Thus, add a linter script to ensure a path match on a directory always ends with `/` or `/*` as shown above. Change-Id: I9873184c0df4a0b4455f803828e2719887e545db Signed-off-by: Michael Niewöhner <foss@mniewoehner.de> Reviewed-on: https://review.coreboot.org/c/coreboot/+/52210 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Nico Huber <nico.h@gmx.de> Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Patrick Georgi <pgeorgi@google.com>
2021-04-06lint: checkpatch: Only exclude specific src/vendorcode/ subdirectoriesJulius Werner
Some of the src/vendorcode/ directories are used to import a whole codebase from somewhere else which uses a completely different coding style. For those directories, excluding them from checkpatch makes sense. However, other directories are simply implementing vendor-specific extensions that were written by coreboot developers specifically for coreboot in coreboot's coding style. Those directories should be covered by checkpatch. This patch narrows the existing blanket exception of src/vendorcode/ to the amd, cavium, intel and mediatek directories (which actually include large amounts of foreign source). The eltan, google and siemens directories (which seem to contain code specifically written for coreboot) will now be covered by checkpatch. Signed-off-by: Julius Werner <jwerner@chromium.org> Change-Id: I1feaba37c469714217fff4d160e595849e0230b9 Reviewed-on: https://review.coreboot.org/c/coreboot/+/51827 Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Werner Zeh <werner.zeh@siemens.com> Reviewed-by: David Hendricks <david.hendricks@gmail.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2021-04-06util/kconfig_lint: Drop exception for paths without quotesNico Huber
The tree is clean at the moment. Change-Id: I1be3b6c2f3b54b5c10ad3d5c6f0a6fd7e490c6bc Signed-off-by: Nico Huber <nico.h@gmx.de> Reviewed-on: https://review.coreboot.org/c/coreboot/+/52066 Reviewed-by: Angel Pons <th3fanbus@gmail.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2021-02-27Revert "util/lint: Add test for documentation in util dirs"Nico Huber
This reverts commit 15e379aaf334e7931710b4208ccedf2f9ee44b0d. It triggers on directories that only contain artifacts and no checked in code. As this happens a lot when switching branches, it makes it impossible to commit new code. Change-Id: I38a86c8a5d5dc14ca5f6cba789bcb8c0fcaefb0b Signed-off-by: Nico Huber <nico.h@gmx.de> Reviewed-on: https://review.coreboot.org/c/coreboot/+/50354 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
2021-02-25util/lint: Check for windows line endingsMartin Roth
The codebase currently has only unix line endings, so add a lint tool to check for windows line endings. BUG=None TEST=Verify that line endings are caught both inside and outside a git repo. Signed-off-by: Martin Roth <martin@coreboot.org> Change-Id: I6faf99a3184e4843640fb8965f8124de0bc52ce7 Reviewed-on: https://review.coreboot.org/c/coreboot/+/50851 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Patrick Georgi <pgeorgi@google.com> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
2021-01-28util/lint: Add test for documentation in util dirsMartin Roth
Make sure that any new directories added to the util directory get documentation added. Signed-off-by: Martin Roth <martin@coreboot.org> Change-Id: I8bb415c72cf05b91c84f0a945d7767134a74c44c Reviewed-on: https://review.coreboot.org/c/coreboot/+/48967 Reviewed-by: Patrick Georgi <pgeorgi@google.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2021-01-25util: Update all shebangs to use /usr/bin/envMartin Roth
Instead of hardcoding paths to the executables, use the version in the path. This allows the scripts to work on more systems, and allows the binary version to be changed more easily if needed. Signed-off-by: Martin Roth <martin@coreboot.org> Change-Id: Ifcc56aa21092cd3866eacb6a02d198110ec6051d Reviewed-on: https://review.coreboot.org/c/coreboot/+/48904 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
2021-01-17util/lint/spelling.txt: Disable `pres`Angel Pons
It would seem that `pres` is an abbreviation for `presence`. Personally, over the last ~2.5 years, I have seen checkpatch complaints about `pres` on several occasions, and all of them were abbreviations for `presence`. Given the high false positive rate for this entry, comment it out. Change-Id: I72f1811fb1f766e7de7c4957fd9ba844c0728029 Signed-off-by: Angel Pons <th3fanbus@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/49463 Reviewed-by: Felix Held <felix-coreboot@felixheld.de> Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2020-10-14util/lint: Capitalise lint descriptionsAngel Pons
Most test descriptions are capitalised already. Follow suit. Change-Id: I756331323a39643244c4adea4c440f305424d6d1 Signed-off-by: Angel Pons <th3fanbus@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/46321 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: HAOUAS Elyes <ehaouas@noos.fr> Reviewed-by: Matt DeVillier <matt.devillier@gmail.com> Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Reviewed-by: Nico Huber <nico.h@gmx.de>
2020-09-20lint: check for misuse of Kconfig SUBSYSTEM_*_IDMichael Niewöhner
Check that nobody misuses the Kconfigs SUBSYSTEM_*_ID. They are meant to be used for overriding the devicetree subsystem ids locally but shall not be added to a board's Kconfig. Instead, the devicetree option `subsystemid` should be used. Add a linter script for this that finds and warns about such misuse. Also add a note in the Kconfigs' description. TEST=CB:45513 Change-Id: I21c021c718154f1396f795a555af47a76d6efe03 Signed-off-by: Michael Niewöhner <foss@mniewoehner.de> Reviewed-on: https://review.coreboot.org/c/coreboot/+/45513 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Nico Huber <nico.h@gmx.de>
2020-09-14coreinfo: Use SPDX license identifiersJacob Garber
- Remove copyright notices and add authors to AUTHORS - Use SPDX license identifiers for all files - Add coreinfo to the license header lint Signed-off-by: Jacob Garber <jgarber1@ualberta.ca> Change-Id: Ib0c5328a4027849b1eda4f57141a898335230726 Reviewed-on: https://review.coreboot.org/c/coreboot/+/45178 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Reviewed-by: HAOUAS Elyes <ehaouas@noos.fr> Reviewed-by: Martin Roth <martinroth@google.com> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
2020-08-31lint/lint-extended-007-checkpatch: Remove obsolete pathElyes HAOUAS
Change-Id: I8a91d2a8bc6a1fa709aeadd3b7482d1785068276 Signed-off-by: Elyes HAOUAS <ehaouas@noos.fr> Reviewed-on: https://review.coreboot.org/c/coreboot/+/44899 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
2020-08-31{intel/gma,include/device}: Delete unused 'drm_dp_helper.h' fileElyes HAOUAS
'drm_dp_helper.h' file is duplicated and not used. Change-Id: Ibb08f7ff91c3914940dfe899be331b06e292c7c9 Signed-off-by: Elyes HAOUAS <ehaouas@noos.fr> Reviewed-on: https://review.coreboot.org/c/coreboot/+/44842 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Nico Huber <nico.h@gmx.de>
2020-07-27util/lint/Kconfig_lint: Update Naked BOOL reference to errorMartin Roth
The lint-stable makefile target only watches for errors in the Kconfig file, so has not protected additional "Naked" references to BOOL type Kconfig symbols from entering the tree. Update it to an error so that they can't continue coming into the codebase. Signed-off-by: Martin Roth <martin@coreboot.org> Change-Id: Icce2a9a627c4fbcaa220df18474cb8bfea8b2a8c Reviewed-on: https://review.coreboot.org/c/coreboot/+/43826 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
2020-07-26util/lint: Add lint and checkpatch coverage for tests/ dirJan Dabros
Signed-off-by: Jan Dabros <jsd@semihalf.com> Change-Id: I8018b75844e630c9ed46c8bc48f2aa1634bf3369 Reviewed-on: https://review.coreboot.org/c/coreboot/+/43511 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org>
2020-06-18lint: convert checkpatch_json.py to python 3Stefan Reinauer
Align all coreboot scripts on one python version. Tested by running the original suggested test: $ nice -n 20 git diff HEAD~ | util/lint/checkpatch.pl \ --no-signoff -q - | tee checkpatch.txt $ util/lint/checkpatch_json.py checkpatch.txt \ comment.json checkpatch.txt Change-Id: Iec2bb0be23b27a3eaf92f293c962a8e6bfb03af0 Signed-off-by: Stefan Reinauer <stefan.reinauer@coreboot.org> Reviewed-on: https://review.coreboot.org/c/coreboot/+/42318 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Felix Singer <felixsinger@posteo.net>
2020-05-28util/lint: Check for SPDX identifiers by defaultJacob Garber
The majority of the codebase has been converted to use SPDX identifiers now, so let's enforce those by default. The only exceptions are src/include and src/lib, which are not being checked since many of the files there do not have license headers at all. Files with custom licenses that aren't covered by SPDX can be listed as exceptions at the top of lint-000-license-headers. Change-Id: Ie6642153793d5735c74c5950bc9e27ee7eecacbc Signed-off-by: Jacob Garber <jgarber1@ualberta.ca> Reviewed-on: https://review.coreboot.org/c/coreboot/+/41602 Reviewed-by: HAOUAS Elyes <ehaouas@noos.fr> Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2020-05-25drivers: Use SPDX identifiersJacob Garber
Convert the remaining files in src/drivers to use SPDX identifiers. int15.h and default_brightness_levels.asl did not have license headers, but they were both copied from other GPL2 files, so they should be under the GPL2 as well. ne2k.c and drm_dp_helper.h are licensed under custom BSD-like licenses that do not have an SPDX equivalent, so they are added as exceptions to the license header lint. Change-Id: I87fb1c637b8d11b0463f7c19f70b847413e14aed Signed-off-by: Jacob Garber <jgarber1@ualberta.ca> Reviewed-on: https://review.coreboot.org/c/coreboot/+/41601 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
2020-05-11util: Use SPDX headersPatrick Georgi
Change-Id: I2858fdf74e782f425d56653491cdebe83c185d19 Signed-off-by: Patrick Georgi <pgeorgi@google.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/41208 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: HAOUAS Elyes <ehaouas@noos.fr>
2020-05-11util/lint: Allow use of the HPND license groupPatrick Georgi
The Historical Permission Notice and Disclaimer (with and without permission to sell) is a BSD-style license family that OSI and SPDX consider deprecated - and yet, it's right here in our tree. Change-Id: I61624b6e54e9aba6e2f54822c1f68967c416ad3d Signed-off-by: Patrick Georgi <pgeorgi@google.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/41221 Reviewed-by: HAOUAS Elyes <ehaouas@noos.fr> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>