ncbo / ontologies_linked_data

Models and serializers for ontologies and related artifacts backed by 4store
Other
18 stars 8 forks source link

Feature: extend slice acronym validator to not accept underscore #176

Closed syphax-bouazzouni closed 11 months ago

syphax-bouazzouni commented 11 months ago

fix https://github.com/ncbo/ontologies_api/pull/87#issuecomment-1721621480

codecov[bot] commented 11 months ago

Codecov Report

Merging #176 (da59b8c) into develop (b5057b4) will increase coverage by 0.14%. Report is 84 commits behind head on develop. The diff coverage is 83.97%.

:exclamation: Current head da59b8c differs from pull request most recent head c9e05b2. Consider uploading reports for the commit c9e05b2 to get more accurate results

@@             Coverage Diff             @@
##           develop     #176      +/-   ##
===========================================
+ Coverage    80.75%   80.90%   +0.14%     
===========================================
  Files           63       63              
  Lines         4848     4912      +64     
===========================================
+ Hits          3915     3974      +59     
- Misses         933      938       +5     
Flag Coverage Δ
unittests 80.90% <83.97%> (+0.14%) :arrow_up:

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
lib/ontologies_linked_data/diff/bubastis_diff.rb 76.19% <100.00%> (ø)
lib/ontologies_linked_data/mappings/mappings.rb 80.99% <100.00%> (-0.96%) :arrow_down:
lib/ontologies_linked_data/models/base.rb 71.96% <100.00%> (+4.25%) :arrow_up:
...linked_data/models/properties/ontology_property.rb 84.78% <100.00%> (+0.06%) :arrow_up:
lib/ontologies_linked_data/models/users/user.rb 90.76% <100.00%> (+0.29%) :arrow_up:
lib/ontologies_linked_data/monkeypatches/object.rb 71.73% <100.00%> (+1.68%) :arrow_up:
lib/ontologies_linked_data/parser/owlapi.rb 86.40% <100.00%> (+5.82%) :arrow_up:
lib/ontologies_linked_data/serializers/json.rb 80.88% <100.00%> (ø)
lib/ontologies_linked_data/models/slice.rb 84.84% <80.00%> (-0.87%) :arrow_down:
lib/ontologies_linked_data/serializers/xml.rb 68.96% <0.00%> (ø)
... and 3 more

... and 1 file with indirect coverage changes

mdorf commented 11 months ago

@syphax-bouazzouni, I am looking at the code code changes and not seeing anything there that prevents the underscores in the slice acronyms:

      if acronym.match(/[^-0-9a-zA-Z]/)
        errors << [:special_characters, "`acronym` must only contain the folowing characters: -, _, letters, and numbers"]
      end

In fact, the error message states that "_"s are allowed.

syphax-bouazzouni commented 11 months ago

@syphax-bouazzouni, I am looking at the code changes and not seeing anything there that prevents the underscores in the slice acronyms:

      if acronym.match(/[^-0-9a-zA-Z]/)
        errors << [:special_characters, "`acronym` must only contain the folowing characters: -, _, letters, and numbers"]
      end

In fact, the error message states that "_"s are allowed.

Hello @mdorf, This regex acronym.match(/[^-0-9a-zA-Z]/) enforces the acronym to contain only a number, letter or '-'.

I copied/reused this line from the ontology acronym validator code, and forget to remove the "_" from the error message. I updated the message to remove it for the error message