Multi Formatter #158

Merged
merged 4 commits into from Sep 11, 2012

Conversation

Projects
None yet
5 participants
@nikitug
Contributor

nikitug commented Aug 30, 2012

Hi,

What do you think about a built-in Multi Formatter?

SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
  SimpleCov::Formatter::HTMLFormatter,
  SimpleCov::Formatter::CSVFormatter,
]

Here is a possible implementation.

@colszowka

This comment has been minimized.

Show comment Hide comment
@colszowka

colszowka Aug 30, 2012

Owner

Cool stuff, thanks a lot! I also really like the clean syntax.

Two things that would be cool to have if you've got the time to add it:

  • A cucumber feature demonstrating the use of multiple formatters. The features also serve as a usage demonstration for the various config options, so this should be included
  • Rescue possible exceptions in the format method for each individual formatter and print an error ("Formatter XYZ failed with ABC") so that the other formatters still get invoked
Owner

colszowka commented Aug 30, 2012

Cool stuff, thanks a lot! I also really like the clean syntax.

Two things that would be cool to have if you've got the time to add it:

  • A cucumber feature demonstrating the use of multiple formatters. The features also serve as a usage demonstration for the various config options, so this should be included
  • Rescue possible exceptions in the format method for each individual formatter and print an error ("Formatter XYZ failed with ABC") so that the other formatters still get invoked
@colszowka

This comment has been minimized.

Show comment Hide comment
@colszowka

colszowka Aug 30, 2012

Owner

Also: Very special bonus points for thinking of updating the README 👍

Owner

colszowka commented Aug 30, 2012

Also: Very special bonus points for thinking of updating the README 👍

@travisbot

This comment has been minimized.

Show comment Hide comment
@travisbot

travisbot Aug 30, 2012

This pull request passes (merged 5d316e78 into 9c17355).

This pull request passes (merged 5d316e78 into 9c17355).

@nikitug

This comment has been minimized.

Show comment Hide comment
@nikitug

nikitug Aug 31, 2012

Contributor

Thanks, glad you like it :)
One question: where is the best place to put an exceptions handling test - in cucumber feature or in unit test?

Contributor

nikitug commented Aug 31, 2012

Thanks, glad you like it :)
One question: where is the best place to put an exceptions handling test - in cucumber feature or in unit test?

@travisbot

This comment has been minimized.

Show comment Hide comment
@travisbot

travisbot Aug 31, 2012

This pull request fails (merged 3e104bf into 9c17355).

This pull request fails (merged 3e104bf into 9c17355).

@travisbot

This comment has been minimized.

Show comment Hide comment
@travisbot

travisbot Aug 31, 2012

This pull request fails (merged a7bedcaf into 9c17355).

This pull request fails (merged a7bedcaf into 9c17355).

@travisbot

This comment has been minimized.

Show comment Hide comment
@travisbot

travisbot Aug 31, 2012

This pull request fails (merged 6decd51 into 9c17355).

This pull request fails (merged 6decd51 into 9c17355).

colszowka added a commit that referenced this pull request Sep 11, 2012

@colszowka colszowka merged commit 2fd9a4c into colszowka:master Sep 11, 2012

@colszowka

This comment has been minimized.

Show comment Hide comment
@colszowka

colszowka Sep 11, 2012

Owner

Looks great, thanks!

Owner

colszowka commented Sep 11, 2012

Looks great, thanks!

@eric-hu

This comment has been minimized.

Show comment Hide comment
@eric-hu

eric-hu Sep 19, 2012

@colszowka Could you please bump Simplecov's version so this feature's available through the default Rubygems install?

eric-hu commented Sep 19, 2012

@colszowka Could you please bump Simplecov's version so this feature's available through the default Rubygems install?

jperkin pushed a commit to joyent/pkgsrc-legacy that referenced this pull request Dec 9, 2013

taca
Update ruby-simplecov.
Make this package to Ruby 1.9.3 only.

v0.7.1, 2012-10-12 ([changes](colszowka/simplecov@v0.7.0...v0.7.1))
-------------------

  * [BUGFIX] The gem packages of 0.7.0 (both simplecov and simplecov-html) pushed to Rubygems had some file
    permission issues, leading to problems when installing SimpleCov in a root/system Rubygems install and then
    trying to use it as a normal user (see colszowka/simplecov#171, thanks @envygeeks
    for bringing it up). The gem build process has been changed to always enforce proper permissions before packaging
    to avoid this issue in the future.


v0.7.0, 2012-10-10 ([changes](colszowka/simplecov@v0.6.4...v0.7.0))
-------------------

  * [FEATURE] The new `maximum_coverage_drop` and `minimum_coverage` now allow you to fail your build when the
    coverage dropped by more than what you allowed or is below a minimum value required. Also, `refuse_coverage_drop` disallows
    any coverage drops between test runs.
    See colszowka/simplecov#151, colszowka/simplecov#11,
    colszowka/simplecov#90, and colszowka/simplecov#96 (thanks to @infertux)
  * [FEATURE] SimpleCov now ships with a built-in MultiFormatter which allows the easy usage of multiple result formatters at
    the same time without the need to write custom wrapper code.
    See colszowka/simplecov#158 (thanks to @nikitug)
  * [BUGFIX] The usage of digits, hyphens and underscores in group names could lead to broken tab navigation
    in the default simplecov-html reports. See colszowka/simplecov-html#14 (thanks to @ebelgarts)
  * [REFACTORING] A few more ruby warnings removed. See colszowka/simplecov#106 and
    colszowka/simplecov#139. (thanks to @lukejahnke)
  * A [Pledgie button](colszowka/simplecov@63cfa99) for those that
    feel generous :)
  * The usual bunch of README fixes and documentation tweaks. Thanks to everyone who contributed those!

jsonn pushed a commit to jsonn/pkgsrc that referenced this pull request Mar 12, 2014

taca
Update ruby-simplecov.
Make this package to Ruby 1.9.3 only.

v0.7.1, 2012-10-12 ([changes](colszowka/simplecov@v0.7.0...v0.7.1))
-------------------

  * [BUGFIX] The gem packages of 0.7.0 (both simplecov and simplecov-html) pushed to Rubygems had some file
    permission issues, leading to problems when installing SimpleCov in a root/system Rubygems install and then
    trying to use it as a normal user (see colszowka/simplecov#171, thanks @envygeeks
    for bringing it up). The gem build process has been changed to always enforce proper permissions before packaging
    to avoid this issue in the future.


v0.7.0, 2012-10-10 ([changes](colszowka/simplecov@v0.6.4...v0.7.0))
-------------------

  * [FEATURE] The new `maximum_coverage_drop` and `minimum_coverage` now allow you to fail your build when the
    coverage dropped by more than what you allowed or is below a minimum value required. Also, `refuse_coverage_drop` disallows
    any coverage drops between test runs.
    See colszowka/simplecov#151, colszowka/simplecov#11,
    colszowka/simplecov#90, and colszowka/simplecov#96 (thanks to @infertux)
  * [FEATURE] SimpleCov now ships with a built-in MultiFormatter which allows the easy usage of multiple result formatters at
    the same time without the need to write custom wrapper code.
    See colszowka/simplecov#158 (thanks to @nikitug)
  * [BUGFIX] The usage of digits, hyphens and underscores in group names could lead to broken tab navigation
    in the default simplecov-html reports. See colszowka/simplecov-html#14 (thanks to @ebelgarts)
  * [REFACTORING] A few more ruby warnings removed. See colszowka/simplecov#106 and
    colszowka/simplecov#139. (thanks to @lukejahnke)
  * A [Pledgie button](colszowka/simplecov@63cfa99) for those that
    feel generous :)
  * The usual bunch of README fixes and documentation tweaks. Thanks to everyone who contributed those!
@sferik

This comment has been minimized.

Show comment Hide comment
@sferik

sferik Apr 3, 2014

Collaborator

I know this issue is ancient history but this seems like a strange interface to set multiple formatters. Conventionally, the [] method is used to fetch a value (as in an Array or a Hash). Why can’t SimpleCov.formatter just take an Array?

SimpleCov.formatters = [
  SimpleCov::Formatter::HTMLFormatter,
  SimpleCov::Formatter::CSVFormatter,
]
Collaborator

sferik commented Apr 3, 2014

I know this issue is ancient history but this seems like a strange interface to set multiple formatters. Conventionally, the [] method is used to fetch a value (as in an Array or a Hash). Why can’t SimpleCov.formatter just take an Array?

SimpleCov.formatters = [
  SimpleCov::Formatter::HTMLFormatter,
  SimpleCov::Formatter::CSVFormatter,
]

jsonn pushed a commit to jsonn/pkgsrc that referenced this pull request Oct 11, 2014

taca
Update ruby-simplecov.
Make this package to Ruby 1.9.3 only.

v0.7.1, 2012-10-12 ([changes](colszowka/simplecov@v0.7.0...v0.7.1))
-------------------

  * [BUGFIX] The gem packages of 0.7.0 (both simplecov and simplecov-html) pushed to Rubygems had some file
    permission issues, leading to problems when installing SimpleCov in a root/system Rubygems install and then
    trying to use it as a normal user (see colszowka/simplecov#171, thanks @envygeeks
    for bringing it up). The gem build process has been changed to always enforce proper permissions before packaging
    to avoid this issue in the future.


v0.7.0, 2012-10-10 ([changes](colszowka/simplecov@v0.6.4...v0.7.0))
-------------------

  * [FEATURE] The new `maximum_coverage_drop` and `minimum_coverage` now allow you to fail your build when the
    coverage dropped by more than what you allowed or is below a minimum value required. Also, `refuse_coverage_drop` disallows
    any coverage drops between test runs.
    See colszowka/simplecov#151, colszowka/simplecov#11,
    colszowka/simplecov#90, and colszowka/simplecov#96 (thanks to @infertux)
  * [FEATURE] SimpleCov now ships with a built-in MultiFormatter which allows the easy usage of multiple result formatters at
    the same time without the need to write custom wrapper code.
    See colszowka/simplecov#158 (thanks to @nikitug)
  * [BUGFIX] The usage of digits, hyphens and underscores in group names could lead to broken tab navigation
    in the default simplecov-html reports. See colszowka/simplecov-html#14 (thanks to @ebelgarts)
  * [REFACTORING] A few more ruby warnings removed. See colszowka/simplecov#106 and
    colszowka/simplecov#139. (thanks to @lukejahnke)
  * A [Pledgie button](colszowka/simplecov@63cfa99) for those that
    feel generous :)
  * The usual bunch of README fixes and documentation tweaks. Thanks to everyone who contributed those!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment