Skip to content

Commit

Permalink
Backport allowing - in dataset names to 0.2
Browse files Browse the repository at this point in the history
This backports a part of #40 that enables hyphens in dataset names to
the 0.2 branch, for tagging as 0.2.7.
  • Loading branch information
mortenpi committed Oct 28, 2022
1 parent 9d2132f commit 9aab4f8
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ on:
push:
branches:
- master
- release-*
tags: '*'
pull_request:
jobs:
Expand Down
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "DataSets"
uuid = "c9661210-8a83-48f0-b833-72e62abce419"
authors = ["Chris Foster <[email protected]> and contributors"]
version = "0.2.6"
version = "0.2.7"

[deps]
AbstractTrees = "1520ce14-60c1-5f80-bbc7-55ef81b5835c"
Expand Down
6 changes: 3 additions & 3 deletions src/DataSets.jl
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ separated with forward slashes. Examples:
my_data
my_data_1
username/data
organization/project/data
organization-dataset_name/project/data
"""
function check_dataset_name(name::AbstractString)
# DataSet names disallow most punctuation for now, as it may be needed as
Expand All @@ -100,13 +100,13 @@ function check_dataset_name(name::AbstractString)
^
[[:alpha:]]
(?:
[[:alnum:]_] |
[-[:alnum:]_] |
/ (?=[[:alpha:]])
)*
$
"x
if !occursin(dataset_name_pattern, name)
error("DataSet name \"$name\" is invalid. DataSet names must start with a letter and can contain only letters, numbers, `_` or `/`.")
error("DataSet name \"$name\" is invalid. DataSet names must start with a letter and can contain only letters, numbers, `-`, `_` or `/`.")
end
end

Expand Down
3 changes: 2 additions & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,9 @@ end
@test DataSets.check_dataset_name("δεδομένα") === nothing
@test DataSets.check_dataset_name("a/b") === nothing
@test DataSets.check_dataset_name("a/b/c") === nothing
@test DataSets.check_dataset_name("a-b-c-") === nothing
# Invalid names
@test_throws ErrorException("DataSet name \"a?b\" is invalid. DataSet names must start with a letter and can contain only letters, numbers, `_` or `/`.") DataSets.check_dataset_name("a?b")
@test_throws ErrorException("DataSet name \"a?b\" is invalid. DataSet names must start with a letter and can contain only letters, numbers, `-`, `_` or `/`.") DataSets.check_dataset_name("a?b")
@test_throws ErrorException DataSets.check_dataset_name("1")
@test_throws ErrorException DataSets.check_dataset_name("a b")
@test_throws ErrorException DataSets.check_dataset_name("a.b")
Expand Down

0 comments on commit 9aab4f8

Please sign in to comment.