pr-with-params 2.0.0 → 2.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: fb5d7b7436528a5a08568892974cc238bd5ffc1dd6fb40e2157be5600b72dd04
4
- data.tar.gz: 8904c400e3fc49e1ac68f1434279af3d2b2a92f8c39fddc0b0b4b35c825d3b5f
3
+ metadata.gz: eec5dd34055d3ccae3776ecd927fc265ea1286b1dd256d6ffe706474debcc056
4
+ data.tar.gz: b8602efcfc96724f282233501a6a7e8719b6448282df09918afc7a462ab59287
5
5
  SHA512:
6
- metadata.gz: 00473d4b542df9d312c51f8e6801b2050109108780f914fe49cd5f5048493792d002ab3bfb5b992461644352612e9cfc2c70ff80d010fcfc32d71596d14f7379
7
- data.tar.gz: 4b86fc3db6832b59830123dce6a2b1077b90fc312d28cd360bcc648a931692680c03059c218e7acd2d8da3ccdbc3886541dd98ee677ed699347d3a5d1d523fbe
6
+ metadata.gz: cd6f6a0b572fefe7d120046ce1b3e44627f1f89a0e38a46ac6d77945cf43cea0933bf1bdedaffa986ebc311711ff74e567c464ad0521fb102df35df630ea2f1a
7
+ data.tar.gz: f235c4b5510540f08e25bfb697de46ab5fac3de429718b7b0a3d7ecd640148a73020549cb26b76e955cf46c0feb42d88c36745448f19b5902bd6af3cf025cf3b
@@ -0,0 +1,46 @@
1
+ name: CI
2
+
3
+ on:
4
+ pull_request:
5
+ types: [opened, reopened, edited, synchronize]
6
+
7
+ jobs:
8
+ validate-conventional-commit:
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ - name: Check for conventional commit
12
+ uses: agenthunt/conventional-commit-checker-action@v1.0.0
13
+ with:
14
+ pr-title-regex: '^((build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)(\(.*\))?(!)?(: (.*\s*)*))|(^Merge (.*\s*)*)|(^Initial commit$)'
15
+ pr-body-regex: '.*'
16
+
17
+ unit-test:
18
+ runs-on: ubuntu-latest
19
+ if: ${{ github.event.action != 'edited' }}
20
+ steps:
21
+ - name: Check out code
22
+ uses: actions/checkout@v3
23
+ - name: Set up Ruby
24
+ uses: ruby/setup-ruby@v1
25
+ with:
26
+ ruby-version: 3.1
27
+ - name: Install dependencies
28
+ run: bundle install
29
+ - name: Run tests
30
+ run: bundle exec rake test
31
+ rubocop:
32
+ runs-on: ubuntu-latest
33
+ if: ${{ github.event.action != 'edited' }}
34
+ steps:
35
+ - name: Check out code
36
+ uses: actions/checkout@v3
37
+ - uses: ruby/setup-ruby@v1
38
+ with:
39
+ ruby-version: 3.1
40
+ - name: rubocop
41
+ uses: reviewdog/action-rubocop@v2
42
+ with:
43
+ rubocop_version: gemfile
44
+ rubocop_extensions: rubocop-minitest:gemfile
45
+ reporter: github-pr-check
46
+ fail_on_error: true
data/.gitignore CHANGED
@@ -1,9 +1,19 @@
1
- /.bundle/
2
- /.yardoc
3
- /_yardoc/
1
+ ## GENERAL
4
2
  /coverage/
5
3
  /doc/
6
4
  /pkg/
7
5
  /spec/reports/
8
6
  /tmp/
9
7
  .DS_Store
8
+
9
+ ## BUNDLER
10
+ *.gem
11
+ /.bundle/
12
+ Gemfile.lock
13
+ vendor/bundle
14
+
15
+ ## IDEs
16
+ .idea/
17
+ .yardoc
18
+ /.yardoc
19
+ /_yardoc/
data/.rubocop.yml CHANGED
@@ -1,7 +1,54 @@
1
- # All Cops
1
+ require:
2
+ - rubocop-minitest
3
+
2
4
  AllCops:
3
5
  TargetRubyVersion: 3.1.2
4
- # Style
6
+ Exclude:
7
+ - 'bin/**/*'
8
+ NewCops: enable
9
+
10
+ #### ::STYLE ####
11
+
12
+ # Let Ruby do it's thing when the time comes
13
+ Style/FrozenStringLiteralComment:
14
+ Enabled: false
15
+
16
+ # Decision whether to use alias or alias_method is not stylistic
17
+ # See: https://blog.bigbinary.com/2012/01/08/alias-vs-alias-method.html
18
+ Style/Alias:
19
+ Enabled: false
20
+
21
+ # This still common in Rails and usually doesn't result in problems.
22
+ Style/ClassAndModuleChildren:
23
+ Enabled: false
24
+
25
+ Style/CollectionMethods:
26
+ Description: Preferred collection methods.
27
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#map-find-select-reduce-size
28
+ Enabled: true
29
+ PreferredMethods:
30
+ collect: map
31
+ collect!: map!
32
+ find: detect
33
+ find_all: select
34
+ reduce: inject
35
+
36
+ # We don't enforce per-class documentation.
37
+ Style/Documentation:
38
+ Enabled: false
39
+
40
+ # We don't mind two-line empty methods as they're easier to start editing and
41
+ # pretty common in auto-generated Rails controllers.
42
+ Style/EmptyMethod:
43
+ Enabled: false
44
+
45
+ # We allow hash rockets in rake task dependencies, e.g. task :my_task => :dep.
46
+ Style/HashSyntax:
47
+ EnforcedShorthandSyntax: never
48
+
49
+ # There's no statistical difference between single and double quotes
50
+ # performance.
51
+ # See: https://www.viget.com/articles/just-use-double-quoted-ruby-strings/
5
52
  Style/StringLiterals:
6
53
  Enabled: false
7
54
 
@@ -9,18 +56,107 @@ Style/StringLiteralsInInterpolation:
9
56
  Enabled: true
10
57
  EnforcedStyle: double_quotes
11
58
 
12
- Style/ClassAndModuleChildren:
59
+ Style/BlockDelimiters:
60
+ AllowBracesOnProceduralOneLiners: true
61
+
62
+ Style/ModuleFunction:
63
+ EnforcedStyle: extend_self
64
+
65
+ Style/SymbolArray:
66
+ MinSize: 3
67
+
68
+ Style/WordArray:
69
+ MinSize: 3
70
+
71
+ Style/FetchEnvVar:
13
72
  Enabled: false
14
73
 
15
- Style/Lambda:
74
+ Style/OpenStructUse:
16
75
  Enabled: false
17
76
 
18
- Style/FrozenStringLiteralComment:
77
+ Style/RedundantInitialize:
78
+ Exclude:
79
+ - 'test/**/*.rb'
80
+
81
+ Style/Semicolon:
82
+ Exclude:
83
+ - 'test/**/*.rb'
84
+
85
+ #### ::LAYOUT ####
86
+
87
+ Layout/DotPosition:
88
+ Enabled: true
89
+ EnforcedStyle: trailing
90
+
91
+ Layout/MultilineMethodCallIndentation:
92
+ EnforcedStyle: indented_relative_to_receiver
19
93
  Enabled: false
94
+ IndentationWidth: ~
20
95
 
21
- Style/Documentation:
96
+ # This rule does not detect string interpolations reliably,
97
+ # e.g. accuses 'full_messages.join(", ")'
98
+ Layout/SpaceInsideStringInterpolation:
22
99
  Enabled: false
23
100
 
24
- # Layout
101
+ # Allow long lines with comments
25
102
  Layout/LineLength:
26
103
  Max: 200
104
+ AllowedPatterns: ['(\A|\s)#']
105
+ Exclude:
106
+ - 'pr-with-params.gemspec'
107
+
108
+ #### ::LINT ####
109
+ Lint/AssignmentInCondition:
110
+ AllowSafeAssignment: false
111
+
112
+ Lint/ConstantDefinitionInBlock:
113
+ Exclude:
114
+ - 'test/**/*.rb'
115
+
116
+ #### ::METRICS ####
117
+
118
+ # Methods should be easy to read, enforcing an arbitrary metric as number
119
+ # of lines is not the way to do it though.
120
+ Metrics/MethodLength:
121
+ Enabled: false
122
+
123
+ Metrics/ClassLength:
124
+ Enabled: false
125
+
126
+ Metrics/AbcSize:
127
+ Enabled: false
128
+
129
+ Metrics/BlockLength:
130
+ Enabled: false
131
+
132
+ Metrics/CyclomaticComplexity:
133
+ Enabled: false
134
+
135
+ Metrics/PerceivedComplexity:
136
+ Enabled: false
137
+
138
+ Metrics/ParameterLists:
139
+ Enabled: false
140
+
141
+ #### ::NAMING ####
142
+
143
+ # Allow arbitrary symbol names
144
+ Naming/VariableNumber:
145
+ CheckSymbols: false
146
+
147
+ Naming/BlockForwarding:
148
+ Enabled: false
149
+
150
+ #### ::GEM ####
151
+ Gemspec/DevelopmentDependencies:
152
+ Enabled: false
153
+
154
+ Gemspec/OrderedDependencies:
155
+ Enabled: false
156
+
157
+ Gemspec/RequireMFA:
158
+ Enabled: false
159
+
160
+ #### ::MINITEST ####
161
+ Minitest/MultipleAssertions:
162
+ Max: 5
data/CHANGELOG.md CHANGED
@@ -15,3 +15,15 @@ To migrate to this version, simply run `gem update pr-with-params`
15
15
 
16
16
  ### Fixed
17
17
  - Occasional failures related to `launchy` not being loaded properly
18
+
19
+ ## [2.0.1] - 2023-06-05
20
+
21
+ To migrate to this version, simply run `gem update pr-with-params`
22
+
23
+ ### Added
24
+
25
+ ### Changed
26
+
27
+ ### Fixed
28
+ - Typos in messages displayed
29
+ - Remove unnecessary print statements
@@ -8,7 +8,7 @@ module PRWithParams
8
8
  desc "open", "Open a new pull request for local branch"
9
9
  long_desc <<-LONGDESC
10
10
  `pr-wip open [options]` will open a new browser window with a pull request at a URL with customized query params from <options>.
11
-
11
+
12
12
  The pull request will be pre-populated with certain fields based on custom query params
13
13
  LONGDESC
14
14
  option :template, type: :string, aliases: ['-t'], desc: 'Specify the filename of the target custom PR template (e.g: bug_squash_template.md). Will use default template otherwise.'
@@ -22,7 +22,7 @@ module PRWithParams
22
22
  option :ignore_conventional_commits, type: :boolean, desc: 'Allow PR titles that do not conform to conventional commits spec.'
23
23
  def open
24
24
  home_dir_path = `echo $HOME`.chomp
25
- config_file_path = "#{home_dir_path}/#{options[:config_path].delete_prefix('/')}"
25
+ config_file_path = "#{home_dir_path}/#{options[:config_path].delete_prefix("/")}"
26
26
  config_options = (options[:config_path].empty? ? {} : PRWithParams::ConfigParser.new(config_file_path: config_file_path, scope: options[:scope]).parse!).with_indifferent_access
27
27
  options[:validators].delete(:conventional_commits) if options[:ignore_conventional_commits]
28
28
  all_options = config_options.merge(options)
@@ -33,8 +33,6 @@ module PRWithParams
33
33
  default_title = `git show-branch --no-name $(git log #{base_branch}..#{branch_name} --pretty=format:"%h" | tail -1)`.chomp
34
34
  all_options[:title] ||= default_title
35
35
 
36
- puts all_options
37
- puts options
38
36
  PRWithParams::OptionsValidator.validate!(all_options.except(:validators), validators: all_options[:validators])
39
37
 
40
38
  remote_git_uri = `git config --get remote.origin.url`.sub('git@github.com:', '').sub('.git', '').chomp
@@ -47,7 +45,7 @@ module PRWithParams
47
45
  reason = "reason: #{e.message}"
48
46
  backtrace = "backtrace: #{e.backtrace&.last(10)&.join("\n")}"
49
47
  error_message = [message, reason, backtrace, "\n\n"].join("\n")
50
-
48
+
51
49
  warn error_message
52
50
  exit 1
53
51
  end
@@ -58,7 +56,7 @@ module PRWithParams
58
56
  puts "current branch: \e[36m#{branch_name}\e[0m"
59
57
  puts "base branch: \e[36m#{base_branch}\e[0m"
60
58
  puts "repo path: \e[36m#{remote_git_uri}\e[0m"
61
-
59
+
62
60
  push_message = "\nPushing your local branch to origin/#{branch_name}..."
63
61
  puts "\e[32m#{push_message}\e[0m"
64
62
  `sleep 1`
@@ -23,7 +23,7 @@ module PRWithParams
23
23
  private
24
24
 
25
25
  def parse_yaml_config
26
- @parsed_config = YAML.safe_load(IO.read(config_file_path)).to_h.transform_keys(&:to_sym)
26
+ @parsed_config = YAML.safe_load(IO.read(config_file_path)).to_h.transform_keys(&:to_sym) # rubocop:disable Security/IoMethods
27
27
  @filtered_config = scoped_config.transform_keys(&:to_sym).slice(*VALID_CONFIG_KEYS)
28
28
  end
29
29
 
@@ -25,7 +25,7 @@ module PRWithParams
25
25
  end
26
26
 
27
27
  class ConventionalCommitValidator
28
- CONVENTIONAL_COMMIT_REGEX = /^((build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)(\(.*\))?(!)?(: (.*\s*)*))|(^Merge (.*\s*)*)|(^Initial commit$)/.freeze
28
+ CONVENTIONAL_COMMIT_REGEX = /^((build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)(\(.*\))?(!)?(: (.*\s*)*))|(^Merge (.*\s*)*)|(^Initial commit$)/
29
29
 
30
30
  def initialize(options)
31
31
  @commit_message = options[:title]
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PRWithParams
4
- VERSION = "2.0.0"
4
+ VERSION = "2.0.2"
5
5
  end
@@ -27,8 +27,11 @@ Gem::Specification.new do |spec|
27
27
  spec.add_dependency "launchy", "~> 2.5"
28
28
  spec.add_dependency "rake", "~> 13.0"
29
29
  spec.add_dependency "thor"
30
- spec.add_dependency "activesupport"
30
+ spec.add_dependency "activesupport", "~> 7.0.4"
31
31
 
32
32
  spec.add_development_dependency "minitest", "~> 5.18.0"
33
- spec.add_development_dependency "rubocop", "~> 0.80"
33
+ spec.add_development_dependency "rubocop", "~> 1.39"
34
+ spec.add_development_dependency "rubocop-minitest", "~> 0.31.0"
35
+ spec.add_development_dependency "minitest-stub_any_instance", "~> 1.0.3"
36
+ spec.add_development_dependency "pry", "~> 0.13.1"
34
37
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pr-with-params
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - 2k-joker
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-06-06 00:00:00.000000000 Z
11
+ date: 2023-07-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: launchy
@@ -56,16 +56,16 @@ dependencies:
56
56
  name: activesupport
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '0'
61
+ version: 7.0.4
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ">="
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '0'
68
+ version: 7.0.4
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: minitest
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -86,14 +86,56 @@ dependencies:
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '0.80'
89
+ version: '1.39'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '1.39'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rubocop-minitest
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: 0.31.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.31.0
111
+ - !ruby/object:Gem::Dependency
112
+ name: minitest-stub_any_instance
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: 1.0.3
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: 1.0.3
125
+ - !ruby/object:Gem::Dependency
126
+ name: pry
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: 0.13.1
90
132
  type: :development
91
133
  prerelease: false
92
134
  version_requirements: !ruby/object:Gem::Requirement
93
135
  requirements:
94
136
  - - "~>"
95
137
  - !ruby/object:Gem::Version
96
- version: '0.80'
138
+ version: 0.13.1
97
139
  description:
98
140
  email:
99
141
  - kum.vanjunior@gmail.com
@@ -104,11 +146,11 @@ extra_rdoc_files: []
104
146
  files:
105
147
  - ".github/PULL_REQUEST_TEMPLATE/bug_fix_template.md"
106
148
  - ".github/PULL_REQUEST_TEMPLATE/new_feature_template.md"
149
+ - ".github/workflows/ci.yml"
107
150
  - ".gitignore"
108
151
  - ".rubocop.yml"
109
152
  - CHANGELOG.md
110
153
  - Gemfile
111
- - Gemfile.lock
112
154
  - LICENSE
113
155
  - README.md
114
156
  - Rakefile
data/Gemfile.lock DELETED
@@ -1,62 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- pr-with-params (2.0.0)
5
- activesupport
6
- launchy (~> 2.5)
7
- rake (~> 13.0)
8
- thor
9
-
10
- GEM
11
- remote: https://rubygems.org/
12
- specs:
13
- activesupport (7.0.5)
14
- concurrent-ruby (~> 1.0, >= 1.0.2)
15
- i18n (>= 1.6, < 2)
16
- minitest (>= 5.1)
17
- tzinfo (~> 2.0)
18
- addressable (2.8.4)
19
- public_suffix (>= 2.0.2, < 6.0)
20
- ast (2.4.2)
21
- concurrent-ruby (1.2.2)
22
- i18n (1.14.1)
23
- concurrent-ruby (~> 1.0)
24
- launchy (2.5.2)
25
- addressable (~> 2.8)
26
- minitest (5.18.0)
27
- parallel (1.22.1)
28
- parser (3.1.2.0)
29
- ast (~> 2.4.1)
30
- public_suffix (5.0.1)
31
- rainbow (3.1.1)
32
- rake (13.0.6)
33
- regexp_parser (2.5.0)
34
- rexml (3.2.5)
35
- rubocop (0.93.1)
36
- parallel (~> 1.10)
37
- parser (>= 2.7.1.5)
38
- rainbow (>= 2.2.2, < 4.0)
39
- regexp_parser (>= 1.8)
40
- rexml
41
- rubocop-ast (>= 0.6.0)
42
- ruby-progressbar (~> 1.7)
43
- unicode-display_width (>= 1.4.0, < 2.0)
44
- rubocop-ast (1.19.1)
45
- parser (>= 3.1.1.0)
46
- ruby-progressbar (1.11.0)
47
- thor (1.2.2)
48
- tzinfo (2.0.6)
49
- concurrent-ruby (~> 1.0)
50
- unicode-display_width (1.8.0)
51
-
52
- PLATFORMS
53
- arm64-darwin-21
54
- arm64-darwin-22
55
-
56
- DEPENDENCIES
57
- minitest (~> 5.18.0)
58
- pr-with-params!
59
- rubocop (~> 0.80)
60
-
61
- BUNDLED WITH
62
- 2.2.3