2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-22 09:58:01 +00:00

112 Commits

Author SHA1 Message Date
Roi Dayan
37848e2188 util: Ignore return code from str_to_uint().
Reported by Coverity.
  lib/util.c:795 Unchecked return value (CHECKED_RETURN):

As it's not really bug, wrap it with ignore().

Fixes: 9551e80befc0 ("tests: Use environment variable for default timeout.")
Acked-by: Aaron Conole <aconole@redhat.com>
Acked-by: Kevin Traynor <ktraynor@redhat.com>
Signed-off-by: Roi Dayan <roid@nvidia.com>
Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
2025-05-30 10:28:53 +02:00
Aaron Conole
f141b7c352 checkpatch.py: Don't run subject checks in source-file mode.
Checkpatch has the ability to scan source files rather than
exclusively scanning patch files.  In this mode, some checks
get disabled (ex: all of the header and commit message
parsing) and the display modes are adjusted to simply print
the file and line, rather than including the patch line
details.

When checkpatch was updated for subject parsing, it was
inadvertently ignoring the source file mode.  This means
any checks run against a source file will always print a
bogus subject suggestion, and warning.  Fix this by not
printing these warnings when in source file mode.  This
should have no effect on checkpatch against actual patch
files.

Additionally, introduce two simple tests to verify that
the source file mode still functions.

Fixes: 1b8fa4a66aa4 ("checkpatch: Add checks for the subject line.")
Acked-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: Aaron Conole <aconole@redhat.com>
2025-03-28 10:39:22 -04:00
Roi Dayan
3dea4e0fcb checkpatch.py: Load multiple codespell dictionaries.
Load dictionary_code.txt in addition to the default dictionary.
Add a new command line argument --dictionaries to be able
to specify codespell dictionaries.

Acked-by: Salem Sol <salems@nvidia.com>
Signed-off-by: Roi Dayan <roid@nvidia.com>
Signed-off-by: Aaron Conole <aconole@redhat.com>
2025-03-21 12:48:38 -04:00
Eelco Chaudron
d1430f3d89 checkpatch: Fix checkpatch's check-authors-file option in CirrusCI.
This patch makes sure that if git is missing it's not showing
any errors on the standard output. Secondly the OVS_SRC_DIR
environment variable is used to locate the OVS source directory.

Fixes: a6ccd111552d ("checkpatch: Add new check-authors-file option to checkpatch.py.")
Acked-by: Kevin Traynor <ktraynor@redhat.com>
Acked-by: Mike Pattrick <mkp@redhat.com>
Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
2024-10-14 08:54:28 +02:00
Eelco Chaudron
a6ccd11155 checkpatch: Add new check-authors-file option to checkpatch.py.
This patch adds a new option, --check-authors-file, to the checkpatch
tool to help OVS maintainers check for missing authors in the
AUTHORS.rst file.

Co-authored-by: Aaron Conole <aconole@redhat.com>
Signed-off-by: Aaron Conole <aconole@redhat.com>
Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
2024-10-09 10:50:10 -04:00
Adrian Moreno
35e647051f checkpatch: Don't warn on pointer to pointer.
Current regexp used to check whitespaces around operators does not
consider that there can be more than one "*" together to express pointer
to pointer.

As a result, false positive warnings are raised when the
patch contains a simple list of pointers, e.g: "char **errrp").

Fix the regexp to allow more than one consecutive "*" characters.

Signed-off-by: Adrian Moreno <amorenoz@redhat.com>
Acked-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: Simon Horman <horms@ovn.org>
2024-06-07 12:12:08 +01:00
Adrian Moreno
e1e0c6a3ed checkpatch: Allow rST manpages to be added.
The current __check_doc_is_listed() verifies that the new .rst file is
listed in Documentation/automake.mk with the full path (i.e:
"{directory}/{filename}").

While this holds true for generic documentation files, which are added
to DOC_SOURCE with the full path, it's not true for rST manpages which
are added only by filename to RST_MANPAGES target (see
Documentation/automake.mk).

This makes the current implementation of the check to incorrectly raise
a warning as follows even though the patch does add the file to
RST_MANPAGES:

"""
WARNING: New doc ovs-flowviz.8.rst not listed in
Documentation/automake.mk
"""

Fix it by making the {dir}/ part of the docre regexp optional.

Signed-off-by: Adrian Moreno <amorenoz@redhat.com>
Acked-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: Simon Horman <horms@ovn.org>
2024-04-12 10:39:01 +01:00
Ilya Maximets
a35fc4ae5b checkpatch: Don't spellcheck names in tags.
Current code checks spelling of names in commit message tags and that
makes no sense.

Most of the tags are explicitly handled, but tags like 'Tested-by' or
other lesser used ones are falling through to the spellchecker and
need to be excluded.

Acked-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2024-04-10 19:50:02 +02:00
Eelco Chaudron
95f5012bbc checkpatch: Add additional words to extra_keywords.
This patch add another set of keywords based on the results
of the last thousand committed patches.

Acked-by: Simon Horman <horms@ovn.org>
Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
2024-04-08 12:49:50 +02:00
Roi Dayan
915b97971d checkpatch.py: Load codespell dictionary.
codespell dictionary contains a list of widely used words
which enchant alone could fail on. for an example:
refcount, pthread, enqueuing, etc.
Load that dictionary, if exists, into enchant spell checker.

Signed-off-by: Roi Dayan <roid@nvidia.com>
Acked-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: Aaron Conole <aconole@redhat.com>
2024-01-09 09:17:06 -05:00
Gaetan Rivet
21c61243fb checkpatch: Fix personal word list storage.
The enchant dictionary synchronizes additions to the source file.
Keep the two word source separate by adding the extra words only
to the current session.

Fixes: 999c7773a60b ("checkpatch: add a comment spell-checker")
Signed-off-by: Gaetan Rivet <gaetanr@nvidia.com>
Acked-by: Roi Dayan <roid@nvidia.com>
Acked-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: Aaron Conole <aconole@redhat.com>
2024-01-09 08:52:15 -05:00
Salem Sol
74bfe37014 checkpatch: Add argument to skip committer signoff check.
Introduce --skip-committer-signoff arg that can be used internally
by groups using gerrit for code reviews and gerrit maintainers could
do the rebase instead of the author or push upstream commits to be
merged through gerrit.

Signed-off-by: Salem Sol <salems@nvidia.com>
Acked-by: Roi Dayan <roid@nvidia.com>
Acked-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: Simon Horman <horms@ovn.org>
2023-11-16 11:58:36 +00:00
Eli Britstein
bf843fd439 checkpatch: Don't spell check Fixes tag.
Fixes tag quotes another commit that might fail in a spell check. Don't
fail it.

Signed-off-by: Eli Britstein <elibr@nvidia.com>
Acked-by: Roi Dayan <roid@nvidia.com>
Acked-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: Simon Horman <horms@ovn.org>
2023-11-03 16:18:16 +00:00
Eelco Chaudron
1b8fa4a66a checkpatch: Add checks for the subject line.
This patch adds WARNINGs for the subject line length and the format,
i.e., the sentence should start with a capital and end with a dot.

Acked-by: Simon Horman <horms@ovn.org>
Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
2023-09-19 13:36:14 +02:00
Adrian Moreno
6240c0b4c8 netdev: Add netdev_get_speed() to netdev API.
Currently, the netdev's speed is being calculated by taking the link's
feature bits (using netdev_get_features()) and transforming them into
bps.

This mechanism can be both inaccurate and difficult to maintain, mainly
because we currently use the feature bits supported by OpenFlow which
would have to be extended to support all new feature bits of all netdev
implementations while keeping the OpenFlow API intact.

In order to expose the link speed accurately for all current and future
hardware, add a new netdev API call that allows the implementations to
provide the current and maximum link speeds in Mbps.

Internally, the logic to get the maximum supported speed still relies on
feature bits so it might still get out of sync in the future. However,
the maximum configurable speed is not used as much as the current speed
and these feature bits are not exposed through the netdev interface so
it should be easier to add more.

Use this new function instead of netdev_get_features() where the link
speed is needed.

As a consequence of this patch, link speeds of cards is properly
reported (internally in OVSDB) even if not supported by OpenFlow.
A test verifies this behavior using a tap device.

Also, in order to avoid using the old, this patch adds a checkpatch.py
warning if the old API is used.

Reported-at: https://bugzilla.redhat.com/show_bug.cgi?id=2137567
Acked-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: Adrian Moreno <amorenoz@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2023-07-17 20:03:32 +02:00
Chandan Somani
799f697e51 checkpatch: Print subject field if misspelled or missing.
This narrows down spelling errors that are in the commit
subject. It also provides a subject if the subject line is
missing. The provisional subject is the name of the patch
file, which should provide some context about the patch.

Acked-by: Aaron Conole <aconole@redhat.com>
Signed-off-by: Chandan Somani <csomani@redhat.com>
Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
2023-07-12 12:01:09 +02:00
Chandan Somani
9a50170a80 checkpatch: Add suggestions to the spell checker.
This will be useful for correcting possible spelling
mistakes with ease. Suggestions limited to 3 at first,
but can be made configurable in the future.

Acked-by: Aaron Conole <aconole@redhat.com>
Signed-off-by: Chandan Somani <csomani@redhat.com>
Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
2023-07-12 12:01:09 +02:00
Chandan Somani
d25c6bd8df checkpatch: Reorganize flagged words using a list.
Single out flagged words and allow for more useful
details, like spelling suggestions.

Signed-off-by: Chandan Somani <csomani@redhat.com>
Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
2023-07-12 12:01:09 +02:00
Dumitru Ceara
d56932aac6 checkpatch: Ignore yml files when checking line lengths.
As far as I can tell they're used mostly for CI job definitions and
these tend to result in long lines.

Reported-at: https://mail.openvswitch.org/pipermail/ovs-dev/2023-June/405796.html
Suggested-by: Aaron Conole <aconole@redhat.com>
Acked-by: Aaron Conole <aconole@redhat.com>
Acked-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: Dumitru Ceara <dceara@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2023-06-28 12:39:31 +02:00
Ilya Maximets
950aee1f7e checkpatch: Add check for egrep/fgrep.
GNU grep 3.8 started complaining about use of obsolete egrep/fgrep:

  egrep: warning: egrep is obsolescent; using grep -E

This breaks tests on such systems.  All the instances was cleaned up
from the testsuite, but the checkpatch check is needed to catch issues
in new patches.

Acked-by: Aaron Conole <aconole@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2022-09-15 14:18:25 +02:00
Ilya Maximets
91b41af0d9 checkpatch: Add check for a Fixes tag.
A new check for common mistakes while formatting a 'Fixes:' tag.

Acked-by: Sunil Pai G <sunil.pai.g@intel.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2022-08-04 14:06:37 +02:00
Frode Nordahl
9f4f2bb7dc checkpatch: Ignore line length and leading whitespace for debian/*.
Signed-off-by: Frode Nordahl <frode.nordahl@canonical.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2022-07-15 13:43:39 +02:00
Peng He
071b802c61 checkpatch.py: Add checks for easy-to-misuse APIs.
Signed-off-by: Peng He <hepeng.0320@bytedance.com>
Acked-by: Eelco Chaudron <echaudro@redhat.com>
Acked-by: Aaron Conole <aconole@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2022-05-30 23:39:56 +02:00
Mike Pattrick
0d1ffb7756 checkpatch: Detect "trojan source" attack.
Recently there has been a lot of press about the "trojan source" attack,
where Unicode characters are used to obfuscate the true functionality of
code. This attack didn't effect OVS, but adding the check here will help
guard against it sneaking in later.

Signed-off-by: Mike Pattrick <mkp@redhat.com>
Acked-by: Gaetan Rivet <grive@u256.net>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2022-01-04 19:14:11 +01:00
Mike Pattrick
d652fc6a5a checkpatch: Correct line count in error messages.
As part of some previous checkpatch work, we discovered that checkpatch
isn't always reporting correct line numbers. As it turns out, Python's
splitlines function considers several characters to be new lines which
common text editors do not typically consider to be new lines. For
example, form feed characters, which this code base uses to cluster
functionality.

Signed-off-by: Mike Pattrick <mkp@redhat.com>
Acked-by: Paolo Valerio <pvalerio@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2022-01-04 17:23:30 +01:00
Timothy Redaelli
c5d384f77b checkpatch: Check if some tags are wrongly written.
Currently, there are some patches with the tags wrongly written (with
space instead of dash ) and this may prevent some automatic system or CI
to detect them correctly.

This commit adds a check in checkpatch to be sure the tag is written
correctly with dash and not with space.

The tags supported by the commit are:
Acked-by, Reported-at, Reported-by, Requested-by, Reviewed-by, Submitted-at
and Suggested-by.

It's not necessary to add "Signed-off-by" since it's already checked in
checkpatch.

Signed-off-by: Timothy Redaelli <tredaelli@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2021-11-04 22:26:00 +01:00
Aaron Conole
00d3d4a7d3 checkpatch: Avoid catastrophic backtracking.
As Frode Nordahl points out in [0], it is possible for the
python regex module to enter a case of catastrophic backtracking
which causes oscillation between states and hangs the checkpatch
script.

One suggested solution to these cases is to use an anchor[1] in
the regex, which should force the backtrack to exit early.
However, when I tested this, it didn't seem to improve anything
(since the start is already anchored, and trying to anchor the
end results in the same hang).

Instead, we explicitly check that the line ends with '\\' before
trying to match on the 'if-inside-a-macro' check.  A new check
is added to catch the case in checkpatch.

0: https://mail.openvswitch.org/pipermail/ovs-dev/2021-August/386881.html
1: https://stackoverflow.com/questions/22072406/preventing-any-backtracking-in-regex-past-a-specific-pattern

Signed-off-by: Aaron Conole <aconole@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2021-09-08 21:29:03 +02:00
Aaron Conole
b6c5f30cfa checkpatch: Ignore macro definitions of FOR_EACH.
When defining a FOR_EACH macro, checkpatch freaks out and generates a
control block whitespace error.  Create an exception so that it doesn't
generate errors for this case.

Reported-at: https://mail.openvswitch.org/pipermail/ovs-dev/2020-August/373509.html
Reported-by: Toshiaki Makita <toshiaki.makita1@gmail.com>
Signed-off-by: Aaron Conole <aconole@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2021-07-01 16:31:55 +02:00
Rosemarie O'Riorden
bd90524550 Remove Python 2 leftovers.
Fixes: 1ca0323e7c29 ("Require Python 3 and remove support for Python 2.")
Reported at: https://bugzilla.redhat.com/show_bug.cgi?id=1949875
Signed-off-by: Rosemarie O'Riorden <roriorde@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2021-06-22 21:29:57 +02:00
Ilya Maximets
dc497e36fc checkpatch: Add check for a whitespace after cast.
Coding style says: "Put a space between the ``()`` used in a cast and
the expression whose type is cast: ``(void *) 0``.".
This style rule is frequently overlooked.  Let's check for it.

Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
Acked-by: Ian Stokes <ian.stokes@intel.com>
2020-11-27 14:31:27 +01:00
Ben Pfaff
8205fbc8f5 Eliminate "whitelist" and "blacklist" terms.
There is one remaining use under datapath.  That change should happen
upstream in Linux first according to our usual policy.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Alin Gabriel Serdean <aserdean@ovn.org>
2020-10-16 19:22:24 -07:00
Roi Dayan
68a95c9ca7 checkpatch: Add argument to skip gerrit change id check.
This arg can be used internally by groups using gerrit for code reviews.

Acked-by: Flavio Leitner <fbl@sysclose.org>
Signed-off-by: Roi Dayan <roid@mellanox.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2020-07-17 02:14:05 +02:00
Ilya Maximets
9802fafa96 checkpatch: Check spelling in commit messages.
This seems useful as I'm usually making a lot of typing mistakes.
Also, few commonly used words added to the extended dictionary.

Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
Acked-by: Aaron Conole <aconole@redhat.com>
Acked-by: William Tu <u9012063@gmail.com>
2019-12-09 21:14:26 +01:00
Ilya Maximets
37c6dfab10 checkpatch: Skip words containing numbers.
Words like 'br0' are common and usually references some code or
database objects that should not be targets for spell checking.
So, it's better to skip all the words that has digits inside instead
of ones that starts with numbers.

Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
Acked-by: Aaron Conole <aconole@redhat.com>
Acked-by: William Tu <u9012063@gmail.com>
2019-12-09 21:14:26 +01:00
Ilya Maximets
98a411b32e checkpatch: Allow common abbreviations for spell checking.
Abbreviations of Latin expressions like 'i.e.' or 'e.g.' are common
and known by the dictionary.  However, our spell checker is not able
to recognize them because it strips dots out of them.  To avoid this
issue we could pass non-stripped version of the word to the dictionary
checker too.

Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
Acked-by: Aaron Conole <aconole@redhat.com>
Acked-by: William Tu <u9012063@gmail.com>
2019-12-09 21:14:26 +01:00
Ben Pfaff
1ca0323e7c Require Python 3 and remove support for Python 2.
Python 2 reaches end-of-life on January 1, 2020, which is only
a few months away.  This means that OVS needs to stop depending
on in the next release that should occur roughly that same time.
Therefore, this commit removes all support for Python 2.  It
also makes Python 3 a mandatory build dependency.

Some of the interesting consequences:

- HAVE_PYTHON, HAVE_PYTHON2, and HAVE_PYTHON3 conditionals have
  been removed, since we now know that Python3 is available.

- $PYTHON and $PYTHON2 are removed, and $PYTHON3 is always
  available.

- Many tests for Python 2 support have been removed, and the ones
  that depended on Python 3 now run unconditionally.  This allowed
  several macros in the testsuite to be removed, making the code
  clearer.  This does make some of the changes to the testsuite
  files large due to indentation level changes.

- #! lines for Python now use /usr/bin/python3 instead of
  /usr/bin/python.

- Packaging depends on Python 3 packages.

Acked-by: Numan Siddique <nusiddiq@redhat.com>
Tested-by: Numan Siddique <nusiddiq@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2019-09-27 09:23:50 -07:00
William Tu
334eec6a8e checkpatch: Ignore utilities/bugtool.
Reviewed-by: Greg Rose <gvrose8192@gmail.com>
Signed-off-by: William Tu <u9012063@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2019-09-17 14:39:49 -07:00
Ilya Maximets
aacad8685e checkpatch: Fix regexp for if, while, etc inside macros.
This allows to use a one-character expression inside the 'if'
statement and multiple spaces before the line continuation character.

Fixes false positive in case like this:

  #define MACRO(ARG)     \
      if (a) {           \
          do_work(ARG);  \
      }

Fixes: 16770c6d9179 ("checkpatch: support macro continuation")
Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Acked-by: Aaron Conole <aconole@redhat.com>
2019-08-12 10:56:35 +03:00
Ilya Maximets
df8c04b1c8 checkpatch: Check FOR_EACH loops with numbers.
OVS has defines for loops like 'BITMAP_FOR_EACH_1' or
'ULLONG_FOR_EACH_1', but the regexp in checkpatch doesn't match with
numbers and skips these loops while checking.

This patch adds numbers into regexp and adds some FER_EACH loops to
the unit tests.

Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Acked-by: Ben Pfaff <blp@ovn.org>
Acked-by: Aaron Conole <aconole@redhat.com>
2019-07-12 19:22:14 +03:00
Ilya Maximets
7095b9036c checkpatch: Ignore "sparse" headers.
Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Acked-by: Aaron Conole <aconole@redhat.com>
2019-05-29 14:07:53 +03:00
Ilya Maximets
4bee6d8b03 checkpatch: Fix handling of line endings.
Unlike manual splitting, 'splitlines' correctly handles different
line endings. Without this change script fails to check files with
'\r\n' endings treating the whole patch as a header.

Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2019-04-15 12:33:29 -07:00
Alin Gabriel Serdean
241bc88a2d checkpatch: Normalize exit code for Windows
Using python `sys.exit(-1)` on Windows produces mixed results.
Let's take the following results from different shells:
CMD
>python -c "import sys; sys.exit(-1)" & echo %errorlevel%
1
MSYS
$ python -c "import sys; sys.exit(-1)" && echo $?
0
WSL
$ python -c "import sys; sys.exit(-1)"; echo $?
255

this results in the following tests to fail:
checkpatch

 10: checkpatch - sign-offs                          FAILED (checkpatch.at:32)
 11: checkpatch - parenthesized constructs           FAILED (checkpatch.at:32)
 12: checkpatch - parenthesized constructs - for     FAILED (checkpatch.at:32)
 13: checkpatch - comments                           FAILED (checkpatch.at:32)

because of:
 ./checkpatch.at:32: exit code was 0, expected 255

This patch introduces a positive constant for the default exit code (1)
similar to other OVS utilities.

Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
Acked-by: Aaron Conole <aconole@redhat.com>
2019-04-03 17:47:29 +03:00
Ilya Maximets
9307fc4600 checkpatch: Escape range operators inside regex.
' -(' matches a single character in the range between ' ' (index 32)
and '(' (index 40). This leads to the false positive:

  WARNING: Line lacks whitespace around operator
  #445 FILE: ovsdb/monitor.c:573:
      if (--mcs->n_refs == 0) {

Need to escape '-' to have a right behaviour.
This patch additionally escapes all other '-' chars in the similar
regexes and makes them be one per line to ease the review in case of
future changes.

Basic unit tests added.

CC: Joe Stringer <joe@ovn.org>
Fixes: 0d7b16daea50 ("checkpatch: Check for infix operator whitespace.")
Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2019-02-22 12:48:43 -08:00
Ilya Maximets
b48aa1437d checkpatch: Check for C99 style comments.
Coding-style document asks not to use C99 ( '//' ) comments.

Acked-by: Aaron Conole <aconole@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2019-01-18 09:21:25 -08:00
Ilya Maximets
862b9cce15 checkpatch: Check style of FOREACH loops.
Current checkpatch rules matches only OVS 'FOR_EACH' loops.
This change will apply same style checks for DPDK iterators
like 'RTE_ETH_FOREACH_MATCHING_DEV () {}'.

Acked-by: Aaron Conole <aconole@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2019-01-15 09:18:06 -08:00
Ben Pfaff
145a7e88bb python: Fix invalid escape sequences.
It appears that Python silently treats invalid escape sequences in
strings as literals, e.g. "\." is the same as "\\.".  Newer versions of
checkpatch complain, and it does seem reasonable to me to fix these.

Acked-by: Numan Siddique <nusiddiq@redhat.com>
Tested-by: Numan Siddique <nusiddiq@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2019-01-11 08:45:04 -08:00
Bala Sankaran
64b90b3022 checkpatch: fix typographical error
A typographical error in a prompt for missing python enchant library is
identified and fixed.

Signed-off-by: Bala Sankaran <bsankara@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2018-11-05 11:44:15 -08:00
Ben Pfaff
0fb02e8e50 checkpatch: Speed up checking when spell checking not enabled.
On my machine it takes almost a second for enchant to read its dictionary.
This time is wasted when spell checking is not enabled.  This commit makes
checkpatch read the dictionary only when it will be used.

Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2018-11-02 13:40:54 -07:00
Ben Pfaff
3bd2e465a1 checkpatch: Add explicit test for mailing list as author.
Somehow some such patches snuck through.  checkpatch caught them (and the
committer missed that) but this makes it even more explicit.

Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2018-11-02 13:40:51 -07:00
Bala Sankaran
16770c6d91 checkpatch: support macro continuation
Added a test to identify a macro and skip
printing errors if the condition or loop
is part of a macro.

Additional tests are added to checkpatch
testsuite that cover conditionals and
loop constructs.

Signed-off-by: Bala Sankaran <bsankara@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2018-08-16 10:11:25 -07:00