high_water_mark 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +7 -0
  2. data/.circleci/config.yml +17 -0
  3. data/.gitignore +15 -0
  4. data/.pronto.yml +5 -0
  5. data/.rspec +3 -0
  6. data/.rubocop.yml +77 -0
  7. data/.ruby-version +1 -0
  8. data/.travis.yml +17 -0
  9. data/CODE_OF_CONDUCT.md +75 -0
  10. data/Gemfile +9 -0
  11. data/Gemfile.lock +240 -0
  12. data/LICENSE.txt +21 -0
  13. data/Makefile +21 -0
  14. data/README.md +58 -0
  15. data/Rakefile +0 -0
  16. data/bin/console +15 -0
  17. data/bin/setup +8 -0
  18. data/coverage/.last_run.json +5 -0
  19. data/exe/high_water_mark +4 -0
  20. data/feature/spec_helper.rb +38 -0
  21. data/high_water_mark.gemspec +44 -0
  22. data/lib/high_water_mark.rb +8 -0
  23. data/lib/high_water_mark/threshold.rb +28 -0
  24. data/lib/high_water_mark/version.rb +5 -0
  25. data/metrics/bigfiles_high_water_mark +1 -0
  26. data/metrics/brakeman_high_water_mark +1 -0
  27. data/metrics/bundle-audit_high_water_mark +1 -0
  28. data/metrics/eslint_high_water_mark +1 -0
  29. data/metrics/flake8_high_water_mark +1 -0
  30. data/metrics/flay_high_water_mark +1 -0
  31. data/metrics/flog_high_water_mark +1 -0
  32. data/metrics/jscs_high_water_mark +1 -0
  33. data/metrics/mdl_high_water_mark +1 -0
  34. data/metrics/punchlist_high_water_mark +1 -0
  35. data/metrics/pycodestyle_high_water_mark +1 -0
  36. data/metrics/rails_best_practices_high_water_mark +1 -0
  37. data/metrics/rubocop_high_water_mark +1 -0
  38. data/metrics/scalastyle_high_water_mark +1 -0
  39. data/metrics/shellcheck_high_water_mark +1 -0
  40. data/rakelib/ci.rake +4 -0
  41. data/rakelib/clear_metrics.rake +8 -0
  42. data/rakelib/default.rake +4 -0
  43. data/rakelib/feature.rake +10 -0
  44. data/rakelib/gem_tasks.rake +3 -0
  45. data/rakelib/localtest.rake +4 -0
  46. data/rakelib/pronto.rake +15 -0
  47. data/rakelib/quality.rake +32 -0
  48. data/rakelib/spec.rake +9 -0
  49. data/rakelib/update_bundle_audit.rake +6 -0
  50. metadata +222 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e5eefc07e792b1fdf097e778c900b9879042f4cd
4
+ data.tar.gz: c57db50b2a68e1872a9c0ea1b95b23e6347619ec
5
+ SHA512:
6
+ metadata.gz: ca15ce4648cfdcfcac089163219b801f2f73ac0eee7d5af63fca2d0418b3cb799cc05836137b403398057b6dae82038cd2d579880b8ae8c52b38e81d386fcace
7
+ data.tar.gz: 60e3d7b1088116155f8e485a40a2a745b002a54a90471b17344fe9975b1227dc9c43e288a834171fa0c00329e2f9beecf9e53486303839247425c099f85600ff
@@ -0,0 +1,17 @@
1
+ version: 2
2
+ jobs:
3
+ build:
4
+ working_directory: ~/high_water_mark
5
+ docker:
6
+ - image: apiology/circleci-ruby:latest
7
+ steps:
8
+ - checkout
9
+ - type: cache-restore
10
+ key: high_water_mark-{{ checksum "high_water_mark.gemspec" }}-{{ checksum "Gemfile" }}
11
+ - run: gem install bundler
12
+ - run: bundle install --path vendor/bundle --jobs=4
13
+ - type: cache-save
14
+ key: high_water_mark-{{ checksum "high_water_mark.gemspec" }}-{{ checksum "Gemfile" }}
15
+ paths:
16
+ - "vendor/bundle"
17
+ - run: bundle exec rake --jobs=4 ci
@@ -0,0 +1,15 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /doc/
5
+ /pkg/
6
+ /spec/reports/
7
+ /tmp/
8
+
9
+ # rspec failure tracking
10
+ .rspec_status
11
+ /coverage/.resultset.json
12
+ /coverage/.resultset.json.lock
13
+ /coverage/assets/
14
+ /coverage/index.html
15
+ /pkg
@@ -0,0 +1,5 @@
1
+ text:
2
+ format: "%{color_location}: [%{runner}] %{msg}"
3
+
4
+ github_pr:
5
+ format: "[%{runner}] %{msg}"
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
@@ -0,0 +1,77 @@
1
+ # I like trailing commas in hashes. They let me insert new elements and
2
+ # see them as one line in a diff, not two.
3
+ Style/TrailingCommaInHashLiteral:
4
+ EnforcedStyleForMultiline: comma
5
+
6
+ Style/TrailingCommaInArrayLiteral:
7
+ EnforcedStyleForMultiline: comma
8
+
9
+ # I use keyword arguments for a poor man's dependency injection to cut
10
+ # down on the magic in my tests.
11
+ Metrics/ParameterLists:
12
+ CountKeywordArgs: false
13
+
14
+ # If I'm using one function name and returning the contents of an
15
+ # attribute, that's OK. The alternative would be this, which I find
16
+ # confusing and often not really what I mean:
17
+ #
18
+ # attr_reader :something_else
19
+ # alias_method :something, :something_else
20
+ Style/TrivialAccessors:
21
+ ExactNameMatch: true
22
+
23
+ #
24
+ # Add 'XX X' to the standard list
25
+ #
26
+ Style/CommentAnnotation:
27
+ Keywords:
28
+ - "TOD\
29
+ O"
30
+ - "FIXM\
31
+ E"
32
+ - "OPTIMIZ\
33
+ E"
34
+ - "HAC\
35
+ K"
36
+ - "REVIE\
37
+ W"
38
+ - "XX\
39
+ X"
40
+
41
+ # https://stackoverflow.com/questions/40934345/rubocop-25-line-block-size-and-rspec-tests
42
+ Metrics/BlockLength:
43
+ # Exclude DSLs
44
+ Exclude:
45
+ - 'Rakefile'
46
+ - '*.gemspec'
47
+ - '**/*.rake'
48
+ - 'spec/**/*.rb'
49
+ - 'feature/**/*.rb'
50
+
51
+ # http://www.betterspecs.org/#single
52
+ #
53
+ # > in tests that are not isolated (e.g. ones that integrate with a
54
+ # > DB, an external webservice, or end-to-end-tests), you take a
55
+ # > massive performance hit to do the same setup over and over again,
56
+ # > just to set a different expectation in each test. In these sorts
57
+ # > of slower tests, I think it's fine to specify more than one
58
+ # > isolated behavior.
59
+ RSpec/MultipleExpectations:
60
+ Exclude:
61
+ - 'feature/**/*.rb'
62
+
63
+ Style/StringLiterals:
64
+ EnforcedStyle: single_quotes
65
+ SupportedStyles:
66
+ - single_quotes
67
+ - double_quotes
68
+ ConsistentQuotesInMultiline: true
69
+
70
+ AllCops:
71
+ TargetRubyVersion: 2.4
72
+
73
+
74
+ require:
75
+ - rubocop-rspec
76
+ - rubocop-minitest
77
+ - rubocop-rake
@@ -0,0 +1 @@
1
+ ruby-2.4.9
@@ -0,0 +1,17 @@
1
+ language: ruby
2
+ cache: bundler
3
+ before_install:
4
+ # https://bundler.io/blog/2019/05/14/
5
+ # solutions-for-cant-find-gem-bundler-with-executable-bundle.html
6
+ - gem update --system
7
+ - gem install bundler
8
+ rvm:
9
+ # JRuby error with native code build - possibly can be overcome?
10
+ # checking for main() in -lstdc++... RuntimeError: The compiler failed to generate
11
+ # https://travis-ci.com/apiology/pronto-punchlist/jobs/264907931
12
+ # - jruby-head
13
+ - ruby-head
14
+ - ruby-2.7
15
+ - ruby-2.6
16
+ - ruby-2.5
17
+ - ruby-2.4
@@ -0,0 +1,75 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual
26
+ attention or advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at vince@broz.cc. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the
71
+ [Contributor Covenant][homepage], version 1.4, available at
72
+ [https://contributor-covenant.org/version/1/4][version]
73
+
74
+ [homepage]: https://contributor-covenant.org
75
+ [version]: https://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ # Specify your gem's dependencies in high_water_mark.gemspec
6
+ gemspec
7
+
8
+ gem 'rake', '~> 12.0'
9
+ gem 'rspec', '~> 3.0'
@@ -0,0 +1,240 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ high_water_mark (0.1.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ activesupport (5.2.4.1)
10
+ concurrent-ruby (~> 1.0, >= 1.0.2)
11
+ i18n (>= 0.7, < 2)
12
+ minitest (~> 5.1)
13
+ tzinfo (~> 1.1)
14
+ addressable (2.7.0)
15
+ public_suffix (>= 2.0.2, < 5.0)
16
+ ast (2.4.0)
17
+ axiom-types (0.1.1)
18
+ descendants_tracker (~> 0.0.4)
19
+ ice_nine (~> 0.11.0)
20
+ thread_safe (~> 0.3, >= 0.3.1)
21
+ bigfiles (0.2.0)
22
+ source_finder (>= 2)
23
+ brakeman (4.7.2)
24
+ bundler-audit (0.6.1)
25
+ bundler (>= 1.2.0, < 3)
26
+ thor (~> 0.18)
27
+ cane (3.0.0)
28
+ parallel
29
+ charlock_holmes (0.7.7)
30
+ code_analyzer (0.5.1)
31
+ sexp_processor
32
+ codeclimate-engine-rb (0.4.1)
33
+ virtus (~> 1.0)
34
+ coercible (1.0.0)
35
+ descendants_tracker (~> 0.0.1)
36
+ concurrent-ruby (1.1.5)
37
+ descendants_tracker (0.0.4)
38
+ thread_safe (~> 0.3, >= 0.3.1)
39
+ diff-lcs (1.3)
40
+ docile (1.3.2)
41
+ domain_name (0.5.20190701)
42
+ unf (>= 0.0.5, < 1.0.0)
43
+ equalizer (0.0.11)
44
+ erubis (2.7.0)
45
+ escape_utils (1.2.1)
46
+ faraday (0.17.3)
47
+ multipart-post (>= 1.2, < 3)
48
+ flay (2.12.1)
49
+ erubis (~> 2.7.0)
50
+ path_expander (~> 1.0)
51
+ ruby_parser (~> 3.0)
52
+ sexp_processor (~> 4.0)
53
+ flog (4.6.4)
54
+ path_expander (~> 1.0)
55
+ ruby_parser (~> 3.1, > 3.1.0)
56
+ sexp_processor (~> 4.8)
57
+ github-linguist (7.7.0)
58
+ charlock_holmes (~> 0.7.6)
59
+ escape_utils (~> 1.2.0)
60
+ mini_mime (~> 1.0)
61
+ rugged (>= 0.25.1)
62
+ gitlab (4.13.1)
63
+ httparty (~> 0.14, >= 0.14.0)
64
+ terminal-table (~> 1.5, >= 1.5.1)
65
+ http-accept (1.7.0)
66
+ http-cookie (1.0.3)
67
+ domain_name (~> 0.5)
68
+ httparty (0.17.3)
69
+ mime-types (~> 3.0)
70
+ multi_xml (>= 0.5.2)
71
+ i18n (1.7.0)
72
+ concurrent-ruby (~> 1.0)
73
+ ice_nine (0.11.2)
74
+ jaro_winkler (1.5.4)
75
+ json (2.3.0)
76
+ kramdown (2.1.0)
77
+ kramdown-parser-gfm (1.1.0)
78
+ kramdown (~> 2.0)
79
+ kwalify (0.7.2)
80
+ mdl (0.8.0)
81
+ kramdown (~> 2.0)
82
+ kramdown-parser-gfm (~> 1.0)
83
+ mixlib-cli (~> 2.1, >= 2.1.1)
84
+ mixlib-config (>= 2.2.1, < 4)
85
+ mime-types (3.3.1)
86
+ mime-types-data (~> 3.2015)
87
+ mime-types-data (3.2019.1009)
88
+ mini_mime (1.0.2)
89
+ minitest (5.13.0)
90
+ mixlib-cli (2.1.5)
91
+ mixlib-config (3.0.6)
92
+ tomlrb
93
+ multi_xml (0.6.0)
94
+ multipart-post (2.1.1)
95
+ netrc (0.11.0)
96
+ octokit (4.15.0)
97
+ faraday (>= 0.9)
98
+ sawyer (~> 0.8.0, >= 0.5.3)
99
+ parallel (1.19.1)
100
+ parser (2.6.5.0)
101
+ ast (~> 2.4.0)
102
+ path_expander (1.1.0)
103
+ pronto (0.10.0)
104
+ gitlab (~> 4.0, >= 4.0.0)
105
+ httparty (>= 0.13.7)
106
+ octokit (~> 4.7, >= 4.7.0)
107
+ rainbow (>= 2.2, < 4.0)
108
+ rugged (~> 0.24, >= 0.23.0)
109
+ thor (~> 0.20.0)
110
+ pronto-bigfiles (0.1.0)
111
+ bigfiles (>= 0.2.0)
112
+ pronto
113
+ quality (>= 37)
114
+ pronto-punchlist (0.1.1)
115
+ pronto
116
+ punchlist (>= 1.3.0)
117
+ pronto-rubocop (0.10.0)
118
+ pronto (~> 0.10.0)
119
+ rubocop (~> 0.50, >= 0.49.1)
120
+ psych (3.1.0)
121
+ public_suffix (4.0.2)
122
+ punchlist (1.3.0)
123
+ source_finder (>= 2)
124
+ quality (37.0.0)
125
+ activesupport
126
+ bigfiles (>= 0.1)
127
+ brakeman
128
+ bundler-audit
129
+ cane (>= 2.6)
130
+ faraday (< 1)
131
+ flay (>= 2.4, != 2.6.0)
132
+ flog (>= 4.1.1)
133
+ github-linguist
134
+ json
135
+ mdl
136
+ punchlist (>= 1.1)
137
+ rails_best_practices
138
+ reek (>= 1.3.4)
139
+ rest-client (>= 1.8.0)
140
+ rubocop (~> 0.78.0)
141
+ rubocop-minitest
142
+ rubocop-rake
143
+ rubocop-rspec (>= 1.19.0)
144
+ ruby_parser (>= 3.2.2, != 3.6.6)
145
+ rails_best_practices (1.19.5)
146
+ activesupport
147
+ code_analyzer (>= 0.5.1)
148
+ erubis
149
+ i18n
150
+ json
151
+ require_all (~> 3.0)
152
+ ruby-progressbar
153
+ rainbow (3.0.0)
154
+ rake (12.3.2)
155
+ reek (5.5.0)
156
+ codeclimate-engine-rb (~> 0.4.0)
157
+ kwalify (~> 0.7.0)
158
+ parser (>= 2.5.0.0, < 2.7, != 2.5.1.1)
159
+ psych (~> 3.1.0)
160
+ rainbow (>= 2.0, < 4.0)
161
+ require_all (3.0.0)
162
+ rest-client (2.1.0)
163
+ http-accept (>= 1.7.0, < 2.0)
164
+ http-cookie (>= 1.0.2, < 2.0)
165
+ mime-types (>= 1.16, < 4.0)
166
+ netrc (~> 0.8)
167
+ rspec (3.9.0)
168
+ rspec-core (~> 3.9.0)
169
+ rspec-expectations (~> 3.9.0)
170
+ rspec-mocks (~> 3.9.0)
171
+ rspec-core (3.9.1)
172
+ rspec-support (~> 3.9.1)
173
+ rspec-expectations (3.9.0)
174
+ diff-lcs (>= 1.2.0, < 2.0)
175
+ rspec-support (~> 3.9.0)
176
+ rspec-mocks (3.9.1)
177
+ diff-lcs (>= 1.2.0, < 2.0)
178
+ rspec-support (~> 3.9.0)
179
+ rspec-support (3.9.2)
180
+ rubocop (0.78.0)
181
+ jaro_winkler (~> 1.5.1)
182
+ parallel (~> 1.10)
183
+ parser (>= 2.6)
184
+ rainbow (>= 2.2.2, < 4.0)
185
+ ruby-progressbar (~> 1.7)
186
+ unicode-display_width (>= 1.4.0, < 1.7)
187
+ rubocop-minitest (0.5.1)
188
+ rubocop (>= 0.74)
189
+ rubocop-rake (0.5.0)
190
+ rubocop
191
+ rubocop-rspec (1.37.1)
192
+ rubocop (>= 0.68.1)
193
+ ruby-progressbar (1.10.1)
194
+ ruby_parser (3.14.1)
195
+ sexp_processor (~> 4.9)
196
+ rugged (0.28.4.1)
197
+ sawyer (0.8.2)
198
+ addressable (>= 2.3.5)
199
+ faraday (> 0.8, < 2.0)
200
+ sexp_processor (4.13.0)
201
+ simplecov (0.17.1)
202
+ docile (~> 1.1)
203
+ json (>= 1.8, < 3)
204
+ simplecov-html (~> 0.10.0)
205
+ simplecov-html (0.10.2)
206
+ source_finder (3.2.1)
207
+ terminal-table (1.8.0)
208
+ unicode-display_width (~> 1.1, >= 1.1.1)
209
+ thor (0.20.3)
210
+ thread_safe (0.3.6)
211
+ tomlrb (1.2.9)
212
+ tzinfo (1.2.6)
213
+ thread_safe (~> 0.1)
214
+ unf (0.1.4)
215
+ unf_ext
216
+ unf_ext (0.0.7.6)
217
+ unicode-display_width (1.6.0)
218
+ virtus (1.0.5)
219
+ axiom-types (~> 0.1)
220
+ coercible (~> 1.0)
221
+ descendants_tracker (~> 0.0, >= 0.0.3)
222
+ equalizer (~> 0.0, >= 0.0.9)
223
+
224
+ PLATFORMS
225
+ ruby
226
+
227
+ DEPENDENCIES
228
+ bundler
229
+ high_water_mark!
230
+ pronto
231
+ pronto-bigfiles
232
+ pronto-punchlist
233
+ pronto-rubocop
234
+ quality (~> 37)
235
+ rake (~> 12.0)
236
+ rspec (~> 3.0)
237
+ simplecov
238
+
239
+ BUNDLED WITH
240
+ 2.1.2
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2020 Vince Broz
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,21 @@
1
+ .PHONY: spec feature
2
+
3
+ all: localtest
4
+
5
+ localtest:
6
+ @bundle exec rake localtest
7
+
8
+ feature:
9
+ @bundle exec rake feature
10
+
11
+ spec:
12
+ @bundle exec rake spec
13
+
14
+ rubocop:
15
+ @bundle exec rake rubocop
16
+
17
+ punchlist:
18
+ @bundle exec rake punchlist
19
+
20
+ quality:
21
+ @bundle exec rake quality
@@ -0,0 +1,58 @@
1
+ # high\_water\_mark
2
+
3
+ [![CircleCI](https://circleci.com/gh/apiology/high_water_mark.svg?style=svg)](https://circleci.com/gh/apiology/high_water_mark)
4
+ [![Build Status](https://travis-ci.com/apiology/high_water_mark.svg?branch=master)](https://travis-ci.com/apiology/high_water_mark)
5
+
6
+ Maintains a directory of high water mark metrics for the quality
7
+ tools - used by [quality gem](https://github.com/apiology/quality) and friends
8
+
9
+ ## Installation
10
+
11
+ Add this line to your application's Gemfile:
12
+
13
+ ```ruby
14
+ gem 'high_water_mark'
15
+ ```
16
+
17
+ And then execute:
18
+
19
+ ```sh
20
+ bundle install
21
+ ```
22
+
23
+ Or install it yourself as:
24
+
25
+ ```sh
26
+ gem install high_water_mark
27
+ ```
28
+
29
+ ## Development
30
+
31
+ After checking out the repo, run `bin/setup` to install
32
+ dependencies. Then, run `rake spec` to run the tests. You can also run
33
+ `bin/console` for an interactive prompt that will allow you to
34
+ experiment.
35
+
36
+ To install this gem onto your local machine, run `bundle exec rake
37
+ install`. To release a new version, update the version number in
38
+ `version.rb`, and then run `bundle exec rake release`, which will
39
+ create a git tag for the version, push git commits and tags, and push
40
+ the `.gem` file to [rubygems.org](https://rubygems.org).
41
+
42
+ ## Contributing
43
+
44
+ Bug reports and pull requests are welcome
45
+ [on GitHub](https://github.com/apiology/high_water_mark). This project is
46
+ intended to be a safe, welcoming space for collaboration, and
47
+ contributors are expected to adhere to the
48
+ [code of conduct](https://github.com/apiology/high_water_mark/blob/master/CODE_OF_CONDUCT.md).
49
+
50
+ ## License
51
+
52
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
53
+
54
+ ## Code of Conduct
55
+
56
+ Everyone interacting in the HighWaterMark project's codebases, issue
57
+ trackers, chat rooms and mailing lists is expected to follow the
58
+ [code of conduct](https://github.com/apiology/high_water_mark/blob/master/CODE_OF_CONDUCT.md).
File without changes
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'bundler/setup'
5
+ require 'high_water_mark'
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require 'irb'
15
+ IRB.start(__FILE__)
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,5 @@
1
+ {
2
+ "result": {
3
+ "covered_percent": 100.0
4
+ }
5
+ }
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'high_water_mark'
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'open3'
4
+
5
+ # Add the bin directory, to allow testing of gem executables as if the gem is
6
+ # already installed.
7
+ root_dir = RSpec::Core::RubyProject.root
8
+ exec_dir = File.join(File::SEPARATOR, root_dir, 'bin')
9
+ ENV['PATH'] = [exec_dir, ENV['PATH']].join(File::PATH_SEPARATOR)
10
+
11
+ # Courtesy of:
12
+ # https://raw.github.com/cupakromer/tao-of-tdd/master/adder/spec/support/
13
+ # capture_exec.rb
14
+ def exec_io(*cmd)
15
+ cmd = cmd.flatten
16
+ env = {
17
+ # Avoid spurious deprecation warnings in things which are out of
18
+ # our control
19
+ 'RUBYOPT' => '-W0',
20
+ }
21
+ all_out, _exit_code = Open3.capture2e(env, *cmd)
22
+
23
+ all_out
24
+ end
25
+
26
+ RSpec.configure do |config|
27
+ config.filter_run_excluding :wip
28
+ config.run_all_when_everything_filtered = true
29
+ config.order = 'random'
30
+ config.alias_it_should_behave_like_to :has_behavior
31
+ config.alias_it_should_behave_like_to :it_has_behavior, 'has behavior:'
32
+ end
33
+
34
+ def let_double(*doubles)
35
+ doubles.each do |double_sym|
36
+ let(double_sym) { double(double_sym.to_s) }
37
+ end
38
+ end
@@ -0,0 +1,44 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'lib/high_water_mark/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'high_water_mark'
7
+ spec.version = HighWaterMark::VERSION
8
+ spec.authors = ['Vince Broz']
9
+ spec.email = ['vince@broz.cc']
10
+
11
+ spec.summary = 'Maintains a directory of high water mark metrics ' \
12
+ 'for quality tools'
13
+ spec.description = 'Maintains a directory of high water mark metrics ' \
14
+ 'for quality tools - ' \
15
+ 'used by https://github.com/apiology/quality and friends'
16
+ spec.homepage = 'https://github.com/apiology/high_water_mark'
17
+ spec.license = 'MIT'
18
+ spec.required_ruby_version = Gem::Requirement.new('>= 2.3.0')
19
+
20
+ spec.metadata['homepage_uri'] = spec.homepage
21
+ spec.metadata['source_code_uri'] = 'https://github.com/apiology/high_water_mark'
22
+
23
+ # Specify which files should be added to the gem when it is
24
+ # released. The `git ls-files -z` loads the files in the RubyGem
25
+ # that have been added into git.
26
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
27
+ `git ls-files -z`.split("\x0").reject do |f|
28
+ f.match(%r{^(test|spec|features)/})
29
+ end
30
+ end
31
+ spec.bindir = 'exe'
32
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
33
+ spec.require_paths = ['lib']
34
+
35
+ spec.add_development_dependency('bundler')
36
+ spec.add_development_dependency('pronto')
37
+ spec.add_development_dependency('pronto-bigfiles')
38
+ spec.add_development_dependency('pronto-punchlist')
39
+ spec.add_development_dependency('pronto-rubocop')
40
+ spec.add_development_dependency('quality', '~> 37')
41
+ spec.add_development_dependency('rake')
42
+ spec.add_development_dependency('rspec')
43
+ spec.add_development_dependency('simplecov')
44
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'high_water_mark/version'
4
+
5
+ module HighWaterMark
6
+ class Error < StandardError; end
7
+ # Your code goes here...
8
+ end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ module HighWaterMark
4
+ # Calculate threshold for quality gem tool
5
+ class Threshold
6
+ attr_reader :tool_name
7
+
8
+ def initialize(tool_name,
9
+ count_file: File,
10
+ count_io: IO,
11
+ output_dir: 'metrics')
12
+ @tool_name = tool_name
13
+ @count_file = count_file
14
+ @count_io = count_io
15
+ @filename = File.join(output_dir, "#{tool_name}_high_water_mark")
16
+ end
17
+
18
+ def threshold
19
+ return @count_io.read(@filename).to_i if @count_file.exist?(@filename)
20
+ end
21
+
22
+ def write_violations(new_violations)
23
+ @count_file.open(@filename, 'w') do |file|
24
+ file.write(new_violations.to_s + "\n")
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module HighWaterMark
4
+ VERSION = '0.1.0'
5
+ end
@@ -0,0 +1 @@
1
+ 300
@@ -0,0 +1 @@
1
+ 0
@@ -0,0 +1 @@
1
+ 0
@@ -0,0 +1 @@
1
+ 0
@@ -0,0 +1 @@
1
+ 0
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ desc 'Run tasks to be done during a continuous integration (CI) build'
4
+ task ci: :localtest
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ desc 'Rebaseline quality thresholds to last commit'
4
+ task :clear_metrics do |_t|
5
+ ret =
6
+ system('git checkout coverage/.last_run.json metrics/*_high_water_mark')
7
+ raise unless ret
8
+ end
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ desc 'Standard build'
4
+ task default: :localtest
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rspec/core/rake_task'
4
+
5
+ desc 'Run features'
6
+ RSpec::Core::RakeTask.new(:feature) do |task|
7
+ task.pattern = 'feature/**/*_spec.rb'
8
+ task.rspec_opts = '--format doc --default-path feature ' \
9
+ '--require spec_helper'
10
+ end
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ desc 'Standard build when running on a workstation'
4
+ task localtest: %i[clear_metrics spec feature quality]
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ desc 'Look for incremental quality issues'
4
+ task :pronto do
5
+ formatter = '-f github_pr' if ENV.key? 'PRONTO_GITHUB_ACCESS_TOKEN'
6
+ if ENV.key? 'TRAVIS_PULL_REQUEST'
7
+ ENV['PRONTO_PULL_REQUEST_ID'] = ENV['TRAVIS_PULL_REQUEST']
8
+ elsif ENV.key? 'CIRCLE_PULL_REQUEST'
9
+ ENV['PRONTO_PULL_REQUEST_ID'] = ENV['CIRCLE_PULL_REQUEST'].split('/').last
10
+ end
11
+ sh "pronto run #{formatter} -c origin/master --no-exit-code --unstaged "\
12
+ "|| true"
13
+ sh "pronto run #{formatter} -c origin/master --no-exit-code --staged || true"
14
+ sh "pronto run #{formatter} -c origin/master --no-exit-code || true"
15
+ end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'quality/rake/task'
4
+
5
+ Quality::Rake::Task.new do |task|
6
+ # Exclude these files for bigfiles reasons.
7
+ #
8
+ # Gemfile.lock and is large and not really refactorable
9
+ #
10
+ # .rubocop.yml is pretty regular and a refactor would just make
11
+ # things harder to find.
12
+ #
13
+ # CODE_OF_CONDUCT.md is vendored
14
+ task.exclude_files = ['Gemfile.lock', '.rubocop.yml', 'CODE_OF_CONDUCT.md']
15
+ # cane deprecated in favor of rubocop, reek rarely actionable
16
+ task.skip_tools = %w[reek cane]
17
+ task.output_dir = 'metrics'
18
+ task.punchlist_regexp = 'XX' \
19
+ 'X|TOD' \
20
+ 'O|FIXM' \
21
+ 'E|OPTIMIZ' \
22
+ 'E|HAC' \
23
+ 'K|REVIE' \
24
+ 'W|LATE' \
25
+ 'R|FIXI' \
26
+ 'T|xi' \
27
+ 't '
28
+ # task.verbose = true
29
+ end
30
+
31
+ desc 'Static analysis and metrics enforcement'
32
+ task quality: %i[pronto update_bundle_audit]
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rspec/core/rake_task'
4
+
5
+ desc 'Run specs'
6
+ RSpec::Core::RakeTask.new(:spec) do |task|
7
+ task.pattern = 'spec/**/*_spec.rb'
8
+ task.rspec_opts = '--format doc --require spec_helper'
9
+ end
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ desc 'Update definitions used in bundle-audit'
4
+ task :update_bundle_audit do
5
+ sh 'bundle-audit update'
6
+ end
metadata ADDED
@@ -0,0 +1,222 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: high_water_mark
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Vince Broz
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2020-01-03 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: pronto
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: pronto-bigfiles
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: pronto-punchlist
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: pronto-rubocop
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: quality
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '37'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '37'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rake
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: rspec
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: simplecov
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ description: Maintains a directory of high water mark metrics for quality tools -
140
+ used by https://github.com/apiology/quality and friends
141
+ email:
142
+ - vince@broz.cc
143
+ executables:
144
+ - high_water_mark
145
+ extensions: []
146
+ extra_rdoc_files: []
147
+ files:
148
+ - ".circleci/config.yml"
149
+ - ".gitignore"
150
+ - ".pronto.yml"
151
+ - ".rspec"
152
+ - ".rubocop.yml"
153
+ - ".ruby-version"
154
+ - ".travis.yml"
155
+ - CODE_OF_CONDUCT.md
156
+ - Gemfile
157
+ - Gemfile.lock
158
+ - LICENSE.txt
159
+ - Makefile
160
+ - README.md
161
+ - Rakefile
162
+ - bin/console
163
+ - bin/setup
164
+ - coverage/.last_run.json
165
+ - exe/high_water_mark
166
+ - feature/spec_helper.rb
167
+ - high_water_mark.gemspec
168
+ - lib/high_water_mark.rb
169
+ - lib/high_water_mark/threshold.rb
170
+ - lib/high_water_mark/version.rb
171
+ - metrics/bigfiles_high_water_mark
172
+ - metrics/brakeman_high_water_mark
173
+ - metrics/bundle-audit_high_water_mark
174
+ - metrics/eslint_high_water_mark
175
+ - metrics/flake8_high_water_mark
176
+ - metrics/flay_high_water_mark
177
+ - metrics/flog_high_water_mark
178
+ - metrics/jscs_high_water_mark
179
+ - metrics/mdl_high_water_mark
180
+ - metrics/punchlist_high_water_mark
181
+ - metrics/pycodestyle_high_water_mark
182
+ - metrics/rails_best_practices_high_water_mark
183
+ - metrics/rubocop_high_water_mark
184
+ - metrics/scalastyle_high_water_mark
185
+ - metrics/shellcheck_high_water_mark
186
+ - rakelib/ci.rake
187
+ - rakelib/clear_metrics.rake
188
+ - rakelib/default.rake
189
+ - rakelib/feature.rake
190
+ - rakelib/gem_tasks.rake
191
+ - rakelib/localtest.rake
192
+ - rakelib/pronto.rake
193
+ - rakelib/quality.rake
194
+ - rakelib/spec.rake
195
+ - rakelib/update_bundle_audit.rake
196
+ homepage: https://github.com/apiology/high_water_mark
197
+ licenses:
198
+ - MIT
199
+ metadata:
200
+ homepage_uri: https://github.com/apiology/high_water_mark
201
+ source_code_uri: https://github.com/apiology/high_water_mark
202
+ post_install_message:
203
+ rdoc_options: []
204
+ require_paths:
205
+ - lib
206
+ required_ruby_version: !ruby/object:Gem::Requirement
207
+ requirements:
208
+ - - ">="
209
+ - !ruby/object:Gem::Version
210
+ version: 2.3.0
211
+ required_rubygems_version: !ruby/object:Gem::Requirement
212
+ requirements:
213
+ - - ">="
214
+ - !ruby/object:Gem::Version
215
+ version: '0'
216
+ requirements: []
217
+ rubyforge_project:
218
+ rubygems_version: 2.6.14.4
219
+ signing_key:
220
+ specification_version: 4
221
+ summary: Maintains a directory of high water mark metrics for quality tools
222
+ test_files: []