You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by vi...@apache.org on 2014/05/14 19:03:00 UTC

git commit: mesos-style.py accepts files to lint as args.

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 <st...@gmail.com>
Authored: Tue May 13 23:11:39 2014 -0700
Committer: Vinod Kone <vi...@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)