Check that all required attributes have been set
13977
@Override
    protected void checkParameters() {
        super.checkParameters();

        if (projectFile == null && classLocations.size() == 0 && filesets.size() == 0 && dirsets.size() == 0 && auxAnalyzepath == null) {
            throw new BuildException("either projectfile, <class/>, <fileset/> or <auxAnalyzepath/> child "
                    + "elements must be defined for task <" + getTaskName() + "/>", getLocation());
        }

        if (outputFormat != null
                && !("xml".equalsIgnoreCase(outputFormat.trim()) || "xml:withMessages".equalsIgnoreCase(outputFormat.trim())
                        || "html".equalsIgnoreCase(outputFormat.trim()) || "text".equalsIgnoreCase(outputFormat.trim())
                        || "xdocs".equalsIgnoreCase(outputFormat.trim()) || "emacs".equalsIgnoreCase(outputFormat.trim()))) {
            throw new BuildException("output attribute must be either " + "'text', 'xml', 'html', 'xdocs' or 'emacs' for task <"
                    + getTaskName() + "/>", getLocation());
        }

        if (reportLevel != null
                && !("experimental".equalsIgnoreCase(reportLevel.trim()) || "low".equalsIgnoreCase(reportLevel.trim())
                        || "medium".equalsIgnoreCase(reportLevel.trim()) || "high".equalsIgnoreCase(reportLevel.trim()))) {
            throw new BuildException("reportlevel attribute must be either "
                    + "'experimental' or 'low' or 'medium' or 'high' for task <" + getTaskName() + "/>", getLocation());
        }

        // FindBugs allows both, so there's no apparent reason for this check
        // if ( excludeFile != null && includeFile != null ) {
        // throw new BuildException("only one of excludeFile and includeFile " +
        // " attributes may be used in task <" + getTaskName() + "/>",
        // getLocation());
        // }

        List<String> efforts = Arrays.asList( "min", "less", "default", "more", "max");
        if (effort != null && !efforts.contains(effort)) {
            throw new BuildException("effort attribute must be one of " + efforts);
        }
    }
1027149
protected function checkRequired()
    {
        $missing = array();
        foreach ($this->validFields as $field => $params) {
            if (isset($params['required']) && $params['required']) {
                if ($params['type'] == "single") {
                    if (!isset($this->formData[$field])) {
                        $missing[] = $field;
                        $this->errorMessage[] = 'Missing field: ' . $field;
                    }
                } elseif ($params['type'] == "product") {
                    foreach ($this->products as $prod) {
                        $paramName = $params['paramName'];
                        if (!isset($prod[$paramName])) {
                            $missing[] = $field;
                            $this->errorMessage[] = 'Missing field: ' . $field;
                        }
                    }
                }
            }
        }
        $this->missing = $missing;
        return true;
    }
259482
def validate_required_all(required_configs)
      required_configs.each do |config|
        unless config_set?(config)
          message = "Configuration value `#{config}` is required."
          raise ConfigurationError, message
        end
      end
    end
685280
def _required_attr(self, attr, key):
        """"""
        assert isinstance(attr, dict)
        if key not in attr:
            raise AttributeError("Required attribute {} not found.".format(key))
        return attr[key]
1101445
def validate(self):
        """"""

        for key, req in self.stored().items():
            val = getattr(self, key)
            req.validate(val)

        # Run checks defined in __checkers__
        self._run_checks()
114046
function _anyFailingRequired(attributes) {
    for (var i in attributes) {
      var key = attributes[i];
      if ( ! _resolvers.validateRequired(key, self.date[key])) {
        return true;
      }
    }

    return false;
  }
775776
def finish
      retval = {}
      # Ensure all required attributes have been set
      @attributes.each do |attr|
        val = instance_variable_get "@#{attr}"
        raise ArgumentError, "Missing attribute #{attr}" if val.nil?
        retval[attr] = val
      end
      retval
    end
130955
function hasAllRequired( rule, element ) {
		if ( rule.nothingRequired )
			return true;

		var i, req, reqs, existing;

		if ( ( reqs = rule.requiredClasses ) ) {
			existing = element.classes;
			for ( i = 0; i < reqs.length; ++i ) {
				req = reqs[ i ];
				if ( typeof req == 'string' ) {
					if ( CKEDITOR.tools.indexOf( existing, req ) == -1 )
						return false;
				}
				// This means regexp.
				else {
					if ( !CKEDITOR.tools.checkIfAnyArrayItemMatches( existing, req ) )
						return false;
				}
			}
		}

		return hasAllRequiredInHash( element.styles, rule.requiredStyles ) &&
			hasAllRequiredInHash( element.attributes, rule.requiredAttributes );
	}
413433
def _validateAttrs(self, keys):
        """"""
        badAttrsMsg = ""
        for k in keys:
            if k not in self.attrs:
                badAttrsMsg += "Attribute key '%s' is not a valid attribute"%(k)
        if badAttrsMsg:
            raise ValueError("Encountered invalid attributes.  ALLOWED: %s%s%s"\
                %(list(self.attrs), os.linesep, badAttrsMsg))
1146133
def _required_attribute(element, name, default):
    
    if element.get(name) is None:
        element.set(name, default)
280470
def check_initialized(self):
        
        for name, field in self.__by_name.items():
            value = getattr(self, name)
            if value is None:
                if field.required:
                    raise ValidationError(
                        "Message %s is missing required field %s" %
                        (type(self).__name__, name))
            else:
                try:
                    if (isinstance(field, MessageField) and
                            issubclass(field.message_type, Message)):
                        if field.repeated:
                            for item in value:
                                item_message_value = field.value_to_message(
                                    item)
                                item_message_value.check_initialized()
                        else:
                            message_value = field.value_to_message(value)
                            message_value.check_initialized()
                except ValidationError as err:
                    if not hasattr(err, 'message_name'):
                        err.message_name = type(self).__name__
                    raise
936942
function() {
    // Check for unknown attributes
    var key, unknownAttrs = []
    for (key in obj) {
      if (!self.validators.hasOwnProperty(key))
        unknownAttrs.push(key)
    }
    if (unknownAttrs.length)
      self._merge(validationErrors, 'unknown attributes [' + unknownAttrs.join(', ') + ']', prefix)
      //validationErrors[prefix || '.'] = 'unknown attributes [' + unknownAttrs.join(', ') + ']'

    // Run the `after` hook only if there is no validation error.
    if (isValid && self.after) {
      try {
        self.after.call(obj)
      } catch (err) {
        if(!_handleError(err)) return done(err)
      }
    }
    done(null, validationErrors)
  }
340998
def validate(self):
        

        missing = self.missing_property_names()

        if len(missing) > 0:
            raise validators.ValidationError(
                "'{0}' are required attributes for {1}"
                            .format(missing, self.__class__.__name__))

        for prop, val in six.iteritems(self._properties):
            if val is None:
                continue

            if isinstance(val, ProtocolBase):
                val.validate()
            elif getattr(val, 'isLiteralClass', None) is True:
                val.validate()
            elif isinstance(val, list):
                for subval in val:
                  subval.validate()
            else:
                # This object is of the wrong type, but just try setting it
                # The property setter will enforce its correctness
                # and handily coerce its type at the same time
                setattr(self, prop, val)

        return True
646294
def validate_required_any(required_configs)
      valid = required_configs.select { |config| config_set?(config) }

      return if valid.any?

      config_list = required_configs.map { |conf| '`' + conf + '`' }.join(', ')
      message = "At least one of the configuration values has to be set: #{config_list}."
      raise ConfigurationError, message
    end
1172428
def has_attribute(module_name, attribute_name):
    """"""
    init_file = '%s/__init__.py' % module_name
    return any(
        [attribute_name in init_line for init_line in open(init_file).readlines()]
    )
1083862
def _checkAttribs(self, strict):
        """"""
        if self.choice:
            warning("Choice values not allowed for real-type parameter " +
                    self.name, strict)
            self.choice = None
664131
def has_attribute(*args)

      args.each { |a| a = a.to_s; return a if attributes[a] != nil }

      nil
    end