Fix a bunch of typos

--
MOS_MIGRATED_REVID=138757881
diff --git a/src/main/java/com/google/devtools/build/docgen/templates/be/functions.vm b/src/main/java/com/google/devtools/build/docgen/templates/be/functions.vm
index 293b043..05ab87a 100644
--- a/src/main/java/com/google/devtools/build/docgen/templates/be/functions.vm
+++ b/src/main/java/com/google/devtools/build/docgen/templates/be/functions.vm
@@ -61,8 +61,8 @@
   statement to work, <code>tools/build_rules/BUILD</code> must exist (an empty
   file is sufficient) The name of the file must have the suffix
   <code>.bzl</code>. If the specified label is in the relative label syntax
-  (<code>:a/b.bzl</code>), it will be resolved relative to the package the file
-   the <code>load</code> statement is in.
+  (<code>:a/b.bzl</code>), it will be resolved relative to the package of the
+  file the <code>load</code> statement is in.
 </p>
 
 <p>
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/ConfiguredRuleClassProvider.java b/src/main/java/com/google/devtools/build/lib/analysis/ConfiguredRuleClassProvider.java
index 56c815f..837bad3 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/ConfiguredRuleClassProvider.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/ConfiguredRuleClassProvider.java
@@ -691,7 +691,7 @@
    * interpreted as native TransitiveInfoProvider instances of type (map value).
    *
    * <p>That is, if this map contains "dummy" -> DummyProvider.class, a "dummy" entry in a skylark
-   * rule implementations returned struct will be exported from that ConfiguredTarget as a
+   * rule implementation's returned struct will be exported from that ConfiguredTarget as a
    * DummyProvider.
    */
   public ImmutableBiMap<String, Class<? extends TransitiveInfoProvider>>
diff --git a/src/main/java/com/google/devtools/build/lib/rules/SkylarkRuleClassFunctions.java b/src/main/java/com/google/devtools/build/lib/rules/SkylarkRuleClassFunctions.java
index 0050178..def3f52 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/SkylarkRuleClassFunctions.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/SkylarkRuleClassFunctions.java
@@ -286,7 +286,7 @@
                 + "The dictionary key becomes an attribute in <code>ctx.outputs</code>. "
                 + "Similar to computed dependency rule attributes, you can also specify the name "
                 + "of a function that returns the dictionary. This function can access all rule "
-                + "attributes that are listed as parameters in its function signature."
+                + "attributes that are listed as parameters in its function signature. "
                 + "For example, <code>outputs = _my_func<code> with <code>def _my_func(srcs, deps):"
                 + "</code> has access to the attributes 'srcs' and 'deps' (if defined)."
       ),
@@ -469,7 +469,7 @@
         + "(see <a href=\"attr.html\">attr</a> module). "
         + "Aspect attributes are available to implementation function as fields of ctx parameter. "
         + "Implicit attributes starting with <code>_</code> must have default values, and have "
-        + "type <code>label</code> or <code>label_list</code>."
+        + "type <code>label</code> or <code>label_list</code>. "
         + "Explicit attributes must have type <code>string</code>, and must use the "
         + "<code>values</code> restriction. If explicit attributes are present, the aspect can "
         + "only be used with rules that have attributes of the same name and type, with valid "
@@ -641,7 +641,7 @@
         PackageContext pkgContext = (PackageContext) env.lookup(PackageFactory.PKG_CONTEXT);
         if (pkgContext == null) {
           throw new EvalException(ast.getLocation(),
-              "Cannot instantiate a rule when loading a .bzl file. Rules can only called from "
+              "Cannot instantiate a rule when loading a .bzl file. Rules can only be called from "
               + "a BUILD file (possibly via a macro).");
         }
         return RuleFactory.createAndAddRule(
@@ -695,7 +695,7 @@
    * All classes of values that need special processing after they are exported
    * from an extension file.
    *
-   * Order in list list is significant: all {@link }SkylarkAspect}s need to be exported
+   * Order in list is significant: all {@link SkylarkAspect}s need to be exported
    * before {@link RuleFunction}s etc.
    */
   private static final List<Class<? extends SkylarkExportable>> EXPORTABLES =
diff --git a/src/main/java/com/google/devtools/build/lib/rules/SkylarkRuleContext.java b/src/main/java/com/google/devtools/build/lib/rules/SkylarkRuleContext.java
index ebd4db6..ae6a630 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/SkylarkRuleContext.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/SkylarkRuleContext.java
@@ -92,7 +92,7 @@
   public static final String EXECUTABLE_DOC =
       "A <code>struct</code> containing executable files defined in label type "
           + "attributes marked as <code>executable=True</code>. The struct fields correspond "
-          + "to the attribute names. Each struct value is always a <code>file</code>s or "
+          + "to the attribute names. Each value in the struct is either a <code>file</code> or "
           + "<code>None</code>. If an optional attribute is not specified in the rule "
           + "then the corresponding struct value is <code>None</code>. If a label type is not "
           + "marked as <code>executable=True</code>, no corresponding struct field is generated.";
diff --git a/src/main/java/com/google/devtools/build/lib/rules/SkylarkRuleImplementationFunctions.java b/src/main/java/com/google/devtools/build/lib/rules/SkylarkRuleImplementationFunctions.java
index 015b167..75c5093 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/SkylarkRuleImplementationFunctions.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/SkylarkRuleImplementationFunctions.java
@@ -236,7 +236,7 @@
             // When we use a shell command, add an empty argument before other arguments.
             //   e.g.  bash -c "cmd" '' 'arg1' 'arg2'
             // bash will use the empty argument as the value of $0 (which we don't care about).
-            // arg1 and arg2 will be $1 and $2, as a user exects.
+            // arg1 and arg2 will be $1 and $2, as a user expects.
             builder.addArgument("");
           }
           builder.addArguments(arguments.getContents(String.class, "arguments"));
diff --git a/src/main/java/com/google/devtools/build/lib/rules/apple/DottedVersion.java b/src/main/java/com/google/devtools/build/lib/rules/apple/DottedVersion.java
index bb6d269..ac5e80f 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/apple/DottedVersion.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/apple/DottedVersion.java
@@ -147,7 +147,7 @@
   @Override
   @SkylarkCallable(name = "compare_to", 
     doc = "Compares based on most signifigant (first) not-matching version component. "
-        + "So, for example, 1.2.3 > 1.2.4")
+        + "So, for example, 1.2.3 < 1.2.4")
   public int compareTo(DottedVersion other) {
     int maxComponents = Math.max(components.size(), other.components.size());
     for (int componentIndex = 0; componentIndex < maxComponents; componentIndex++) {
diff --git a/src/main/java/com/google/devtools/build/lib/syntax/Environment.java b/src/main/java/com/google/devtools/build/lib/syntax/Environment.java
index 08614ac..fffacb6 100644
--- a/src/main/java/com/google/devtools/build/lib/syntax/Environment.java
+++ b/src/main/java/com/google/devtools/build/lib/syntax/Environment.java
@@ -94,7 +94,7 @@
    * is closed, it becomes immutable, including the Frame, which can be shared in other
    * {@link Environment}-s. Indeed, a {@link UserDefinedFunction} will close over the global
    * Frame of its definition {@link Environment}, which will thus be reused (immutably)
-   * in all any {@link Environment} in which this function is called, so it's important to
+   * in any {@link Environment} in which this function is called, so it's important to
    * preserve the {@link Mutability} to make sure no Frame is modified after it's been finalized.
    */
   public static final class Frame implements Freezable {
diff --git a/src/main/java/com/google/devtools/build/lib/syntax/LValue.java b/src/main/java/com/google/devtools/build/lib/syntax/LValue.java
index ccd28f5..02f6084 100644
--- a/src/main/java/com/google/devtools/build/lib/syntax/LValue.java
+++ b/src/main/java/com/google/devtools/build/lib/syntax/LValue.java
@@ -101,7 +101,7 @@
     if (o instanceof SkylarkDict) {
       SkylarkDict<Object, Object> dict = (SkylarkDict<Object, Object>) o;
       dict.put(key, value, loc, env);
-    } else if (o instanceof  SkylarkList) {
+    } else if (o instanceof SkylarkList) {
       SkylarkList<Object> list = (SkylarkList<Object>) o;
       list.set(key, value, loc, env);
     } else {
diff --git a/src/main/java/com/google/devtools/build/lib/syntax/Mutability.java b/src/main/java/com/google/devtools/build/lib/syntax/Mutability.java
index 44b3605..21d5c28 100644
--- a/src/main/java/com/google/devtools/build/lib/syntax/Mutability.java
+++ b/src/main/java/com/google/devtools/build/lib/syntax/Mutability.java
@@ -236,8 +236,8 @@
 
     // Consider an {@link Environment} e1, in which is created {@link UserDefinedFunction} f1,
     // that closes over some variable v1 bound to list l1. If somehow, via the magic of callbacks,
-    // f1 or l1 is passed as argument to some function f2 evaluated in {@link environment} e2
-    // while e1 is be mutable, e2, being a different {@link Environment}, should not be
+    // f1 or l1 is passed as an argument to some function f2 evaluated in {@link Environment} e2
+    // while e1 is still mutable, then e2, being a different {@link Environment}, should not be
     // allowed to mutate objects from e1. It's a bug, that shouldn't happen in our current code
     // base, so we throw an AssertionError. If in the future such situations are allowed to happen,
     // then we should throw a MutabilityException instead.