Skip to content

Commit

Permalink
Merge pull request #4 from Takishima/bugfix/if-defined-env
Browse files Browse the repository at this point in the history
Bugfix/if defined env
  • Loading branch information
vancraar authored Nov 25, 2024
2 parents 57c20b3 + 3527e83 commit fbf35a7
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 4 deletions.
21 changes: 21 additions & 0 deletions cmakelang/contrib/signature_db.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,26 @@
"46OOj1B85tUs1+f6wCuX4SyIVww5aA==",
"=4ykw"
]
},
{
"template": "individual",
"version": "1.0",
"name": "Damien Nguyen",
"email": "ngn.damien@gmail.com",
"signature": [
"iQIzBAABCAAdFiEEtBZVbK28SeNxGQ/a38N7+okcz20FAmFIdFMACgkQ38N7+okc",
"z23JFQ//aipKFzavbsF1Xw7k5GFuUIGwpxzczwLANSS0p1Ot73ZW3gxAfYwuOwLZ",
"wXR2oj4uXKbCiTQzzYayd+GLQbfS/jtJYrmZUewBA8bu5YlQJp/RolRt8w9PHm0W",
"tN4jOlazJq4kQF/SY3rjnLvTLgJ72yAxmTvT4Icm66QYBV7kBAOIEt9U3gh+PZqR",
"d97ZUvNzB+ftksABPGknrGVx82J8aJn4oEXgnrAN6KUbGdr0qOqD28LS/pOTlB/T",
"deyYs5eITCe5Vwa76/tOpJ3VYV2gcYtrtaz/nrv69EJRx0kVRZMaseUKYgA4FZ6x",
"SYXVeDpiHnMjVqFkk9sCd335gXqsAkXazkZyxOHcBJej/HcL7hb1FJqyiKttdYPE",
"hEbiVqStuh4i9LFULFVOt4NjHQpnWSlYyizj+NIdXkwm0Y7iLo6pc2+9s6UuZQk5",
"kvJaG8fYqxYUMY1aFTVxmIJYPvhDiEzAdqbvIL9gvasOIiQErbRw4D8VK+zUjnof",
"RYWqh8So5zZ6KXhHVacuee1vaveBim6waV2pD5yjJl+jZqrij+CUqx2jEkkojoee",
"aBeC+sl7hl1DD35DaOR8L8scnwfoSHP+PzG32xxgNghP/5klFVh+vAqHaPZuV0w5",
"LtRr4h5ZnW/Dyvzvu3Y71UWGxZgL2Msa9t8JqYs+WjdUKDSrbjg=",
"=OPr1"
]
}
]
4 changes: 2 additions & 2 deletions cmakelang/lint/basic_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ def check_tokens(self, tokens):

missing_prefix = re.compile(
r"(?<!\\)(?:\\\\)*"
r"(\$|\{)((?:(?:[A-Za-z0-9_./+-])|(?:\\[^A-Za-z0-9_./+-]))+)")
r"(\$|\{|ENV\{)((?:(?:[A-Za-z0-9_./+-])|(?:\\[^A-Za-z0-9_./+-]))+)")

match_types = (
TokenType.QUOTED_LITERAL,
Expand All @@ -281,7 +281,7 @@ def check_tokens(self, tokens):
match = missing_prefix.search(resolved)
if match and variables.CASE_SENSITIVE_REGEX.match(match.group(2)):
catmatch = "".join(match.group(1, 2))
if catmatch == "$ENV":
if catmatch == "$ENV" or match.group(1) == "ENV{":
# This is an environment variable reference, so we don't try to
# match it
continue
Expand Down
10 changes: 8 additions & 2 deletions cmakelang/lint/test/lint_tests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

# test: line-endings
# expect: C0327
# This line has the wrong line endings
# This line has the wrong line endings

# test: function-defn
# expect: C0111,C0103
Expand Down Expand Up @@ -56,7 +56,6 @@ if(TRUE)
message("Hello world")
endif()


# test: oneline-disable
# expect:
set(gtest_force_shared_crt ON # cmake-lint: disable=C0103
Expand Down Expand Up @@ -244,6 +243,13 @@ message("$CMAKE_INSTALL_PREFIX}")
message("{CMAKE_INSTALL_PREFIX}")
message("${CMAKE_INSTALL_PREFIX")

# test: valid-if-defined-env-varref
# expect:
if(DEFINED ENV{CMAKE_CXX_COMPILER_LAUNCHER})
message("Hello world")
endif()


# test: missing-final-newline
# expect: C0304
# This file is missing a final newline

0 comments on commit fbf35a7

Please sign in to comment.