Commit Graph

30 Commits (dd88e3f32ec9e4f90a455b711cdc448a60639f0e)

Author SHA1 Message Date
Cao Shufeng f6e5577427 remove some not used imports from python codes 2018-03-07 17:43:47 +08:00
Cao Shufeng ef3f1b933a some small fix in verify-flags-underscore
1. exceptions.txt and known-flags.txt are deleted, remove them from
code too.
2. remove some duplicated flags from excluded-flags.txt
2017-08-14 14:55:42 +08:00
shashidharatd 5cfc724b9e Simplify hack/verify-flags-underscore.py 2017-08-10 05:21:10 +05:30
Cao Shufeng 3aa71aa193 check flag format in file known-flags.txt
All flags in file hack/verify-flags/known-flags.txt should contain
character -, this change check this to prevent adding useless flags
to known-flags.txt
2017-05-22 10:51:04 +08:00
Mike Danese 999c967767 ignore BUILD in the flags-underscore.py validation 2016-10-21 17:32:33 -07:00
Chao Xu b45e578ddd ignore staging in munge scripts 2016-08-24 13:09:13 -07:00
Tim Hockin a9f3ccdaa4 Fix Makefile deps to rebuild less often
This should only rebuild when ACTUALLY needed.
2016-07-12 21:52:54 -07:00
k8s-merge-robot 51653073ec Merge pull request #25538 from duglin/fixErr
Automatic merge from submit-queue

s/positive/negative/ in the error message


I think we meant to imply that "if the error isn't real" then update the
exceptions file - which to me means "false negative", ie. false failure.

Signed-off-by: Doug Davis <dug@us.ibm.com>
2016-07-07 11:36:07 -07:00
Doug Davis 1af28ccb52 s/positive/negative/ in the error message
I think we meant to imply that "if the error isn't real" then update the
exceptions file- which to me means "false negative", ie. false failure.

Signed-off-by: Doug Davis <dug@us.ibm.com>
2016-06-30 10:10:30 -07:00
David McMahon ef0c9f0c5b Remove "All rights reserved" from all the headers. 2016-06-29 17:47:36 -07:00
Vishnu kannan 7e731dac60 ignore _output directory in verify flags script
Signed-off-by: Vishnu kannan <vishnuk@google.com>
2016-06-06 17:47:38 -07:00
Tim Hockin cbf886c7f4 Convert everything to use vendor/ 2016-05-08 20:30:37 -07:00
Joe Finney ca3524639d Add .md and .yaml exceptions to verify-flags-underscore.py.
Also removed duplicated exception checks for file extensions.
2015-12-07 16:33:27 -08:00
Jeff Grafton 4cafa3e92d Ignore _gopath in verify scripts
The _gopath directory is used in Jenkins to install extra dependencies,
and any files in it should be ignored by the various verification
scripts.
2015-10-19 14:09:23 -07:00
nikhiljindal 0799c11cb5 printf->print 2015-09-24 13:10:25 -07:00
Maciej Szulik 7edb1afad6 Fixed typo in verify-flags-underscore 2015-08-26 13:29:10 +02:00
Eric Paris 03f4e52812 Make verify-flags-underscore.py return error on failure
We were running it in shippable and travis, but since it didn't return
an error it wasn't actually catching things.
2015-08-24 22:12:17 -05:00
Nikhil Jindal 9eb0970bdb Merge pull request #13091 from mesosphere/python-set-sort
Fix sort on sets in hack/verify-flags-underscore.py
2015-08-24 14:07:12 -07:00
Dr. Stefan Schimanski 211fe33f40 Fix undefined variable f in 'finally' clause of verify-flags-underscore.py 2015-08-24 16:36:52 +02:00
Dr. Stefan Schimanski ce013e288c Fix sort on sets in hack/verify-flags-underscore.py 2015-08-24 15:06:33 +02:00
Eric Paris ca310ffdac Sort output from hack/verify-flag-underscore.py
So we get some consistency and readability to the exceptions.txt
2015-08-17 11:32:18 -07:00
Eric Paris 99dc464c9b verify-flags-underscore.py: update how to add to exclusion list 2015-08-17 11:19:32 -07:00
Eric Paris b432f036db verify-flags-underscore.py: ignore juju variables 2015-08-17 11:19:32 -07:00
Eric Paris f3fd2e1028 verify-flags-underscore.py: ignore if trailed by :
These are often yaml definitions, and thus not usages of kubernetes
flags.  Not necessarily always, but usually.
2015-08-17 11:19:32 -07:00
Eric Paris d1ba0bb692 verify-flags-underscore.py: ignore salt grains 2015-08-17 11:19:31 -07:00
Eric Paris d7f9477a94 verify-flags-underscore.py: exclude salt variable which look like flags 2015-08-17 11:19:31 -07:00
Eric Paris 7f96f9312b verify-flags-underscore.py: ignore 'flags' that look like bash variables
We ignore bad 'flags' if they are proceeded by $ or { as these are
likely bash variables and not in fact bad flag usage.
2015-08-17 11:19:31 -07:00
Eric Paris 56f6ad0c01 Specifically exclude some flag definitions in verify-flag-underscore.sh
We know there are some flags (declared with an _) which we wish to
ignore. These flags are used by container definitions, e2e, etc. By
explicitly ignoring those flags we can cut the amount of noise in the
whitelist.
2015-08-14 14:11:02 -04:00
Eric Paris 30d34d0e59 Reduce false positives with verify-flag-underscore.sh by updating regex
Check to make sure there is not an alphanumeric character immeditely
before or after the 'flag'.  It there is an alphanumeric character then
this is obviously not actually the flag we care about.  For example if
the project declares a flag "valid-name" but the regex finds something
like "invalid_name" we should not match.  Clearly this "invalid_name" is
not actually a wrong usage of the "valid-name" flag.
2015-08-13 21:06:39 -04:00
Eric Paris f54098fe00 Verify all flag usage does not use _
This works by defining two 'static' lists in hack. The first is the list
of all flags in the project which use a `-` or an `_` in their name. All
files being processed by verify-flags-underscore.py (or all files in the
repo if no filename arguments are given) will be searched for flag
declaration using a simple regex. Its not super smart. If a flag is
found which is not in the static list it will complain/reject the commit
until a human adds it to the list. If we do not keep a static list of
flags it takes >.2 seconds to find them 'all' at runtime. Since this is
run in pre-commit saving every part of a second helps.

After it finds all of the flags it runs all of the arguments (or all
files in repo if no arguments) looking for usage of those flags which
includes an `_`. There are lots of places where these are false
positives. For example we have a flag named oom-adj-score but the kernel
calls it oom_adj_score. To handle this we keep a second 'whitelist' of
lines which are allowed to use these flag names with an `_`.

Running the entire git repo looking for flags in every golang file and
looking in every single file for bad usage takes about 8.75 seconds.

Running it in the precommit hook where we only check things that changed
takes about .06 seconds.
2015-08-12 16:17:02 -04:00