mesos-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vinodk...@apache.org
Subject git commit: mesos-style.py accepts files to lint as args.
Date Wed, 14 May 2014 17:03:00 GMT
Repository: mesos
Updated Branches:
  refs/heads/master d903d2965 -> 7bf63eb05


mesos-style.py accepts files to lint as args.

Review: https://reviews.apache.org/r/21360


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/7bf63eb0
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/7bf63eb0
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/7bf63eb0

Branch: refs/heads/master
Commit: 7bf63eb052502f31fab3f7171da663a591d0ec1f
Parents: d903d29
Author: Steven Phung <stphung@gmail.com>
Authored: Tue May 13 23:11:39 2014 -0700
Committer: Vinod Kone <vinod@twitter.com>
Committed: Wed May 14 10:02:43 2014 -0700

----------------------------------------------------------------------
 support/mesos-style.py | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/7bf63eb0/support/mesos-style.py
----------------------------------------------------------------------
diff --git a/support/mesos-style.py b/support/mesos-style.py
index bd7dcdb..9948817 100755
--- a/support/mesos-style.py
+++ b/support/mesos-style.py
@@ -81,4 +81,22 @@ if __name__ == '__main__':
         for candidate in find_candidates(source_dir):
             candidates.append(candidate)
 
-    sys.exit(run_lint(candidates))
+    if len(sys.argv) == 1:
+        # No file paths specified, run lint on all candidates.
+        sys.exit(run_lint(candidates))
+    else:
+        # File paths specified, run lint on all file paths that are candidates.
+        file_paths = sys.argv[1:]
+
+        # Compute the set intersect of the input file paths and candidates.
+        # This represents the reduced set of candidates to run lint on.
+        candidates_set = set(candidates)
+        clean_file_paths_set = set(map(lambda x: x.rstrip(), file_paths))
+        filtered_candidates_set = clean_file_paths_set.intersection(
+            candidates_set)
+
+        if filtered_candidates_set:
+            sys.exit(run_lint(list(filtered_candidates_set)))
+        else:
+            print "No files to lint\n"
+            sys.exit(0)


Mime
View raw message