Report an error when we find a duplicate attribute.
https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
197940
private void checkForDuplicateAttributes(ParentSoyNode<StandaloneNode> parentNode) {
    DuplicateAttributesVisitor visitor = new DuplicateAttributesVisitor();
    List<StandaloneNode> children = parentNode.getChildren();
    if (parentNode instanceof HtmlTagNode) {
      // the first child is the tag name, which isn't interesting, so skip it
      children = children.subList(1, children.size());
    }
    for (SoyNode child : children) {
      visitor.exec(child);
    }
  }
74090
def is_duplicate_content_url(url1, url2):
    """"""
    if url1 == url2:
        return True
    if url2 in url1:
        url1 = shorten_duplicate_content_url(url1)
        if not url2.endswith('/') and url1.endswith('/'):
            url2 += '/'
        return url1 == url2
    if url1 in url2:
        url2 = shorten_duplicate_content_url(url2)
        if not url1.endswith('/') and url2.endswith('/'):
            url1 += '/'
        return url1 == url2
    return False
715914
def __compat_set_attribute_was(name, previous)
      if respond_to?(:set_attribute_was, true)
        # Rails 4.2+
        set_attribute_was(name, previous)
      else
        # Rails < 4.2
        changed_attributes[name] = previous
      end
    end
772567
def parsing_errors(self, value):
        

        if value is not None:
            assert type(value) is list, "'{0}' attribute: '{1}' type is not 'list'!".format("parsing_errors", value)
            for element in value:
                assert issubclass(element.__class__, foundations.exceptions.AbstractParsingError), \
                    "'{0}' attribute: '{1}' is not a '{2}' subclass!".format(
                        "parsing_errors", element, foundations.exceptions.AbstractParsingError.__class__.__name__)
        self.__parsing_errors = value
868434
@Override @DefinedBy(Api.COMPILER_TREE) @SuppressWarnings("fallthrough")
    public Void visitAttribute(AttributeTree tree, Void ignore) {
        HtmlTag currTag = tagStack.peek().tag;
        if (currTag != null) {
            Name name = tree.getName();
            HtmlTag.Attr attr = currTag.getAttr(name);
            if (attr != null) {
                if (env.htmlVersion == HtmlVersion.HTML4 && attr.name().contains("-")) {
                    env.messages.error(HTML, tree, "dc.attr.not.supported.html4", name);
                }
                boolean first = tagStack.peek().attrs.add(attr);
                if (!first)
                    env.messages.error(HTML, tree, "dc.attr.repeated", name);
            }
            // for now, doclint allows all attribute names beginning with "on" as event handler names,
            // without checking the validity or applicability of the name
            if (!name.toString().startsWith("on")) {
                AttrKind k = currTag.getAttrKind(name);
                switch (env.htmlVersion) {
                    case HTML4:
                        validateHtml4Attrs(tree, name, k);
                        break;

                    case HTML5:
                        validateHtml5Attrs(tree, name, k);
                        break;
                }
            }

            if (attr != null) {
                switch (attr) {
                    case NAME:
                        if (currTag != HtmlTag.A) {
                            break;
                        }
                        // fallthrough
                    case ID:
                        String value = getAttrValue(tree);
                        if (value == null) {
                            env.messages.error(HTML, tree, "dc.anchor.value.missing");
                        } else {
                            if (!validName.matcher(value).matches()) {
                                env.messages.error(HTML, tree, "dc.invalid.anchor", value);
                            }
                            if (!checkAnchor(value)) {
                                env.messages.error(HTML, tree, "dc.anchor.already.defined", value);
                            }
                        }
                        break;

                    case HREF:
                        if (currTag == HtmlTag.A) {
                            String v = getAttrValue(tree);
                            if (v == null || v.isEmpty()) {
                                env.messages.error(HTML, tree, "dc.attr.lacks.value");
                            } else {
                                Matcher m = docRoot.matcher(v);
                                if (m.matches()) {
                                    String rest = m.group(2);
                                    if (!rest.isEmpty())
                                        checkURI(tree, rest);
                                } else {
                                    checkURI(tree, v);
                                }
                            }
                        }
                        break;

                    case VALUE:
                        if (currTag == HtmlTag.LI) {
                            String v = getAttrValue(tree);
                            if (v == null || v.isEmpty()) {
                                env.messages.error(HTML, tree, "dc.attr.lacks.value");
                            } else if (!validNumber.matcher(v).matches()) {
                                env.messages.error(HTML, tree, "dc.attr.not.number");
                            }
                        }
                        break;

                    case BORDER:
                        if (currTag == HtmlTag.TABLE) {
                            String v = getAttrValue(tree);
                            try {
                                if (env.htmlVersion == HtmlVersion.HTML5
                                        && (v == null || (!v.isEmpty() && Integer.parseInt(v) != 1))) {
                                    env.messages.error(HTML, tree, "dc.attr.table.border.html5", attr);
                                }
                            } catch (NumberFormatException ex) {
                                env.messages.error(HTML, tree, "dc.attr.table.border.html5", attr);
                            }
                        }
                        break;
                }
            }
        }

        // TODO: basic check on value

        return super.visitAttribute(tree, ignore);
    }
698975
private void validateUniqueAttribute(String entityType, String attributeName) throws AtlasException {
        ClassType type = typeSystem.getDataType(ClassType.class, entityType);
        AttributeInfo attribute = type.fieldMapping().fields.get(attributeName);
        if(attribute == null) {
            throw new IllegalArgumentException(
                String.format("%s is not an attribute in %s", attributeName, entityType));
        }
        if (!attribute.isUnique) {
            throw new IllegalArgumentException(
                    String.format("%s.%s is not a unique attribute", entityType, attributeName));
        }
    }
214935
def errors_for(model, attribute)
      if model.errors[attribute].present?
        name = model.class.name.constantize.human_attribute_name(attribute)
        content_tag :span, :class => 'help-block error' do
          name.to_s.capitalize + ' ' + model.errors[attribute].join(", ")
        end
      end
    end
338371
function validateUniqueness(attr, conf, err, done) {
    var cond = {where: {}};
    cond.where[attr] = this[attr];
    this.constructor.all(cond, function (error, found) {
        if (found.length > 1) {
            err();
        } else if (found.length === 1 && (!this.id || !found[0].id || found[0].id.toString() !== this.id.toString())) {
            err();
        }
        done();
    }.bind(this));
}
685097
def process_attributes(tag_name, attributes)
      new_attributes = attributes.dup

      attributes.each_pair do |name, value|
        if name[0..1] == 'e-'
          process_event_binding(tag_name, new_attributes, name, value)
        else
          process_attribute(tag_name, new_attributes, name, value)
        end
      end

      new_attributes
    end
95839
def _validate_duplication(self, subj_and_pred, cl):
        """"""
        subj, pred = subj_and_pred

        log.info("Validating duplication of member %s" % pred)
        if (subj, pred) in self.checked_attributes:
            err = self.err("{0} - duplicated member of {1}",
                           self._field_name_from_uri(pred),
                           self._field_name_from_uri(cl))
            return ValidationWarning(ValidationResult.WARNING, err['err'],
                                     err['line'], err['num'])
1295002
def check_duplicates(xml):
    ''''''

    merge_enums(xml)

    msgmap = {}
    enummap = {}
    for x in xml:
        for m in x.message:
            key = m.id
            if key in msgmap:
                print("ERROR: Duplicate message id %u for %s (%s:%u) also used by %s" % (
                    m.id,
                    m.name,
                    x.filename, m.linenumber,
                    msgmap[key]))
                return True
            fieldset = set()
            for f in m.fields:
                if f.name in fieldset:
                    print("ERROR: Duplicate field %s in message %s (%s:%u)" % (
                        f.name, m.name,
                        x.filename, m.linenumber))
                    return True
                fieldset.add(f.name)
            msgmap[key] = '%s (%s:%u)' % (m.name, x.filename, m.linenumber)
        for enum in x.enum:
            for entry in enum.entry:
                if entry.autovalue == True and "common.xml" not in entry.origin_file:
                    print("Note: An enum value was auto-generated: %s = %u" % (entry.name, entry.value))
                s1 = "%s.%s" % (enum.name, entry.name)
                s2 = "%s.%s" % (enum.name, entry.value)
                if s1 in enummap or s2 in enummap:
                    print("ERROR: Duplicate enum %s:\n\t%s = %s @ %s:%u\n\t%s" % (
                        "names" if s1 in enummap else "values",
                        s1, entry.value, entry.origin_file, entry.origin_line,
                        enummap.get(s1) or enummap.get(s2)))
                    return True
                enummap[s1] = enummap[s2] = "%s.%s = %s @ %s:%u" % (enum.name, entry.name, entry.value, entry.origin_file, entry.origin_line)

    return False
964236
function(model, attrs, validatedAttrs) {
      var error,
          invalidAttrs = {},
          isValid = true,
          computed = _.clone(attrs);

      _.each(validatedAttrs, function(val, attr) {
        error = validateAttrWithOpenArray(model, attr, val, computed);
        if (error) {
          invalidAttrs[attr] = error;
          isValid = false;
        }
      });

      return {
        invalidAttrs: invalidAttrs,
        isValid: isValid
      };
    }
939458
static void assign(ManyValueAttributeValue v1, AttributeValue v2) {
		if (v2 != null) {
			v1.setTopType(v2.getType());
		}
		if (v2 == null || !v2.isAssigned()) {
			v1.setMultipleValues(true);
		} else {
			assert v2.isAssigned();
			if (!v1.isAssigned()) {
				v1.setValue(v2);
			} else if (!v2.equals(v1)) {
				v1.setMultipleValues(true);
				if (!v1.isAssignableFrom(v2)) {
					if (!v2.isAssignableFrom(v1)) {
						v1.setInternalValue(null, AttributeType.OBJECT);
					} else {
						v1.setInternalValue(null, v2.getType());
					}
				}
			}
		}
	}
899223
function kwtoattr(html_attrs, merge){
      var k,v;
      var rv = '';
      if (merge) {
       for (k in merge) {
         if (merge.hasOwnProperty(k)) {
           v = merge[k];
           if(html_attrs.hasOwnProperty(k)){
              v = html_attrs[k] + ' ' + v
           }
           html_attrs[k] = v
         }
       }
     }

     var booleanAttributes = " hidden novalidate formnovalidate readonly required multiple autofocus disabled selected";

       for (k in html_attrs){
          if(!html_attrs.hasOwnProperty(k) || typeof html_attrs[k] !== 'string')
            continue;

          if (booleanAttributes.indexOf(" " + k + " ") > -1) {
            if (html_attrs[k]==k || html_attrs[k]=="") //otherwise omit
              rv += k + " ";
          } else {
           rv += k + '= "' + html_attrs[k].replace(/&/g,'&amp;').replace(/"/g,'&quot;') + '" ';
         }
       }
       return rv;
   }
871772
function validatefieldCodes() {
    //Flag for finding a duplicate field code
    var duplicateFieldCode = false;
    var invalidFieldCode = false;
    var fieldCodes = {};

    formData.pages = _.map(formData.pages, function(page) {
      page.fields = _.map(page.fields, function(field) {
        var fieldCode = field.fieldCode;

        //If not set, then just return the field.
        if (fieldCode === null || typeof(fieldCode) === "undefined") {
          return field;
        }

        //Checking for duplicate field code. It must be a string.
        if (typeof(fieldCode) === "string") {
          //If the length of the code is 0, then don't save it.
          if (fieldCode.length === 0) {
            delete field.fieldCode;
          } else {
            //Checking for duplicate field code
            if (fieldCodes[fieldCode]) {
              duplicateFieldCode = true;  //Flagging the field as duplicate
            } else {
              fieldCodes[fieldCode] = true;
            }
          }
        } else {
          invalidFieldCode = true; //Field codes must be a string.
        }

        return field;
      });

      return page;
    });

    if (duplicateFieldCode) {
      return new Error("Duplicate Field Codes Detected. Field Codes Must Be Unique In A Form.");
    }

    if (invalidFieldCode) {
      return new Error("Invalid Field Code. Field Codes Must Be A String.");
    }

    //All valid. can proceed to saving the form.
    return undefined;
  }
989517
private void validateUniqueAttribute(AtlasEntityType entityType, Map<String, Object> attributes) throws AtlasBaseException {
        if (MapUtils.isEmpty(attributes)) {
            throw new AtlasBaseException(AtlasErrorCode.ATTRIBUTE_UNIQUE_INVALID, entityType.getTypeName(), "");
        }

        for (String attributeName : attributes.keySet()) {
            AtlasAttributeDef attribute = entityType.getAttributeDef(attributeName);

            if (attribute == null || !attribute.getIsUnique()) {
                throw new AtlasBaseException(AtlasErrorCode.ATTRIBUTE_UNIQUE_INVALID, entityType.getTypeName(), attributeName);
            }
        }
    }
109156
private XML checksAttributesExistence(Class<?> aClass,String[] attributes){
		if(!classExists(aClass)) Error.xmlClassInexistent(this.xmlPath,aClass);
		for (String attributeName : attributes) 
			try{ 				 aClass.getDeclaredField(attributeName);		  }
			catch (Exception e){ Error.attributeInexistent(attributeName, aClass);}
		return this;
	}