rf-stylez 1.0.0 → 1.0.2

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: d03b1eaf0d1d4470b65a658c809ad325c16b2884e93f0c4e6b18f9914a3a76fb
4
- data.tar.gz: cd8eaf1aa26c2359f2cb42a6894b11245a2a94099845811361957eae3a3ea5a6
3
+ metadata.gz: 6eab02f25e22ed5d7365687d436c5f7c6b7e8e036b9d41203b482cb945e573e9
4
+ data.tar.gz: b0a3163d0569cb82d9024902f2669b78be9bc6f0a8c6541e632212925e05a9ab
5
5
  SHA512:
6
- metadata.gz: 539a02d714f5bad8c553586bd494f8b41fd55d49d472f196a178b124abdd4a7b7e5b1d1003ade7892c0c61176a80f5ed5ce3ed8562292ac9c8aed970a6e472f7
7
- data.tar.gz: fd74a452a0183221a50ca4aabe4fa01c34c0a98156b3fc7595592182415dc26e1b41ec1db03e5166a0cf11c201c9359d2632a1e064968e955ebf7d4c3325d8be
6
+ metadata.gz: 7f8d14ce2b39e35025cb459371df3369e20e0a5120e29323dcd78acc51829a4fcfc1e4efabdb4ecb31d392235c96e23df40f7ef6314a0dd5beaa56b874c2aa8e
7
+ data.tar.gz: 012adcb6bdc628f820958909f86042a3a8d4e3863baee8afe070c29dfea9f550a1c2d23c90346a5660963fae813837cf5fbc38978361e88031b06a16f06069c3
data/.circleci/config.yml CHANGED
@@ -3,7 +3,7 @@ version: 2.1
3
3
  jobs:
4
4
  test:
5
5
  docker:
6
- - image: cimg/ruby:3.2.0
6
+ - image: cimg/ruby:3.2.2
7
7
  auth:
8
8
  username: $DOCKERHUB_USERNAME
9
9
  password: $DOCKERHUB_TOKEN
@@ -32,7 +32,7 @@ jobs:
32
32
 
33
33
  push_to_rubygems:
34
34
  docker:
35
- - image: cimg/ruby:3.2.0
35
+ - image: cimg/ruby:3.2.2
36
36
  auth:
37
37
  username: $DOCKERHUB_USERNAME
38
38
  password: $DOCKERHUB_TOKEN
@@ -52,6 +52,21 @@ jobs:
52
52
  gem build rf-stylez
53
53
  gem push rf-stylez-*.gem
54
54
 
55
+ update_jira:
56
+ docker:
57
+ - image: alpine:3.8
58
+ auth:
59
+ username: $DOCKERHUB_USERNAME
60
+ password: $DOCKERHUB_TOKEN
61
+ steps:
62
+ - run:
63
+ name: Install dependencies
64
+ command: apk add --no-cache bash curl git openssh
65
+ - checkout
66
+ - run:
67
+ name: Update JIRA
68
+ command: .circleci/update-jira.sh
69
+
55
70
  workflows:
56
71
  version: 2
57
72
  gem_release:
@@ -70,3 +85,13 @@ workflows:
70
85
  context:
71
86
  - DockerHub
72
87
  - RubyGems
88
+ - update_jira:
89
+ requires:
90
+ - push_to_rubygems
91
+ filters:
92
+ branches:
93
+ only:
94
+ - master
95
+ context:
96
+ - DockerHub
97
+ - update-jira-webhook
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env bash
2
+
3
+ set -euo pipefail
4
+
5
+ # Use JIRA automation webhooks to move issues to SHIPPED:
6
+ # https://support.atlassian.com/jira-software-cloud/docs/automation-triggers/#Automationtriggers-Incomingwebhook
7
+
8
+ git log --max-count=50 --pretty=format:'%s' | grep -Eo '^\w+-[0-9]+' | sort -u | while read i; do
9
+ curl -X POST "$UPDATE_JIRA_WEBHOOK_URL?issue=$i"
10
+ done
@@ -9,7 +9,9 @@ permissions:
9
9
 
10
10
  jobs:
11
11
  pronto:
12
+
12
13
  runs-on: ubuntu-latest
14
+
13
15
  env:
14
16
  # `MAKE="make --jobs $(nproc)"` is from
15
17
  # https://build.betterup.com/one-weird-trick-that-will-speed-up-your-bundle-install/
@@ -20,18 +22,20 @@ jobs:
20
22
 
21
23
  steps:
22
24
  - name: Checkout code
23
- uses: actions/checkout@v2
24
- # Set the depth to 100 and hope this won't fail for branches with a lot of little commits
25
- - run: |
26
- git fetch --no-tags --prune --depth=100 origin +refs/heads/*:refs/remotes/origin/*
25
+ uses: actions/checkout@v3
26
+ with:
27
+ fetch-depth: 100
28
+ - run: git fetch --no-tags --prune --depth=100 origin "+refs/heads/$GITHUB_BASE_REF:refs/remotes/origin/$GITHUB_BASE_REF"
29
+
27
30
  - name: Setup Ruby
28
31
  uses: ruby/setup-ruby@v1
29
32
  with:
30
- ruby-version: "3.2.0"
31
- # Run `bundle install` with cache when `true`
33
+ ruby-version: "3.2.2"
32
34
  bundler-cache: true
35
+
33
36
  - name: Setup pronto
34
37
  run: gem install pronto pronto-rubocop
38
+
35
39
  - name: Run Pronto
36
40
  run: bundle exec pronto run -f github_status github_pr -c origin/${{ github.base_ref }}
37
41
  env:
data/README.md CHANGED
@@ -9,7 +9,6 @@ This is a place for style configurations for [Rainforest QA](https://www.rainfor
9
9
  - pull latest master
10
10
  - run `rake release:source_control_push`
11
11
  - CI/CD will take care of releasing rf-stylez to rubygems
12
- - Update circlemator `bundle update rf-stylez`
13
12
 
14
13
  ## Adding `rf-stylez` to a new project
15
14
 
@@ -1,32 +1,33 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'json'
4
- require 'net/http'
5
- require 'logger'
3
+ require "json"
4
+ require "net/http"
5
+ require "logger"
6
6
 
7
7
  module Rf
8
8
  module Stylez
9
+ # Check for updates to rf-stylez
9
10
  module UpdateCheck
10
- RUBYGEMS_URL = URI('https://rubygems.org/api/v1/gems/rf-stylez.json').freeze
11
+ RUBYGEMS_URL = URI("https://rubygems.org/api/v1/gems/rf-stylez.json").freeze
11
12
 
12
13
  def self.check
13
14
  logger = Logger.new(STDOUT)
14
15
  current_version = Gem::Version.new(VERSION)
15
16
 
16
17
  remote_version = Gem::Version.new(
17
- JSON.parse(Net::HTTP.get(RUBYGEMS_URL))['version']
18
+ JSON.parse(Net::HTTP.get(RUBYGEMS_URL))["version"] # rubocop:disable Lint/NoJSON
18
19
  )
19
20
  if current_version >= remote_version
20
- logger.info('You are running latest rf-stylez ')
21
- logger.info('(•_•) ( •_•)>⌐■-■ (⌐■_■)')
21
+ logger.info("You are running latest rf-stylez ")
22
+ logger.info("(•_•) ( •_•)>⌐■-■ (⌐■_■)")
22
23
  else
23
- logger.warn('RF Stylez is out of date!')
24
+ logger.warn("RF Stylez is out of date!")
24
25
  logger.warn("Newest version is: #{remote_version}")
25
26
  logger.warn("You are running: #{current_version}")
26
- logger.warn('Please update: `gem update rf-stylez`')
27
+ logger.warn("Please update: `gem update rf-stylez`")
27
28
  end
28
29
  rescue SocketError
29
- logger.info('Offline, cannot check for rf-stylez updates')
30
+ logger.info("Offline, cannot check for rf-stylez updates")
30
31
  end
31
32
  end
32
33
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Rf
4
4
  module Stylez
5
- VERSION = "1.0.0"
5
+ VERSION = "1.0.2"
6
6
  end
7
7
  end
data/lib/rf/stylez.rb CHANGED
@@ -1,17 +1,18 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'rf/stylez/version'
4
- require 'rf/stylez/update_check'
5
- require 'rubocop'
6
- require 'rubocop/cop/lint/no_json'
7
- require 'rubocop/cop/lint/no_http_party'
8
- require 'rubocop/cop/lint/obscure'
9
- require 'rubocop/cop/lint/no_grape_api'
10
- require 'rubocop/cop/lint/use_positive_int32_validator'
11
- require 'rubocop/cop/lint/no_untyped_raise'
12
- require 'rubocop/cop/lint/no_vcr_recording'
3
+ require "rf/stylez/version"
4
+ require "rf/stylez/update_check"
5
+ require "rubocop"
6
+ require "rubocop/cop/lint/no_json"
7
+ require "rubocop/cop/lint/no_http_party"
8
+ require "rubocop/cop/lint/obscure"
9
+ require "rubocop/cop/lint/no_grape_api"
10
+ require "rubocop/cop/lint/use_positive_int32_validator"
11
+ require "rubocop/cop/lint/no_untyped_raise"
12
+ require "rubocop/cop/lint/no_vcr_recording"
13
13
 
14
14
  module Rf
15
+ # Stylez
15
16
  module Stylez
16
17
  def self.reek_config_path
17
18
  File.expand_path("../../ruby/.reek.yml", __dir__)
@@ -18,10 +18,10 @@ module RuboCop
18
18
  # end
19
19
  # end
20
20
  class NoBangStateMachineEvents < Cop
21
- MSG = 'Event names ending with a `!` define `!`-ended methods that do not raise'
21
+ MSG = "Event names ending with a `!` define `!`-ended methods that do not raise"
22
22
 
23
- def_node_matcher :is_state_machine_event?, '(send nil? :event (sym $_))'
24
- def_node_matcher :is_state_machine?, '(block (send nil? :state_machine ...) ...)'
23
+ def_node_matcher :is_state_machine_event?, "(send nil? :event (sym $_))"
24
+ def_node_matcher :is_state_machine?, "(block (send nil? :state_machine ...) ...)"
25
25
 
26
26
  def on_send(node)
27
27
  return unless (event_name = is_state_machine_event?(node))
@@ -13,9 +13,9 @@ module RuboCop
13
13
  # # good
14
14
  # class Foo < Api::Base
15
15
  class NoGrapeAPI < Cop
16
- MSG = 'Prefer inheriting `Api::AuthBase` or `Api::Base` instead of `Grape::API`.'.freeze
16
+ MSG = "Prefer inheriting `Api::AuthBase` or `Api::Base` instead of `Grape::API`."
17
17
 
18
- def_node_matcher :inherits_Grape_API?, '(class (const ...) (const (const nil? :Grape) :API) ...)'
18
+ def_node_matcher :inherits_Grape_API?, "(class (const ...) (const (const nil? :Grape) :API) ...)"
19
19
 
20
20
  def on_class(node)
21
21
  return unless inherits_Grape_API?(node)
@@ -10,9 +10,9 @@ module RuboCop
10
10
  # # good
11
11
  # TimedRequest.get(...)
12
12
  class NoHTTParty < Cop
13
- MSG = 'Prefer `TimedRequest` instead of raw `HTTParty` calls.'.freeze
13
+ MSG = "Prefer `TimedRequest` instead of raw `HTTParty` calls."
14
14
 
15
- def_node_matcher :is_HTTParty?, '(send (const nil? :HTTParty) ...)'
15
+ def_node_matcher :is_HTTParty?, "(send (const nil? :HTTParty) ...)"
16
16
 
17
17
  def on_send(node)
18
18
  return unless is_HTTParty?(node)
@@ -11,9 +11,9 @@ module RuboCop
11
11
  # MultiJson.load(...)
12
12
  #
13
13
  class NoJSON < Cop
14
- MSG = 'Use `MultiJson` instead of `JSON`.'.freeze
14
+ MSG = "Use `MultiJson` instead of `JSON`."
15
15
 
16
- def_node_matcher :is_JSON?, '(const nil? :JSON)'
16
+ def_node_matcher :is_JSON?, "(const nil? :JSON)"
17
17
 
18
18
  def on_const(node)
19
19
  return unless is_JSON?(node)
@@ -11,9 +11,9 @@ module RuboCop
11
11
  # raise ArgumentError, 'foo'
12
12
  #
13
13
  class NoUntypedRaise < Cop
14
- MSG = 'Do not raise untyped exceptions, specify the error type so it can be rescued specifically.'
14
+ MSG = "Do not raise untyped exceptions, specify the error type so it can be rescued specifically."
15
15
 
16
- def_node_matcher :is_untyped_raise?, '(send nil? {:raise :fail} (str ...) ...)'
16
+ def_node_matcher :is_untyped_raise?, "(send nil? {:raise :fail} (str ...) ...)"
17
17
 
18
18
  def on_send(node)
19
19
  return unless is_untyped_raise?(node)
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
- require 'unparser'
2
+
3
+ require "unparser"
3
4
 
4
5
  module RuboCop
5
6
  module Cop
@@ -15,7 +16,7 @@ module RuboCop
15
16
  class NoVCRRecording < RuboCop::Cop::Base
16
17
  extend AutoCorrector
17
18
 
18
- MSG = 'Do not set :record option in VCR'.freeze
19
+ MSG = "Do not set :record option in VCR"
19
20
 
20
21
  def_node_search :is_only_setting_record_option?, <<~PATTERN
21
22
  (pair
@@ -48,7 +49,7 @@ module RuboCop
48
49
 
49
50
  add_offense(node) do |corrector|
50
51
  if is_only_setting_record_option?(node)
51
- corrector.replace(node, 'vcr: true')
52
+ corrector.replace(node, "vcr: true")
52
53
  elsif is_setting_record_option?(node)
53
54
  corrector.replace(node, remove_record_option(node))
54
55
  end
@@ -20,7 +20,7 @@ module RuboCop
20
20
  #
21
21
  # https://ruby-doc.org/core-2.4.0/String.html#method-i-25
22
22
  class Obscure < Cop
23
- MSG = 'Do not use the flipflop operator'.freeze
23
+ MSG = "Do not use the flipflop operator"
24
24
 
25
25
  def_node_matcher :is_stringformat?, <<-PATTERN
26
26
  (send {str dstr} $:% ...)
@@ -36,7 +36,7 @@ module RuboCop
36
36
 
37
37
  def on_send(node)
38
38
  return unless is_stringformat?(node)
39
- add_offense(node, message: 'Do not use String#%')
39
+ add_offense(node, message: "Do not use String#%")
40
40
  end
41
41
  end
42
42
  end
@@ -14,7 +14,7 @@ module RuboCop
14
14
  # requires :id, type: Integer, positive_int32: true
15
15
  # end
16
16
  class UsePositiveInt32Validator < Cop
17
- MSG = 'If this Integer maps to a postgres Integer column, validate with `positive_int32: true`'
17
+ MSG = "If this Integer maps to a postgres Integer column, validate with `positive_int32: true`"
18
18
 
19
19
  # check if the param is `requires` / `optional`
20
20
  def_node_search :find_params_hashes, <<~PATTERN
@@ -23,9 +23,9 @@ module RuboCop
23
23
  $(hash ...) ...)
24
24
  PATTERN
25
25
  # check if hash contains `type: Integer`
26
- def_node_search :is_type_integer?, '(pair (sym :type) (const nil? :Integer))'
26
+ def_node_search :is_type_integer?, "(pair (sym :type) (const nil? :Integer))"
27
27
  # check if the hash contains the `positive_int32` validator
28
- def_node_search :validates_integer?, '(pair (sym :positive_int32) {{true false} (int _)})'
28
+ def_node_search :validates_integer?, "(pair (sym :positive_int32) {{true false} (int _)})"
29
29
 
30
30
  def on_block(node)
31
31
  return unless (hash = find_params_hashes(node))
data/rf-stylez.gemspec CHANGED
@@ -21,16 +21,16 @@ Gem::Specification.new do |spec|
21
21
  spec.executables = ["rf-stylez"]
22
22
  spec.require_paths = ["lib"]
23
23
 
24
- spec.add_runtime_dependency "rubocop", "1.41.1"
25
- spec.add_runtime_dependency "rubocop-rails", "2.17.4"
26
- spec.add_runtime_dependency "rubocop-rspec", "2.16.0"
24
+ spec.add_runtime_dependency "rubocop", "1.54.1"
25
+ spec.add_runtime_dependency "rubocop-rails", "2.20.2"
26
+ spec.add_runtime_dependency "rubocop-rspec", "2.22.0"
27
27
  spec.add_runtime_dependency "reek", "~> 6.1"
28
28
  spec.add_runtime_dependency "get_env", "~> 0.2.0"
29
29
  spec.add_runtime_dependency "unparser", "~> 0.6"
30
30
  spec.add_runtime_dependency "pronto", "~> 0.11.1"
31
- spec.add_runtime_dependency "pronto-rubocop", "~> 0.11.4"
31
+ spec.add_runtime_dependency "pronto-rubocop", "~> 0.11.5"
32
32
 
33
- spec.add_development_dependency "bundler", "~> 2.1"
33
+ spec.add_development_dependency "bundler", "~> 2.4"
34
34
  spec.add_development_dependency "rake", "~> 13.0"
35
35
  spec.add_development_dependency "rspec", ">= 3.4"
36
36
  spec.add_development_dependency "byebug"
data/ruby/rubocop.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  AllCops:
2
- TargetRubyVersion: 2.7
2
+ TargetRubyVersion: 3.2
3
3
  DisabledByDefault: true
4
4
  Include:
5
5
  - '**/*.rb'
@@ -180,6 +180,8 @@ Style/Documentation:
180
180
  Enabled: true
181
181
  Style/DocumentationMethod:
182
182
  Enabled: false
183
+ Style/OpenStructUse:
184
+ Enabled: true
183
185
 
184
186
  Layout/LineLength:
185
187
  Enabled: true
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rf-stylez
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Emanuel Evans
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-01-09 00:00:00.000000000 Z
11
+ date: 2023-07-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop
@@ -16,42 +16,42 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 1.41.1
19
+ version: 1.54.1
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 1.41.1
26
+ version: 1.54.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rubocop-rails
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 2.17.4
33
+ version: 2.20.2
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 2.17.4
40
+ version: 2.20.2
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rubocop-rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - '='
46
46
  - !ruby/object:Gem::Version
47
- version: 2.16.0
47
+ version: 2.22.0
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - '='
53
53
  - !ruby/object:Gem::Version
54
- version: 2.16.0
54
+ version: 2.22.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: reek
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -114,28 +114,28 @@ dependencies:
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: 0.11.4
117
+ version: 0.11.5
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: 0.11.4
124
+ version: 0.11.5
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: bundler
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
129
  - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: '2.1'
131
+ version: '2.4'
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
- version: '2.1'
138
+ version: '2.4'
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: rake
141
141
  requirement: !ruby/object:Gem::Requirement
@@ -201,6 +201,7 @@ extensions: []
201
201
  extra_rdoc_files: []
202
202
  files:
203
203
  - ".circleci/config.yml"
204
+ - ".circleci/update-jira.sh"
204
205
  - ".github/dependabot.yml"
205
206
  - ".github/workflows/pronto.yml"
206
207
  - ".gitignore"
@@ -247,7 +248,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
247
248
  - !ruby/object:Gem::Version
248
249
  version: '0'
249
250
  requirements: []
250
- rubygems_version: 3.4.1
251
+ rubygems_version: 3.4.10
251
252
  signing_key:
252
253
  specification_version: 4
253
254
  summary: Styles for Rainforest code