mirror of
https://github.com/github/codeql.git
synced 2026-01-30 06:42:57 +01:00
Improve variable names in example code
These were inherited from the JS version of the example, which concerns HTML.
This commit is contained in:
@@ -3,8 +3,8 @@ package main
|
||||
import "regexp"
|
||||
|
||||
func broken(hostNames []byte) string {
|
||||
var htmlRe = regexp.MustCompile("\bforbidden.host.org")
|
||||
if htmlRe.Match(hostNames) {
|
||||
var hostRe = regexp.MustCompile("\bforbidden.host.org")
|
||||
if hostRe.Match(hostNames) {
|
||||
return "Must not target forbidden.host.org"
|
||||
} else {
|
||||
// This will be reached even if hostNames is exactly "forbidden.host.org",
|
||||
|
||||
@@ -3,8 +3,8 @@ package main
|
||||
import "regexp"
|
||||
|
||||
func fixed(hostNames []byte) string {
|
||||
var htmlRe = regexp.MustCompile("\\bforbidden.host.org")
|
||||
if htmlRe.Match(hostNames) {
|
||||
var hostRe = regexp.MustCompile("\\bforbidden.host.org")
|
||||
if hostRe.Match(hostNames) {
|
||||
return "Must not target forbidden.host.org"
|
||||
} else {
|
||||
// hostNames definitely doesn't contain a word "forbidden.host.org", as "\\b"
|
||||
|
||||
Reference in New Issue
Block a user