parameters: (self, path, name, description, params)
return_statement: return r_id
docstring: :param path: file name: 'compromised.yml', 'plugin: compromised.yml', 'custom: compromised.yml'
          :type path: str
          :param name: Short rule name
          :type name: str
          :param description: Long description of rule
          :type description: str
          :param params: default parameters to use for rule customization
          :type params: dict
docstring_summary: :param path: file name: 'compromised.yml', 'plugin: compromised.yml', 'custom: compromised.yml'
          :type path: str
          :param name: Short rule name
          :type name: str
          :param description: Long description of rule
          :type description: str
          :param params: default parameters to use for rule customization
          :type params: dict
docstring_tokens: : param path : file name : compromised . yml plugin : compromised . yml custom : compromised . yml : type path : str : param name : Short rule name : type name : str : param description : Long description of rule : type description : str : param params : default parameters to use for rule customization : type params : dict
function: def add_rule(self, path, name, description, params):
          """
          :param path: file name: 'compromised.yml', 'plugin: compromised.yml', 'custom: compromised.yml'
          :type path: str
          :param name: Short rule name
          :type name: str
          :param description: Long description of rule
          :type description: str
          :param params: default parameters to use for rule customization
          :type params: dict
          """
          valid_path = rule_template.abs_rule_path(path)
          if valid_path is None:
              print("Rule definition path cannot be verified. Saving anyway.")
  
          if not isinstance(name, (str, unicode)) or len(name) == 0:
              raise ValueError("Name cannot be empty.")
          name = name.strip()
  
          if not isinstance(description, (str, unicode)):
              raise ValueError("Description must be a string.")
          description = description.strip()
  
          r_id = self.db.insert(self.table, active=False, rule_path=path,
                         name=name, description=description,
                         params=cPickle.dumps(params))
          return r_id
function_tokens: def add_rule ( self , path , name , description , params ) : valid_path = rule_template . abs_rule_path ( path ) if valid_path is None : print ( "Rule definition path cannot be verified. Saving anyway." ) if not isinstance ( name , ( str , unicode ) ) or len ( name ) == 0 : raise ValueError ( "Name cannot be empty." ) name = name . strip ( ) if not isinstance ( description , ( str , unicode ) ) : raise ValueError ( "Description must be a string." ) description = description . strip ( ) r_id = self . db . insert ( self . table , active = False , rule_path = path , name = name , description = description , params = cPickle . dumps ( params ) ) return r_id