internet_security_event 1.2.0 → 1.2.1

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: b6923d00090d3e6b18ace47b442146eedef8dc61a3a25cca68ba4080787db760
4
- data.tar.gz: f8d9b8e164285b72fa9905590a389bb522552867d4cd20c435f415f1cb330cb8
3
+ metadata.gz: 3df07baf6dbb78e612229fee0043e79a955c01f7f1655c8e77a6a142340d4114
4
+ data.tar.gz: 53bd006f3735a68a8d8255e5c83245f636eb69bd9957c581fa65a6d094c0e0ea
5
5
  SHA512:
6
- metadata.gz: e92aa02b66c60f44cb10bd4b9d1f0a70a14beb2d101d174ec4d6b2fa34d1952ce37646df26db470ad683541d0aa3fc746e53b61bc71e644b60d5b1de589df415
7
- data.tar.gz: ec0d055bd386f1a15692e8f6044510cb4060f8b4bc56b54ebdb85d14376660125516a37840436404239e35a848d90640a7b45974afe07965d0793dbc590b31ee
6
+ metadata.gz: 2f3cdfec986f3112a037f78eb7579f6adca58b09361cfeea297a0c1d941409871312524cd14cf1bfa2534c50b255f7ebb4ec2e0d82085413d6096d5783f444ec
7
+ data.tar.gz: e49b5770d869368c49786ad8997cf85f4178f7cf52fef2eac957018db45c0ebeb0210d0bd225fc1339dc4bb215acacf52d37b55c9b0d5f205049d98b70de6621
@@ -0,0 +1,50 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ pull_request:
8
+ branches:
9
+ - main
10
+
11
+ jobs:
12
+ rubocop:
13
+ runs-on: ubuntu-latest
14
+ steps:
15
+ - uses: actions/checkout@v2
16
+ - name: Setup ruby
17
+ uses: ruby/setup-ruby@v1
18
+ with:
19
+ ruby-version: 3.0
20
+ bundler-cache: true
21
+ - name: Run static code analysis
22
+ run: bundle exec rubocop
23
+ unit:
24
+ runs-on: ubuntu-latest
25
+ needs: rubocop
26
+ strategy:
27
+ matrix:
28
+ ruby:
29
+ - "2.6"
30
+ - "2.7"
31
+ - "3.0"
32
+ - "3.1"
33
+ name: Ruby ${{ matrix.ruby }}
34
+ steps:
35
+ - uses: actions/checkout@v2
36
+ - name: Setup ruby
37
+ uses: ruby/setup-ruby@v1
38
+ with:
39
+ ruby-version: ${{ matrix.ruby }}
40
+ bundler-cache: true
41
+ - name: Run tests without uploading code coverage
42
+ if: ${{ matrix.ruby != '3.0' }}
43
+ run: bundle exec rake
44
+ - name: Run tests and upload coverage to Code Climate
45
+ if: ${{ matrix.ruby == '3.0' }}
46
+ uses: paambaati/codeclimate-action@v3.0.0
47
+ env:
48
+ CC_TEST_REPORTER_ID: ${{ secrets.CODECLIMATE_TOKEN }}
49
+ with:
50
+ coverageCommand: bundle exec rake
data/.rubocop.yml ADDED
@@ -0,0 +1,25 @@
1
+ AllCops:
2
+ AllowSymlinksInCacheRootDirectory: true
3
+
4
+ require:
5
+ - rubocop-rake
6
+ - rubocop-rspec
7
+
8
+ Layout/HashAlignment:
9
+ EnforcedColonStyle: table
10
+ EnforcedHashRocketStyle: table
11
+
12
+ Metrics/LineLength:
13
+ Max: 160
14
+
15
+ Style/Documentation:
16
+ Enabled: false
17
+
18
+ Style/TrailingCommaInArrayLiteral:
19
+ EnforcedStyleForMultiline: comma
20
+
21
+ Style/TrailingCommaInHashLiteral:
22
+ EnforcedStyleForMultiline: comma
23
+
24
+ Style/TrailingCommaInArguments:
25
+ EnforcedStyleForMultiline: comma
data/CHANGELOG.md CHANGED
@@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [1.2.1] - 2022-07-15
9
+
10
+ ### Changed
11
+ - Emit a `warning` state instead of a `warn` state to match Riemann wording.
12
+
8
13
  ## [1.2.0] - 2019-02-28
9
14
 
10
15
  ### Changed
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # InternetSecurityEvent
2
2
 
3
- [![Build Status](https://travis-ci.com/smortex/internet_security_event.svg?branch=master)](https://travis-ci.com/smortex/internet_security_event)
3
+ [![Build Status](https://github.com/smortex/internet_security_event/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/smortex/internet_security_event/actions/workflows/ci.yml)
4
4
  [![Maintainability](https://api.codeclimate.com/v1/badges/bc64fb4f1c1088c15b8c/maintainability)](https://codeclimate.com/github/smortex/internet_security_event/maintainability)
5
5
  [![Test Coverage](https://api.codeclimate.com/v1/badges/bc64fb4f1c1088c15b8c/test_coverage)](https://codeclimate.com/github/smortex/internet_security_event/test_coverage)
6
6
 
@@ -38,7 +38,7 @@ certificate = OpenSSL::X509::Certificate.new(...)
38
38
 
39
39
  event = InternetSecurityEvent::X509Status.build(certificate)
40
40
 
41
- event[:state] #=> 'ok', 'warn', 'critical'
41
+ event[:state] #=> 'ok', 'warning', 'critical'
42
42
  event[:description] #=> Human readable state
43
43
  event[:metric] #=> an optional Float
44
44
  ```
@@ -81,4 +81,4 @@ License](https://opensource.org/licenses/MIT).
81
81
 
82
82
  Everyone interacting in the InternetSecurityEvent project’s codebases, issue
83
83
  trackers, chat rooms and mailing lists is expected to follow the [code of
84
- conduct](https://github.com/smortex/internet_security_event/blob/master/CODE_OF_CONDUCT.md).
84
+ conduct](https://github.com/smortex/internet_security_event/blob/main/CODE_OF_CONDUCT.md).
@@ -13,6 +13,7 @@ Gem::Specification.new do |spec|
13
13
  spec.summary = 'Build events describing the status of various internet services'
14
14
  spec.homepage = 'https://github.com/smortex/internet_security_event'
15
15
  spec.license = 'MIT'
16
+ spec.required_ruby_version = Gem::Requirement.new('>= 2.6.0')
16
17
 
17
18
  # Specify which files should be added to the gem when it is released.
18
19
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
@@ -28,5 +29,8 @@ Gem::Specification.new do |spec|
28
29
  spec.add_development_dependency 'bundler'
29
30
  spec.add_development_dependency 'rake'
30
31
  spec.add_development_dependency 'rspec'
32
+ spec.add_development_dependency 'rubocop'
33
+ spec.add_development_dependency 'rubocop-rake'
34
+ spec.add_development_dependency 'rubocop-rspec'
31
35
  spec.add_development_dependency 'simplecov'
32
36
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module InternetSecurityEvent
4
- VERSION = '1.2.0'
4
+ VERSION = '1.2.1'
5
5
  end
@@ -15,7 +15,7 @@ module InternetSecurityEvent
15
15
  obj.to_e
16
16
  end
17
17
 
18
- def to_e
18
+ def to_e # rubocop:disable Metrics/AbcSize
19
19
  {
20
20
  state: state,
21
21
  description: description,
@@ -45,7 +45,7 @@ module InternetSecurityEvent
45
45
  if not_valid_yet? || expired_or_expire_soon?
46
46
  'critical'
47
47
  elsif expire_soonish?
48
- 'warn'
48
+ 'warning'
49
49
  else
50
50
  'ok'
51
51
  end
@@ -80,31 +80,27 @@ module InternetSecurityEvent
80
80
  end
81
81
 
82
82
  # Stolen from ActionView, to avoid pulling a lot of dependencies
83
- def distance_of_time_in_words_to_now(to_time)
83
+ def distance_of_time_in_words_to_now(to_time) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
84
84
  distance_in_seconds = (to_time - now).round.abs
85
85
  distance_in_minutes = distance_in_seconds / 60
86
86
 
87
87
  case distance_in_minutes
88
88
  when 0 then 'less than 1 minute'
89
- when 1...45 then pluralize_string('%d %s', distance_in_minutes, 'minute')
90
- when 45...1440 then pluralize_string('about %d %s', (distance_in_minutes.to_f / 60.0).round, 'hour')
89
+ when 1...45 then pluralize_string('%d minute', distance_in_minutes)
90
+ when 45...1440 then pluralize_string('about %d hour', (distance_in_minutes.to_f / 60.0).round)
91
91
  # 24 hours up to 30 days
92
- when 1440...43_200 then pluralize_string('%d %s', (distance_in_minutes.to_f / 1440.0).round, 'day')
92
+ when 1440...43_200 then pluralize_string('%d day', (distance_in_minutes.to_f / 1440.0).round)
93
93
  # 30 days up to 60 days
94
- when 43_200...86_400 then pluralize_string('about %d %s', (distance_in_minutes.to_f / 43_200.0).round, 'month')
94
+ when 43_200...86_400 then pluralize_string('about %d month', (distance_in_minutes.to_f / 43_200.0).round)
95
95
  # 60 days up to 365 days
96
- when 86_400...525_600 then pluralize_string('%d %s', (distance_in_minutes.to_f / 43_200.0).round, 'month')
96
+ when 86_400...525_600 then pluralize_string('%d month', (distance_in_minutes.to_f / 43_200.0).round)
97
97
  else
98
- pluralize_string('about %d %s', (distance_in_minutes.to_f / 525_600.0).round, 'year')
98
+ pluralize_string('about %d year', (distance_in_minutes.to_f / 525_600.0).round)
99
99
  end
100
100
  end
101
101
 
102
- def pluralize_string(string, number, word)
103
- format(string, number, pluralize_word(number, word))
104
- end
105
-
106
- def pluralize_word(number, word)
107
- word + (number.abs == 1 ? '' : 's')
102
+ def pluralize_string(string, number)
103
+ format(string, number) + (number == 1 ? '' : 's')
108
104
  end
109
105
  end
110
106
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: internet_security_event
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Romain Tartière
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-02-28 00:00:00.000000000 Z
11
+ date: 2022-07-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -66,6 +66,48 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: 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: rubocop-rake
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rubocop-rspec
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'
69
111
  - !ruby/object:Gem::Dependency
70
112
  name: simplecov
71
113
  requirement: !ruby/object:Gem::Requirement
@@ -80,16 +122,17 @@ dependencies:
80
122
  - - ">="
81
123
  - !ruby/object:Gem::Version
82
124
  version: '0'
83
- description:
125
+ description:
84
126
  email:
85
127
  - romain@blogreen.org
86
128
  executables: []
87
129
  extensions: []
88
130
  extra_rdoc_files: []
89
131
  files:
132
+ - ".github/workflows/ci.yml"
90
133
  - ".gitignore"
91
134
  - ".rspec"
92
- - ".travis.yml"
135
+ - ".rubocop.yml"
93
136
  - CHANGELOG.md
94
137
  - CODE_OF_CONDUCT.md
95
138
  - Gemfile
@@ -110,7 +153,7 @@ homepage: https://github.com/smortex/internet_security_event
110
153
  licenses:
111
154
  - MIT
112
155
  metadata: {}
113
- post_install_message:
156
+ post_install_message:
114
157
  rdoc_options: []
115
158
  require_paths:
116
159
  - lib
@@ -118,15 +161,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
118
161
  requirements:
119
162
  - - ">="
120
163
  - !ruby/object:Gem::Version
121
- version: '0'
164
+ version: 2.6.0
122
165
  required_rubygems_version: !ruby/object:Gem::Requirement
123
166
  requirements:
124
167
  - - ">="
125
168
  - !ruby/object:Gem::Version
126
169
  version: '0'
127
170
  requirements: []
128
- rubygems_version: 3.0.2
129
- signing_key:
171
+ rubygems_version: 3.3.17
172
+ signing_key:
130
173
  specification_version: 4
131
174
  summary: Build events describing the status of various internet services
132
175
  test_files: []
data/.travis.yml DELETED
@@ -1,12 +0,0 @@
1
- ---
2
- language: ruby
3
- rvm:
4
- - 2.4
5
- - 2.5
6
- - 2.6
7
- before_script:
8
- - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
9
- - chmod +x ./cc-test-reporter
10
- - ./cc-test-reporter before-build
11
- after_script:
12
- - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT