Rename some local task variable to be more consistent

Rename task to 'att' or 'def' to avoid confusing them.  'task' was used
sometimes to mean the task attribute, and sometimes the task definition
in the same file. This makes things confusing, so don't use 'task'
anymore, use 'att' or 'def'.

Also rename some 'def's to 'name' when it only represented the name of
the task.

Change-Id: Iea74471f504106c65552ec7a3a1b957902fa0b3d
diff --git a/src/main/java/com/googlesource/gerrit/plugins/task/TaskAttributeFactory.java b/src/main/java/com/googlesource/gerrit/plugins/task/TaskAttributeFactory.java
index 49d2b33..04fc54c 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/task/TaskAttributeFactory.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/task/TaskAttributeFactory.java
@@ -110,44 +110,44 @@
     return a;
   }
 
-  protected void addApplicableTasks(List<TaskAttribute> tasks, ChangeData c, Node node)
+  protected void addApplicableTasks(List<TaskAttribute> atts, ChangeData c, Node node)
       throws OrmException {
     try {
       Task def = node.definition;
       boolean applicable = match(c, def.applicable);
       if (!def.isVisible) {
         if (!def.isTrusted || (!applicable && !options.onlyApplicable)) {
-          tasks.add(unknown());
+          atts.add(unknown());
           return;
         }
       }
 
       if (applicable || !options.onlyApplicable) {
-        TaskAttribute task = new TaskAttribute(def.name);
-        task.hasPass = def.pass != null || def.fail != null;
-        task.subTasks = getSubTasks(c, node);
-        task.status = getStatus(c, def, task);
+        TaskAttribute att = new TaskAttribute(def.name);
+        att.hasPass = def.pass != null || def.fail != null;
+        att.subTasks = getSubTasks(c, node);
+        att.status = getStatus(c, def, att);
         if (options.onlyInvalid && !isValidQueries(c, def)) {
-          task.status = Status.INVALID;
+          att.status = Status.INVALID;
         }
-        boolean groupApplicable = task.status != null;
+        boolean groupApplicable = att.status != null;
 
         if (groupApplicable || !options.onlyApplicable) {
-          if (!options.onlyInvalid || task.status == Status.INVALID || task.subTasks != null) {
+          if (!options.onlyInvalid || att.status == Status.INVALID || att.subTasks != null) {
             if (!options.onlyApplicable) {
-              task.applicable = applicable;
+              att.applicable = applicable;
             }
             if (def.inProgress != null) {
-              task.inProgress = matchOrNull(c, def.inProgress);
+              att.inProgress = matchOrNull(c, def.inProgress);
             }
-            task.hint = getHint(task.status, def);
-            task.exported = def.exported;
-            tasks.add(task);
+            att.hint = getHint(att.status, def);
+            att.exported = def.exported;
+            atts.add(att);
           }
         }
       }
     } catch (QueryParseException e) {
-      tasks.add(invalid()); // bad applicability query
+      atts.add(invalid()); // bad applicability query
     }
   }
 
@@ -180,33 +180,33 @@
     return a;
   }
 
-  protected boolean isValidQueries(ChangeData c, Task task) {
+  protected boolean isValidQueries(ChangeData c, Task def) {
     try {
-      match(c, task.inProgress);
-      match(c, task.fail);
-      match(c, task.pass);
+      match(c, def.inProgress);
+      match(c, def.fail);
+      match(c, def.pass);
       return true;
     } catch (OrmException | QueryParseException e) {
       return false;
     }
   }
 
-  protected Status getStatus(ChangeData c, Task task, TaskAttribute a) throws OrmException {
+  protected Status getStatus(ChangeData c, Task def, TaskAttribute a) throws OrmException {
     try {
-      return getStatusWithExceptions(c, task, a);
+      return getStatusWithExceptions(c, def, a);
     } catch (QueryParseException e) {
       return Status.INVALID;
     }
   }
 
-  protected Status getStatusWithExceptions(ChangeData c, Task task, TaskAttribute a)
+  protected Status getStatusWithExceptions(ChangeData c, Task def, TaskAttribute a)
       throws OrmException, QueryParseException {
-    if (isAllNull(task.pass, task.fail, a.subTasks)) {
-      // A leaf task has no defined subtasks.
+    if (isAllNull(def.pass, def.fail, a.subTasks)) {
+      // A leaf def has no defined subdefs.
       boolean hasDefinedSubtasks =
-          !(task.subTasks.isEmpty()
-              && task.subTasksFiles.isEmpty()
-              && task.subTasksExternals.isEmpty());
+          !(def.subTasks.isEmpty()
+              && def.subTasksFiles.isEmpty()
+              && def.subTasksExternals.isEmpty());
       if (hasDefinedSubtasks) {
         // Remove 'Grouping" tasks (tasks with subtasks but no PASS
         // or FAIL criteria) from the output if none of their subtasks
@@ -220,8 +220,8 @@
       return Status.INVALID;
     }
 
-    if (task.fail != null) {
-      if (match(c, task.fail)) {
+    if (def.fail != null) {
+      if (match(c, def.fail)) {
         // A FAIL definition is meant to be a hard blocking criteria
         // (like a CodeReview -2).  Thus, if hard blocked, it is
         // irrelevant what the subtask states, or the PASS criteria are.
@@ -233,7 +233,7 @@
         // to make a task have a FAIL status.
         return Status.FAIL;
       }
-      if (task.pass == null) {
+      if (def.pass == null) {
         // A task with a FAIL but no PASS criteria is a PASS-FAIL task
         // (they are never "READY").  It didn't fail, so pass.
         return Status.PASS;
@@ -252,7 +252,7 @@
       return Status.WAITING;
     }
 
-    if (task.pass != null && !match(c, task.pass)) {
+    if (def.pass != null && !match(c, def.pass)) {
       // Non-leaf tasks with no PASS criteria are supported in order
       // to support "grouping tasks" (tasks with no function aside from
       // organizing tasks).  A task without a PASS criteria, cannot ever
@@ -265,18 +265,18 @@
     return Status.PASS;
   }
 
-  protected String getHint(Status status, Task task) {
+  protected String getHint(Status status, Task def) {
     if (status == Status.READY) {
-      return task.readyHint;
+      return def.readyHint;
     } else if (status == Status.FAIL) {
-      return task.failHint;
+      return def.failHint;
     }
     return null;
   }
 
-  protected static boolean isAll(Iterable<TaskAttribute> tasks, Status state) {
-    for (TaskAttribute task : tasks) {
-      if (task.status != state) {
+  protected static boolean isAll(Iterable<TaskAttribute> atts, Status state) {
+    for (TaskAttribute att : atts) {
+      if (att.status != state) {
         return false;
       }
     }
diff --git a/src/main/java/com/googlesource/gerrit/plugins/task/TaskTree.java b/src/main/java/com/googlesource/gerrit/plugins/task/TaskTree.java
index 263043c..ddde9c5 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/task/TaskTree.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/task/TaskTree.java
@@ -79,13 +79,13 @@
     protected List<Node> nodes;
     protected Set<String> names = new HashSet<>();
 
-    protected void addSubDefinitions(List<Task> tasks, Map<String, String> parentProperties) {
-      for (Task task : tasks) {
-        if (task != null && !path.contains(task.name) && names.add(task.name)) {
+    protected void addSubDefinitions(List<Task> defs, Map<String, String> parentProperties) {
+      for (Task def : defs) {
+        if (def != null && !path.contains(def.name) && names.add(def.name)) {
           // path check above detects looping definitions
           // names check above detects duplicate subtasks
           try {
-            nodes.add(new Node(task, path, parentProperties));
+            nodes.add(new Node(def, path, parentProperties));
             continue;
           } catch (Exception e) {
           } // bad definition, handled below
@@ -99,12 +99,12 @@
     public List<Node> getRootNodes() throws ConfigInvalidException, IOException {
       if (nodes == null) {
         nodes = new ArrayList<>();
-        addSubDefinitions(getRootTasks(), new HashMap<String, String>());
+        addSubDefinitions(getRootDefinitions(), new HashMap<String, String>());
       }
       return nodes;
     }
 
-    protected List<Task> getRootTasks() throws ConfigInvalidException, IOException {
+    protected List<Task> getRootDefinitions() throws ConfigInvalidException, IOException {
       return taskFactory.getRootConfig().getRootTasks();
     }
   }
@@ -135,8 +135,8 @@
       addExternalDefinitions();
     }
 
-    protected void addSubDefinitions(List<Task> tasks) {
-      addSubDefinitions(tasks, definition.properties);
+    protected void addSubDefinitions(List<Task> defs) {
+      addSubDefinitions(defs, definition.properties);
     }
 
     protected void addSubFileDefinitions() {