jeffjiang: fix code styles and add sanity check for QueryRuleInfo.SetRules