Improve regexp that matches functional tests#276
Merged
bf4 merged 2 commits intosimplecov-ruby:masterfrom Jul 13, 2014
sferik:fix_regexp
Merged
Improve regexp that matches functional tests#276bf4 merged 2 commits intosimplecov-ruby:masterfrom sferik:fix_regexp
bf4 merged 2 commits intosimplecov-ruby:masterfrom
sferik:fix_regexp
Conversation
The regexp was added by @semanticart in a7024ef. This patch improves the regular expression in two ways: 1. It adds escape characters (`/`) before the curly braces (`{`, `}`). 2. It removes unnecessary question marks (`?`). In regular expressions, curly braces are meta-characters used to specify the amount of repetition, so they need to be escaped. The Ruby regular expression engine is smart enough to figure out what to do in this case, but it outputs the following warnings on that line: warning: regexp has invalid interval warning: regexp has `}' without escape The question marks are not necessary because dot star (`.*`) matches zero or more of any character.
bf4
added a commit
that referenced
this pull request
Jul 13, 2014
Improve regexp that matches functional tests
jsonn
pushed a commit
to jsonn/pkgsrc
that referenced
this pull request
Feb 3, 2015
0.9.1, 2014-09-21 ([changes](simplecov-ruby/simplecov@v0.9.0...v0.9.1)) ==================== ## Bugfixes * In 0.9.0, we introduced a regression that made SimpleCov no-op mode fail on Ruby 1.8, while dropping 1.8 support altogether is announced only for v1.0. This has been fixed. See [#333](simplecov-ruby/simplecov#333) (thanks (@sferik) 0.9.0, 2014-07-17 ([changes](simplecov-ruby/simplecov@v0.8.2...v0.9.0)) ==================== **A warm welcome and big thank you to the new contributors [@xaviershay](https://github.com/xaviershay), [@sferik](https://github.com/sferik) and especially [@bf4](https://github.com/bf4) for tackling a whole lot of issues and pull requests for this release!** ## Enhancements * New interface to specify multiple formatters. See [#317](simplecov-ruby/simplecov#317) (thanks @sferik) * Document in the README how to exclude code from coverage reports, and that the feature shouldn't be abused for skipping untested private code. See [#304](simplecov-ruby/simplecov#304) * Clarify Ruby version support. See [#279](simplecov-ruby/simplecov#279) (thanks @deivid-rodriguez) ## Bugfixes * Ensure calculations return Floats, not Fixnum or Rational. Fixes segfaults with mathn. See [#245](simplecov-ruby/simplecov#245) (thanks to @bf4) * Using `Kernel.exit` instead of exit to avoid uncaught throw :IRB_EXIT when exiting irb sessions. See [#287](simplecov-ruby/simplecov#287) (thanks @wless1) See [#285](simplecov-ruby/simplecov#285) * Does not look for .simplecov in ~/ when $HOME is not set. See [#311](simplecov-ruby/simplecov#311) (thanks @lasseebert) * Exit with code only if it's Numeric > 0. See [#302](simplecov-ruby/simplecov#303 @hajder) * Make default filter case insensitive. See [#280](simplecov-ruby/simplecov#280) (thanks @ryanatball) * Improve regexp that matches functional tests. See [#276](simplecov-ruby/simplecov#276) (thanks @sferik) * Fix TravisCI [#272](simplecov-ruby/simplecov#272) [#278](simplecov-ruby/simplecov#278), [#302](simplecov-ruby/simplecov#302) * Fix global config load. See [#311](simplecov-ruby/simplecov#311) (thanks @lasseebert)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The regexp was added by @semanticart in a7024ef.
This patch improves the regular expression in two ways:
/) before the curly braces ({,}).?).In regular expressions, curly braces are meta-characters used to specify the amount of repetition, so they need to be escaped. The Ruby regular expression engine is smart enough to figure out what to do in this case, but it outputs the following warnings on that line:
The question marks are not necessary because dot star (
.*) matches zero or more of any character.I’ve also taken this opportunity to clean up whitespace, which is one of my pet peeves. I’ve done so in a separate commit, so feel free to
git cherry-pickif, for whatever reason, you prefer the whitespace the way it is.