Skip to content

Commit

Permalink
Merge pull request #1824 from mas192/main
Browse files Browse the repository at this point in the history
Issue-1212: Bundle indentifier doesnt not check reserved words
  • Loading branch information
freakboy3742 committed May 22, 2024
2 parents da7241b + ffcf091 commit d8059ee
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 20 deletions.
1 change: 1 addition & 0 deletions changes/1212.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Validation rules for bundle identifiers have been loosened. App IDs that contain country codes or language reserved words are no longer flagged as invalid.
9 changes: 0 additions & 9 deletions src/briefcase/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,6 @@ def is_valid_bundle_identifier(bundle):
if not VALID_BUNDLE_RE.match(bundle):
return False

for part in bundle.split("."):
# *Some* 2-letter country codes are valid identifiers,
# even though they're reserved words; see:
# https://www.oracle.com/java/technologies/javase/codeconventions-namingconventions.html
# `.do` *should* be on this list, but as of Apr 2022, `.do` breaks
# the Android build tooling.
if is_reserved_keyword(part) and part not in {"in", "is"}:
return False

return True


Expand Down
5 changes: 4 additions & 1 deletion tests/commands/new/test_validate_bundle.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
"com.example.more",
"com.example42.more",
"com.example-42.more",
"ca.example.issue1212",
"au.example.issue1212",
"in.example.issue1212",
"im.glyph.and.this.is.1212",
],
)
def test_valid_bundle(new_command, bundle):
Expand All @@ -23,7 +27,6 @@ def test_valid_bundle(new_command, bundle):
"com.hello_world", # underscore
"com.hello,world", # comma
"com.hello world!", # exclamation point
"com.pass.example", # Reserved word
],
)
def test_invalid_bundle(new_command, bundle):
Expand Down
4 changes: 0 additions & 4 deletions tests/config/test_AppConfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,6 @@ def test_valid_bundle(bundle):
"com.hello_world", # underscore
"com.hello,world", # comma
"com.hello world!", # exclamation point
"com.pass", # Python reserved word
"com.pass.example", # Python reserved word
"com.switch", # Java reserved word
"com.switch.example", # Java reserved word
],
)
def test_invalid_bundle_identifier(bundle):
Expand Down
6 changes: 0 additions & 6 deletions tests/config/test_is_valid_bundle_identifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,6 @@ def test_valid_bundle(bundle):
"com.hello_world", # underscore
"com.hello,world", # comma
"com.hello world!", # exclamation point
"com.pass", # Python reserved word
"com.pass.example", # Python reserved word
"com.switch", # Java reserved word
"com.switch.example", # Java reserved word
"int.example", # Valid identifier with a reserved word as the TLD
"do.example", # This *should* be valid by the Java spec, but Android chokes.
],
)
def test_invalid_bundle(bundle):
Expand Down

0 comments on commit d8059ee

Please sign in to comment.