Commit graph

17 commits

Author SHA1 Message Date
Ulf Magnusson
1c57b223ef zephyr_commit_rules.py: Fix pylint warning by simplifying conditional
Non-empty sequences are truthy in Python, so len() can be skipped in
tests.

Fixes this pylint warning:

    scripts/gitlint/zephyr_commit_rules.py:115:11: C1801: Do not use
    `len(SEQUENCE)` to determine if a sequence is empty
    (len-as-condition)

Fixing warnings for a CI check.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-09-08 22:19:37 -04:00
Anas Nashif
3ae52624ff license: cleanup: add SPDX Apache-2.0 license identifier
Update the files which contain no license information with the
'Apache-2.0' SPDX license identifier.  Many source files in the tree are
missing licensing information, which makes it harder for compliance
tools to determine the correct license.

By default all files without license information are under the default
license of Zephyr, which is Apache version 2.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-04-07 08:45:22 -04:00
Ulf Magnusson
a449c98db2 scripts: Fix risky uses of non-raw regex strings in Python scripts
Fixes pylint warnings like this one:

    doc/conf.py:325:0: W1401: Anomalous backslash in string: '\s'.
    String constant might be missing an r prefix.
    (anomalous-backslash-in-string)

The reason for this warning is that backslash escapes are interpreted in
non-raw (non-r-prefixed) strings. For example, '\a' and r'\a' are not
the same string (first one has a single ASCII bell character, second one
has two characters).

It just happens that there's no \s (or \., or \/) escape for example,
and '\s' turns into two characters (as needed for a regex). It's risky
to rely on stuff like that regexes though. Best to make them raw strings
unless they're super trivial.

Also note that '\s' and '\\s' turn into the same string.

Another tip: A literal ' can be put into a string with "blah'blah"
instead of 'blah\'blah'.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-03-28 14:41:32 -05:00
Ulf Magnusson
d5b0bd14e3 scripts: Remove unused imports in all Python scripts
Discovered with pylint3.

Upstream open-amp PR: https://github.com/OpenAMP/open-amp/pull/168

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-03-28 11:06:20 -05:00
Ulf Magnusson
7da0053a0c scripts: gitlint: Fix broken module docstring
Needs to be at the beginning of the file. Fixes a pylint warning:

    scripts/process_gperf.py:26:-1: W0105: String statement has no
    effect (pointless-string-statement)

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-03-26 07:50:06 -05:00
Paul Sokolovsky
26e562c0bd scripts: gitlint: Consistent case for Signed-off-by
The commit header as added by "git commit -s" is "Signed-off-by:",
and not any other casing. While it perhaps case-insensitive, use
canonical casing to not confuse (attentive) users.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2019-02-19 12:12:42 -05:00
Anas Nashif
8d84f9229c gitlint: do not start with subsys:
Commit messages should not start with literal "subsys:", instead, spell
out the actual subsystem name.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-11-28 09:22:01 -08:00
Anas Nashif
0f55538762 gitlint: accept "'" in committer names
Allow "'" in names, for example xxx O'xxx.

Fixes #10152

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-09-21 12:49:23 -04:00
Anas Nashif
abfed53525 gitlint: fix check for line_count
We should check if the commits line is less than, not less/equal...

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-01-11 10:48:03 -05:00
Anas Nashif
2dd5cef811 gitlint: do not allow title-only commit messages
It has been agreed in the project TSC to reject commit messages without
any content. Every commit message needs some explaination beyond what
was put in the title, even the most trivial ones.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-01-11 06:39:42 -05:00
Anas Nashif
789d51c4aa ci: do not treat message parts as xml
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-10-28 09:00:50 -04:00
Anas Nashif
87766a25c6 gitlint: ignore titles prefixed with Revert
The revert commit title is usually prefixed with "Revert" which causes
the title to become longer than the allowed limit. Allow such commits to
keep revert commits consistent with the original commit message.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-08-08 09:04:25 -04:00
Anas Nashif
408a61d42b gitlint: tolerate long lines with URLs
When including referecnes to external resources using a URL, keep the
line with URL in one line to not break the link and allow this to pass
the gitlint test.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-08-08 09:04:25 -04:00
Anas Nashif
b520075788 gitlint: Ignore signed-off-by line
When checking for line length limits, ignore lines with Signed-off-by.
Some developers have a long name that would not fit within the limits.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-06 09:35:50 -04:00
Anas Nashif
3c27c46562 gitlint: check for subsystem in commit subject
Check that we have <subsystem>: <subject> in commit messages.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-05-19 20:04:08 -04:00
Anas Nashif
1338f49206 gitlint: verify full name in signed-off-by line
Make sure we get full name in the commit message and not the username or
some incomplete data that we need to decipher. We still need to verify
the commiter name that is not part of the commit message body, but this
is out of scope of gitlint.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-05-05 16:11:11 -05:00
Anas Nashif
a35378e494 scripts: add gitlint to check for validity of commit messages
Install gitlint using pip:

 # pip install gitlint
 # gitlint install-hook

This will install the pre-commit hook.

Policies are define in .gitlint. Custom rules are available under
scripts/gitlint.

This script will also run in CI, so avoid CI errors by using the hook
above.

Change-Id: I62750a1fd9369341db29c413a6c4a1677bb0db8a
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-04-25 22:48:24 +00:00