Skip to content

Commit 5c7bed1

Browse files
committed
Apply underscore fix to ProblematicIdentifiers after rebase
The underscore fix (allowing _ in identifiers per spec) needs to target ProblematicIdentifiers instead of PreviewQuery after the extraction refactor on the target branch.
1 parent 2318522 commit 5c7bed1

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

app/services/work_packages/identifier_autofix/problematic_identifiers.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class ProblematicIdentifiers
5151
[:too_long, ->(id, max) { id.length > max }],
5252
[:numerical, ->(id, _) { id.match?(/\A\d+\z/) }],
5353
[:starts_with_number, ->(id, _) { id.match?(/\A\d/) }],
54-
[:special_characters, ->(id, _) { id.match?(/[^a-zA-Z0-9]/) }],
54+
[:special_characters, ->(id, _) { id.match?(/[^a-zA-Z0-9_]/) }],
5555
[:not_fully_uppercased, ->(id, _) { id != id.upcase }]
5656
].freeze
5757

@@ -80,7 +80,7 @@ def exclusion_set
8080
private
8181

8282
def exceeds_max_length = Project.where("length(identifier) > ?", max_identifier_length)
83-
def contains_non_alphanumeric = Project.where("identifier ~ ?", "[^a-zA-Z0-9]")
83+
def contains_non_alphanumeric = Project.where("identifier ~ ?", "[^a-zA-Z0-9_]")
8484
def starts_with_digit = Project.where("identifier ~ ?", "^[0-9]")
8585
def not_fully_uppercased = Project.where("identifier != UPPER(identifier)")
8686

spec/services/work_packages/identifier_autofix/preview_query_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@ def create_valid_project(name:, identifier:)
6161
context "when a project has underscores and lowercase in its identifier" do
6262
before { create_valid_project(name: "My Project", identifier: "my_proj") }
6363

64-
it "flags it as :not_uppercase (underscores are allowed per spec)" do
64+
it "flags it as :not_fully_uppercased (underscores are allowed per spec)" do
6565
expect(result.total_count).to eq(1)
66-
expect(result.projects_data.first[:error_reason]).to eq(:not_uppercase)
66+
expect(result.projects_data.first[:error_reason]).to eq(:not_fully_uppercased)
6767
end
6868
end
6969

0 commit comments

Comments
 (0)