Skip to content

Instantly share code, notes, and snippets.


Bobby McDonald BobbyMcWho

View GitHub Profile
BobbyMcWho / somewhere_in_update_script.rb
Last active May 19, 2020
Some code to create `Dependabot::SecurityAdvisory`s for use in dependabot-core scripts
View somewhere_in_update_script.rb
# See:
# Other update script logic
vulnerabilities =, package_manager).fetch_advisories
# Note you may not just want top level depending on your use case do |dep|
security_vulnerabilities = []
if vulnerabilities.any?
security_vulnerabilities = vulnerabilities[].map do |vuln|
BobbyMcWho /
Last active Sep 27, 2019
Debugging Ruby locally in VSCode using ruby-debug and native breakpoints

In the extensions marketplace, search "ruby-debug" and install globally. You may need to reload your workspace afterwards.

You'll need to add readapt to your project's gemfile and bundle install.

group :development do 
  # gems...
  gem 'readapt' # Debugging with vscode ruby-debug extension
BobbyMcWho /
Last active Sep 12, 2018
libxml2 bug when validating against a complexType in an XSD

I came across this error when validating XML files against an XSD in Nokogiri.

When validating a complexType XML element, if a node fails validation due to a Occurence restriction, and it is the last node in the complex element, the validation error will not raise, and will pass as a valid document. If there is another node in the sequence that is allowed, then at that point the document will fail validation. However, the error that is thrown is misleading, because it will say that the second element is the one that is out of place, rather than the one that is actually out of place.

The easiest way to reproduce this is with xmllint:

$xmllint --noout --schema example_xsd.xsd incorrectly_passing.xml
incorrectly_passing.xml validates

Keybase proof

I hereby claim:

  • I am bobbymcwho on github.
  • I am bobbymcwho ( on keybase.
  • I have a public key ASBLy5Vbk00319-ZDn5u38bHLlTnhYEBFKH-NQzq5Zd4Xwo

To claim this, I am signing this object:

You can’t perform that action at this time.