coverband 5.2.6.rc.2 → 5.2.6.rc.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4a0693cadfb1b345691f9994b565b05f06ebb1fb808bde8327cea50c192aee3f
4
- data.tar.gz: 1bcdb4b2bc3a346bfd5b74b2be5638cc286a88247c6ea1e2908ed4ef74e6e5d0
3
+ metadata.gz: '039bd98899c0794752cb3244029b3bce0d9d6ebda8ddf449423e94e44741acb5'
4
+ data.tar.gz: 5b19acc65170a2f2c6d66a750a7e958759e90caca808943426481828c26dedfa
5
5
  SHA512:
6
- metadata.gz: 11392bc75a3b44770d2a33cdf1bcdff9ad0127ea715be57c5d2b7b2f5f4e4d50bda5caa394015239eaf03f9aab62dcdba647692cbf479ace08a9ec9ff0d06ead
7
- data.tar.gz: 652ad15638ed7da3d7a509c40eefe0f855e71e24843b98dc896213a3c7ba52ff88bcafba47fccff754e6dff25f76b145ce7bb8117f1f55afc8104e9de2233500
6
+ metadata.gz: 51e2ef52b7bd14f677845d6d565872ab9a607990ff28e89ba020f5fe8f8a65d728400f241ea2d70647580f2387e2115f9d033e450704d821d9a1664be5457f76
7
+ data.tar.gz: 62dc029eb498529c31e81a297db3afb5a1d95a716d0802ed0b99128b8405f937b6d90c61eb3d0dc49df4f2faf9b9c2545ae5f54dbda9db2d04e3b6465001a75d
@@ -13,4 +13,5 @@ jobs:
13
13
  - name: Update diagram
14
14
  uses: githubocto/repo-visualizer@main
15
15
  with:
16
- excluded_paths: "ignore,.github"
16
+ excluded_paths: "ignore,.github"
17
+ branch: diagram
@@ -21,11 +21,11 @@ jobs:
21
21
  # removing jruby again to flaky
22
22
  # ruby: [2.3, 2.4, 2.5, 2.6, 2.7, "3.0", "3.1", jruby]
23
23
  # need to add support for multiple gemfiles
24
- ruby: ["2.7", "3.0", "3.1"]
24
+ ruby: ["2.7", "3.0", "3.1", "3.2"]
25
25
  redis-version: [4, 5, 6]
26
26
  runs-on: ${{ matrix.os }}-latest
27
27
  steps:
28
- - uses: actions/checkout@v2
28
+ - uses: actions/checkout@v3
29
29
  - uses: supercharge/redis-github-action@1.2.0
30
30
  - uses: ruby/setup-ruby@v1
31
31
  with:
data/README.md CHANGED
@@ -207,9 +207,9 @@ config.ignore += ['config/application.rb',
207
207
  'config/boot.rb',
208
208
  'config/puma.rb',
209
209
  'config/schedule.rb',
210
- 'bin/*',
211
- 'config/environments/*',
212
- 'lib/tasks/*']
210
+ 'bin/.*',
211
+ 'config/environments/.*',
212
+ 'lib/tasks/.*']
213
213
  ```
214
214
 
215
215
  **Ignoring Custom Gem Locations:** Note, if you have your gems in a custom location under your app folder you likely want to add them to `config.ignore`. For example, if you have your gems not in a default ignored location of `app/vendor` but have them in `app/gems` you would need to add `gems/*` to your ignore list.
@@ -437,7 +437,7 @@ What is the coverage data in Redis?
437
437
 
438
438
  A diagram of the code.
439
439
 
440
- ![Visualization of this repo](./diagram.svg)
440
+ ![Visualization of this repo](https://raw.githubusercontent.com/danmayer/coverband/diagram/diagram.svg)
441
441
 
442
442
  ## Logo
443
443
 
data/changes.md CHANGED
@@ -1,6 +1,10 @@
1
1
  ### Coverband 5.2.6
2
2
 
3
+ __NOTE: the current RCs include below, but this might turn into coverband 6.0__
4
+
3
5
  - add support for translation keys
6
+ - refactor non Coverage.so based trackers
7
+ - adds CSP report support (thanks @jwg2s)
4
8
 
5
9
  ### Coverband 5.2.5
6
10
 
@@ -11,7 +11,8 @@ module Coverband
11
11
  :view_tracker, :defer_eager_loading_data,
12
12
  :track_routes, :route_tracker,
13
13
  :track_translations, :translations_tracker,
14
- :trackers
14
+ :trackers, :csp_policy
15
+
15
16
  attr_writer :logger, :s3_region, :s3_bucket, :s3_access_key_id,
16
17
  :s3_secret_access_key, :password, :api_key, :service_url, :coverband_timeout, :service_dev_mode,
17
18
  :service_test_mode, :process_type, :track_views, :redis_url,
@@ -82,6 +83,7 @@ module Coverband
82
83
  @all_root_paths = nil
83
84
  @all_root_patterns = nil
84
85
  @password = nil
86
+ @csp_policy = false
85
87
 
86
88
  # coverband service settings
87
89
  @api_key = nil
@@ -205,7 +207,10 @@ module Coverband
205
207
  # Don't allow the ignore to override things like gem tracking
206
208
  ###
207
209
  def ignore=(ignored_array)
210
+ ignored_array.map { |ignore_str| Regexp.new(ignore_str) }
208
211
  @ignore = (@ignore + ignored_array).uniq
212
+ rescue RegexpError
213
+ logger.error "an invalid regular expression was passed in, ensure string are valid regex patterns #{ignored_array.join(",")}"
209
214
  end
210
215
 
211
216
  def current_root
@@ -13,6 +13,22 @@ module Coverband
13
13
  class Web
14
14
  attr_reader :request
15
15
 
16
+ CSP_HEADER = [
17
+ "default-src 'self' https: http:",
18
+ "child-src 'self'",
19
+ "connect-src 'self' https: http: wss: ws:",
20
+ "font-src 'self' https: http:",
21
+ "frame-src 'self'",
22
+ "img-src 'self' https: http: data:",
23
+ "manifest-src 'self'",
24
+ "media-src 'self'",
25
+ "object-src 'none'",
26
+ "script-src 'self' https: http: 'unsafe-inline'",
27
+ "style-src 'self' https: http: 'unsafe-inline'",
28
+ "worker-src 'self'",
29
+ "base-uri 'self'"
30
+ ].join("; ").freeze
31
+
16
32
  def init_web
17
33
  full_path = Gem::Specification.find_by_name("coverband").full_gem_path
18
34
  @static = Rack::Static.new(self,
@@ -58,26 +74,26 @@ module Coverband
58
74
  when %r{\/clear}
59
75
  clear
60
76
  else
61
- [404, {"Content-Type" => "text/html"}, ["404 error!"]]
77
+ [404, coverband_headers, ["404 error!"]]
62
78
  end
63
79
  else
64
80
  case request_path_info
65
81
  when /.*\.(css|js|gif|png)/
66
82
  @static.call(env)
67
83
  when %r{\/settings}
68
- [200, {"Content-Type" => "text/html"}, [settings]]
84
+ [200, coverband_headers, [settings]]
69
85
  when %r{\/view_tracker_data}
70
- [200, {"Content-Type" => "text/json"}, [view_tracker_data]]
86
+ [200, coverband_headers(content_type: "text/json"), [view_tracker_data]]
71
87
  when %r{\/enriched_debug_data}
72
- [200, {"Content-Type" => "text/json"}, [enriched_debug_data]]
88
+ [200, coverband_headers(content_type: "text/json"), [enriched_debug_data]]
73
89
  when %r{\/debug_data}
74
- [200, {"Content-Type" => "text/json"}, [debug_data]]
90
+ [200, coverband_headers(content_type: "text/json"), [debug_data]]
75
91
  when %r{\/load_file_details}
76
- [200, {"Content-Type" => "text/json"}, [load_file_details]]
92
+ [200, coverband_headers(content_type: "text/json"), [load_file_details]]
77
93
  when %r{\/$}
78
- [200, {"Content-Type" => "text/html"}, [index]]
94
+ [200, coverband_headers, [index]]
79
95
  else
80
- [404, {"Content-Type" => "text/html"}, ["404 error!"]]
96
+ [404, coverband_headers, ["404 error!"]]
81
97
  end
82
98
  end
83
99
  end
@@ -174,6 +190,14 @@ module Coverband
174
190
 
175
191
  private
176
192
 
193
+ def coverband_headers(content_type: "text/html")
194
+ web_headers = {
195
+ "Content-Type" => content_type
196
+ }
197
+ web_headers["Content-Security-Policy-Report-Only"] = CSP_HEADER if Coverband.configuration.csp_policy
198
+ web_headers
199
+ end
200
+
177
201
  # This method should get the root mounted endpoint
178
202
  # for example if the app is mounted like so:
179
203
  # mount Coverband::Web, at: '/coverage'
@@ -5,5 +5,5 @@
5
5
  # use format "4.2.1.rc.1" ~> 4.2.1.rc to prerelease versions like v4.2.1.rc.2 and v4.2.1.rc.3
6
6
  ###
7
7
  module Coverband
8
- VERSION = "5.2.6.rc.2"
8
+ VERSION = "5.2.6.rc.3"
9
9
  end
data/roadmap.md CHANGED
@@ -6,51 +6,51 @@
6
6
  - [redis bitmaps](http://blog.getspool.com/2011/11/29/fast-easy-realtime-metrics-using-redis-bitmaps/)
7
7
  - [redis bitfield](https://stackoverflow.com/questions/47100606/optimal-way-to-store-array-of-integers-in-redis-database)
8
8
  - Add support for [zadd](http://redis.io/topics/data-types-intro) so one could determine single call versus multiple calls on a line, letting us determine the most executed code in production.
9
+ - Changes and updates to Ruby Coverage Library that helps support templates
10
+ - https://github.com/ioquatix/covered
11
+ - https://github.com/simplecov-ruby/simplecov/pull/1037
12
+ - Consider A Coverband Pro / Option to run coverband service locally
13
+ - review how humperdink / e70 track translations, particularly how humperdink uses dirty sets with redis, for perf improvements for trackers
14
+ - https://github.com/livingsocial/humperdink
15
+ - https://github.com/sergioisidoro/e7o/blob/master/lib/e7o.rb
16
+ - Possible Cross Application Support to track library usage?
17
+ - Reducing differences between coverband local and coverband service
9
18
 
10
- ### Coverband Future...
19
+ ### Coverband Next...
11
20
 
12
21
  Will be the fully modern release that drops maintenance legacy support in favor of increased performance, ease of use, and maintainability.
13
22
 
14
- - Release will be aimed as significantly simplifying ease of use
15
- - near zero config setup for Rails apps
16
- - add built-in support for easy loading via Railties
17
- - built in support for activejob, sidekiq, and other common frameworks
18
- - reduced configuration options
19
- - support oneshot
20
- - drop middleware figure out a way to kick off background without middelware
23
+ - look at adding a DB tracker
24
+ - defaults to oneshot for coverage
25
+ - possibly splits coverage and all other covered modules
26
+ - drop middleware figure out a way to kick off background without middelware, possibly use similar process forking detection to humperdink
27
+ - https://github.com/livingsocial/humperdink/blob/master/lib/humperdink/fork_savvy_redis.rb
21
28
  - options on reporting
22
29
  - background reporting
23
30
  - or middleware reporting
24
31
  - Support for file versions
25
32
  - md5 or release tags
26
33
  - add coverage timerange support
27
- - Drop Simplecov dependency
28
34
  - improved web reporting
29
35
  - lists current config options
30
36
  - eventually allow updating remote config
31
37
  - full theming
32
- - list redis data dump for debugging
38
+ - list redis data dump for debugging (refactor built in debug support)
33
39
  - additional adapters: Memcache, S3, and ActiveRecord
34
40
  - add articles / podcasts like prontos readme https://github.com/prontolabs/pronto
35
- - Add detailed Gem usage report, if we collect and send gem usage we can give percentage of gem code used, which should help application developers know when to remove gem dependencies (0%) or perhaps inline single methods for little usage (using <= 5%) for example.
36
- - add meta data information first seen last recorded to the coverage report views (probably need to drop simplecov for that).
41
+ - add meta data information first seen last recorded to the coverage report views (per file / per method?).
37
42
  - more details in this issue: https://github.com/danmayer/coverband/issues/118
38
- - Make good video on setup, install, usage
39
43
  - See if we can add support for views / templates
40
44
  - using this technique https://github.com/ioquatix/covered
41
45
  - Better default grouping (could use groups features for gems for rails controllers, models, lib, etc)
42
46
  - Improved logging for easier debugging and development
43
47
  - drop the verbose mode and better support standard logger levels
44
- - Possibly setup a build assets system
45
- - my JS rules expanded the compressed JS at the top of application.js, basically we want to stitch together JS
46
- - I guess we could also load multiple JS files as most of the JS is just default compressed JS and a tiny amount of actual app JS.
47
- - lazy load for Coverband results
48
- - view layer file coverage
48
+ - redo the logger entirely
49
+ - redo config system and allow live config updates via webui
49
50
  - move all code to work with relative paths leaving only stdlib Coverage working on full paths
50
- - add gem_safe_lists to track only some gems
51
- - add gem_details_safe list to report on details on some gems
52
- - - display gems that are in loaded with 0 coverage, thanks @kbaum
53
51
 
54
- # Alpha / Beta / Release Candidates
52
+ # Out of Scope
55
53
 
56
- ### Coverband 5.?.?
54
+ It is important for a project to not only know what problems it is trying to solve, but what things are out of scope. We will start to try to document that here:
55
+
56
+ * We have in the past tried to add coverage tracking for all gems, this added a lot of complexity and compuation overhead and slowed things down to much. It also was of less value than we had hoped. There are alterntative ways to instrument a shared library to track across multiple applications, and single application gem utilization is easier to handle in a one of basis. It is unlikely we will support that again.
@@ -38,6 +38,16 @@ class BaseTest < Minitest::Test
38
38
  assert_equal expected, Coverband.configuration.ignore
39
39
  end
40
40
 
41
+ test "ignore catches regex errors" do
42
+ Coverband.configuration.logger.expects(:error).with("an invalid regular expression was passed in, ensure string are valid regex patterns *invalidRegex*")
43
+ Coverband.configure do |config|
44
+ config.ignore = ["*invalidRegex*"]
45
+ end
46
+ Coverband::Collectors::Coverage.instance.reset_instance
47
+ expected = Coverband::Configuration::IGNORE_DEFAULTS << "config/environments"
48
+ assert_equal expected, Coverband.configuration.ignore
49
+ end
50
+
41
51
  test "ignore" do
42
52
  Coverband::Collectors::Coverage.instance.reset_instance
43
53
  assert !Coverband.configuration.ignore.first.nil?
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coverband
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.2.6.rc.2
4
+ version: 5.2.6.rc.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan Mayer
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2023-01-05 00:00:00.000000000 Z
12
+ date: 2023-02-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: benchmark-ips