rubocop-i18n 2.0.2 → 3.0.0

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: 298270613b63bb269fc258034c5a16aab14f764e5631540d672a44662e2d8b66
4
- data.tar.gz: 2422d8f873a23edbbd9873df60af5db71370ceca545b4134a8ea9d7e0f1ffc37
3
+ metadata.gz: 900bad082ace7d17bf13e8a01691f33c021fb683f5bf4963b1a4f217d98720c8
4
+ data.tar.gz: df4f70a869ae98441bb1d98b8b9365a8a06368ffeb6b63c16138291ff241fb32
5
5
  SHA512:
6
- metadata.gz: 3d4ae45e34a92d3b3eb013929e4fef7ae3fb7967575a55273575edf6032bfcac243e6e320e15a010f8c914032fc7e1e05acc0e14ab155f25d91512ea9e610e0e
7
- data.tar.gz: 92507187ded035d39a07ae4b967cd97017a1879876c0cb74877fc20d0f04d3606aa6d0ef12b377a8e1e178a46e3da6f1a5d77a7fa995bfa1378ffce8c09d57dd
6
+ metadata.gz: 666a5de6a09a035d64937dcdf1441faaef249ebc6df44572f37d858ffdf00f2509abc56581900fb839d857e2e4da2c7a9e71f0d20476ab67c8d83022670052b7
7
+ data.tar.gz: 9c5cc9f02c4408c8f3a2667125b65bb1a6385bf7d885b38787521961646240d4684d81988592298009ec54660f3533f8722b8c1118809528f2d6641f0ac808b2
@@ -0,0 +1,38 @@
1
+ ---
2
+ name: Bug report
3
+ about: Create a report to help us improve
4
+ title: ''
5
+ labels: ''
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ **Describe the bug**
11
+ A clear and concise description of what the bug is.
12
+
13
+ **To Reproduce**
14
+ Steps to reproduce the behavior:
15
+ 1. Go to '...'
16
+ 2. Click on '....'
17
+ 3. Scroll down to '....'
18
+ 4. See error
19
+
20
+ **Expected behavior**
21
+ A clear and concise description of what you expected to happen.
22
+
23
+ **Screenshots**
24
+ If applicable, add screenshots to help explain your problem.
25
+
26
+ **Desktop (please complete the following information):**
27
+ - OS: [e.g. iOS]
28
+ - Browser [e.g. chrome, safari]
29
+ - Version [e.g. 22]
30
+
31
+ **Smartphone (please complete the following information):**
32
+ - Device: [e.g. iPhone6]
33
+ - OS: [e.g. iOS8.1]
34
+ - Browser [e.g. stock browser, safari]
35
+ - Version [e.g. 22]
36
+
37
+ **Additional context**
38
+ Add any other context about the problem here.
@@ -0,0 +1,20 @@
1
+ ---
2
+ name: Feature request
3
+ about: Suggest an idea for this project
4
+ title: ''
5
+ labels: ''
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ **Is your feature request related to a problem? Please describe.**
11
+ A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12
+
13
+ **Describe the solution you'd like**
14
+ A clear and concise description of what you want to happen.
15
+
16
+ **Describe alternatives you've considered**
17
+ A clear and concise description of any alternative solutions or features you've considered.
18
+
19
+ **Additional context**
20
+ Add any other context or screenshots about the feature request here.
@@ -2,6 +2,9 @@ inherit_from: .rubocop_todo.yml
2
2
  require:
3
3
  - rubocop/cop/internal_affairs
4
4
 
5
+ AllCops:
6
+ TargetRubyVersion: 2.5
7
+
5
8
  Metrics/BlockLength:
6
9
  Exclude:
7
10
  # Exclude the spec directory because the rspec DSL results in long blocks
@@ -1,44 +1,50 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2018-06-12 15:16:26 -0700 using RuboCop version 0.57.2.
3
+ # on 2020-10-25 09:49:30 UTC using RuboCop version 1.0.0.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
- # Offense count: 6
9
+ # Offense count: 1
10
+ # Configuration parameters: Include.
11
+ # Include: **/*.gemspec
12
+ Gemspec/RequiredRubyVersion:
13
+ Exclude:
14
+ - 'rubocop-i18n.gemspec'
15
+
16
+ # Offense count: 1
17
+ # Cop supports --auto-correct.
10
18
  Lint/InterpolationCheck:
11
19
  Exclude:
12
20
  - 'spec/rubocop/cop/i18n/gettext/decorate_string_spec.rb'
13
21
 
14
- # Offense count: 4
22
+ # Offense count: 2
23
+ # Configuration parameters: IgnoredMethods.
15
24
  Metrics/AbcSize:
16
25
  Max: 29
17
26
 
18
- # Offense count: 6
19
- # Configuration parameters: CountComments, ExcludedMethods.
20
- Metrics/BlockLength:
21
- Enabled: false
22
- Max: 61
23
-
24
27
  # Offense count: 1
25
- # Configuration parameters: CountComments.
28
+ # Configuration parameters: CountComments, CountAsOne.
26
29
  Metrics/ClassLength:
27
- Enabled: false
28
- Max: 106
30
+ Max: 108
29
31
 
30
- # Offense count: 3
32
+ # Offense count: 5
33
+ # Configuration parameters: IgnoredMethods.
31
34
  Metrics/CyclomaticComplexity:
32
35
  Max: 8
33
36
 
34
37
  # Offense count: 7
35
- # Configuration parameters: CountComments.
38
+ # Configuration parameters: CountComments, CountAsOne, ExcludedMethods.
36
39
  Metrics/MethodLength:
37
40
  Max: 25
38
41
 
39
- # Offense count: 2
40
- Metrics/PerceivedComplexity:
41
- Max: 8
42
+ # Offense count: 1
43
+ # Configuration parameters: ExpectMatchingDefinition, CheckDefinitionPathHierarchy, Regex, IgnoreExecutableScripts, AllowedAcronyms.
44
+ # AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS
45
+ Naming/FileName:
46
+ Exclude:
47
+ - 'lib/rubocop-i18n.rb'
42
48
 
43
49
  # Offense count: 2
44
50
  Style/Documentation:
@@ -49,37 +55,37 @@ Style/Documentation:
49
55
  - 'lib/rubocop/cop/i18n/gettext/decorate_function_message.rb'
50
56
 
51
57
  # Offense count: 12
52
- # Configuration parameters: EnforcedStyle.
58
+ # Configuration parameters: MaxUnannotatedPlaceholdersAllowed.
53
59
  # SupportedStyles: annotated, template, unannotated
54
60
  Style/FormatStringToken:
55
- Exclude:
56
- - 'spec/rubocop/cop/i18n/gettext/decorate_function_message_spec.rb'
57
- - 'spec/rubocop/cop/i18n/gettext/decorate_string_formatting_using_interpolation_spec.rb'
58
- - 'spec/rubocop/cop/i18n/rails_i18n/decorate_string_formatting_using_interpolation_spec.rb'
59
- - 'spec/rubocop/cop/i18n/gettext/decorate_string_formatting_using_percent_spec.rb'
60
- - 'spec/rubocop/cop/i18n/gettext/decorate_string_spec.rb'
61
+ EnforcedStyle: template
61
62
 
62
- # Offense count: 3
63
+ # Offense count: 2
63
64
  # Configuration parameters: MinBodyLength.
64
65
  Style/GuardClause:
65
66
  Exclude:
66
67
  - 'lib/rubocop/cop/i18n/gettext/decorate_function_message.rb'
67
68
  - 'lib/rubocop/cop/i18n/gettext/decorate_string_formatting_using_percent.rb'
68
69
 
69
- # Offense count: 10
70
+ # Offense count: 6
70
71
  # Cop supports --auto-correct.
71
72
  Style/IfUnlessModifier:
72
73
  Exclude:
73
74
  - 'lib/rubocop/cop/i18n/gettext/decorate_function_message.rb'
74
75
  - 'lib/rubocop/cop/i18n/gettext/decorate_string_formatting_using_percent.rb'
75
- - 'lib/rubocop/rspec/cop_helper.rb'
76
76
 
77
- # Offense count: 93
78
- # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
77
+ # Offense count: 5
78
+ # Configuration parameters: AllowModifier.
79
+ Style/SoleNestedConditional:
80
+ Exclude:
81
+ - 'lib/rubocop/cop/i18n/gettext/decorate_function_message.rb'
82
+ - 'lib/rubocop/cop/i18n/gettext/decorate_string.rb'
83
+ - 'lib/rubocop/cop/i18n/gettext/decorate_string_formatting_using_percent.rb'
84
+ - 'lib/rubocop/cop/i18n/rails_i18n/decorate_string.rb'
85
+
86
+ # Offense count: 50
87
+ # Cop supports --auto-correct.
88
+ # Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
79
89
  # URISchemes: http, https
80
- Metrics/LineLength:
90
+ Layout/LineLength:
81
91
  Max: 174
82
-
83
- Naming/FileName:
84
- Exclude:
85
- - 'lib/rubocop-i18n.rb'
@@ -1 +1 @@
1
- 2.5.6
1
+ 2.7.2
@@ -1,4 +1,12 @@
1
+ ---
2
+ os: linux
3
+ dist: xenial
1
4
  language: ruby
2
- fast_finish: true
5
+ rvm:
6
+ - 2.5.8
7
+ - 2.6.6
8
+ - 2.7.2
9
+ jobs:
10
+ fast_finish: true
3
11
  notifications:
4
12
  email: true
@@ -1,6 +1,12 @@
1
1
  # Change Log
2
2
 
3
- ### [master (Unreleased)](https://github.com/puppetlabs/rubocop-i18n/compare/v2.0.2...master)
3
+ ### [master (Unreleased)](https://github.com/puppetlabs/rubocop-i18n/compare/v3.0.0...master)
4
+ ### [3.0.0](https://github.com/puppetlabs/rubocop-i18n/compare/v2.0.2...v3.0.0)
5
+
6
+ * Update Rubocop version to 1.0! Thank you @mvz!
7
+ * Cop namespace fixes, documentation updates, loading issues. Thank you again @mvz !
8
+ * Gem maintainership has been passed to @highb. Thank you @binford2k and @lucywyman!
9
+ * Update Ruby versions in gemspec, Travis, .ruby-version. Thank you @sfeuga!
4
10
 
5
11
  ### [2.0.2](https://github.com/puppetlabs/rubocop-i18n/compare/v2.0.1...v2.0.2)
6
12
 
data/CODEOWNERS CHANGED
@@ -2,4 +2,4 @@
2
2
  # the repo. Unless a later match takes precedence,
3
3
  # @global-owner1 and @global-owner2 will be requested for
4
4
  # review when someone opens a pull request.
5
- * @highb @tphoney
5
+ * @highb @puppetlabs/open-source-stewards
data/README.md CHANGED
@@ -34,33 +34,33 @@ require:
34
34
  ...
35
35
  # You *must* choose GetText or Rails-i18n style checking
36
36
  # If you want GetText-style checking
37
- GetText:
37
+ I18n/GetText:
38
38
  Enabled: true
39
- RailsI18n:
39
+ I18n/RailsI18n:
40
40
  Enabled: false
41
41
  # If you want rails-i18n-style checking
42
- RailsI18n:
42
+ I18n/RailsI18n:
43
43
  Enabled: true
44
- GetText:
44
+ I18n/GetText:
45
45
  Enabled: false
46
46
  # If you want custom control of all the cops
47
- GetText/DecorateString:
47
+ I18n/GetText/DecorateString:
48
48
  Enabled: false
49
49
  # Disable the autocorrect
50
50
  AutoCorrect: false
51
- GetText/DecorateFunctionMessage:
51
+ I18n/GetText/DecorateFunctionMessage:
52
52
  Enabled: false
53
- GetText/DecorateStringFormattingUsingInterpolation:
53
+ I18n/GetText/DecorateStringFormattingUsingInterpolation:
54
54
  Enabled: false
55
- GetText/DecorateStringFormattingUsingPercent:
55
+ I18n/GetText/DecorateStringFormattingUsingPercent:
56
56
  Enabled: false
57
- RailsI18n/DecorateString:
57
+ I18n/RailsI18n/DecorateString:
58
58
  Enabled: false
59
59
  ```
60
60
 
61
61
  ## Cops
62
62
 
63
- ### GetText/DecorateString
63
+ ### I18n/GetText/DecorateString
64
64
 
65
65
  This cop is looks for strings that appear to be sentences but are not decorated.
66
66
  Sentences are determined by the STRING_REGEXP.
@@ -90,7 +90,7 @@ _("Result is good.")
90
90
  "a string that doesn't start with a capital letter."
91
91
  ```
92
92
 
93
- ### GetText/DecorateFunctionMessage
93
+ ### I18n/GetText/DecorateFunctionMessage
94
94
 
95
95
  This cop looks for any raise or fail functions and checks that the user visible message is using gettext decoration with the _() function.
96
96
  This cop makes sure the message is decorated, as well as checking that the formatting of the message is compliant according to the follow rules.
@@ -206,7 +206,7 @@ raise(someOtherFuntioncall(foo, "bar"))
206
206
  In this raise or fail function, the message does not contain any decoration at all and the message is not a simple string. It may make sense to convert the message to a simple string. eg [Simple decoration of a message](#Simple-decoration-of-a-message).
207
207
  Or ignore this raise or fail function following this [How to ignore rules in code](#How-to-ignore-rules-in-code) section.
208
208
 
209
- ### GetText/DecorateStringFormattingUsingInterpolation
209
+ ### I18n/GetText/DecorateStringFormattingUsingInterpolation
210
210
 
211
211
  This cop looks for decorated gettext methods _() and checks that all strings contained
212
212
  within do not use string interpolation '#{}'
@@ -233,7 +233,7 @@ puts _("a message with a #{'interpolation'}")
233
233
  puts _("a message that is %{type}") % { type: 'translatable' }
234
234
  ```
235
235
 
236
- ### GetText/DecorateStringFormattingUsingPercent
236
+ ### I18n/GetText/DecorateStringFormattingUsingPercent
237
237
 
238
238
  This cop looks for decorated gettext methods _() and checks that all strings contained
239
239
  within do not use sprintf formatting '%s' etc
@@ -256,7 +256,7 @@ raise(_("Warning is %s") % ['bad'])
256
256
  raise(_("Warning is %{value}") % { value: 'bad' })
257
257
  ```
258
258
 
259
- ### RailsI18n/DecorateString
259
+ ### I18n/RailsI18n/DecorateString
260
260
 
261
261
  This cop looks for decorated rails-i18n methods.
262
262
 
@@ -280,7 +280,7 @@ raise(translate("Warning is %{value}") % { value: 'good' })
280
280
  raise(I18n.t("Warning is %{value}") % { value: 'good' })
281
281
  ```
282
282
 
283
- ### RailsI18n/DecorateStringFormattingUsingInterpolation
283
+ ### I18n/RailsI18n/DecorateStringFormattingUsingInterpolation
284
284
 
285
285
  This cop looks for decorated rails-i18n methods like `t()` and `translate()` and checks that all strings contained
286
286
  within do not use string interpolation '#{}'
@@ -311,11 +311,11 @@ puts t("path.to.key.with.interpolation")
311
311
 
312
312
  It may be necessary to ignore a cop for a particular piece of code. We follow standard rubocop idioms.
313
313
  ``` ruby
314
- raise("We don't want this translated.") # rubocop:disable GetText/DecorateString
315
- raise("We don't want this translated.") # rubocop:disable RailsI18n/DecorateString
316
- raise("We don't want this translated") # rubocop:disable GetText/DecorateFunctionMessage
317
- raise(_("We don't want this translated #{crazy}") # rubocop:disable GetText/DecorateStringFormattingUsingInterpolation)
318
- raise(_("We don't want this translated %s") % ['crazy'] # rubocop:disable GetText/DecorateStringFormattingUsingPercent)
314
+ raise("We don't want this translated.") # rubocop:disable I18n/GetText/DecorateString
315
+ raise("We don't want this translated.") # rubocop:disable I18n/RailsI18n/DecorateString
316
+ raise("We don't want this translated") # rubocop:disable I18n/GetText/DecorateFunctionMessage
317
+ raise(_("We don't want this translated #{crazy}") # rubocop:disable I18n/GetText/DecorateStringFormattingUsingInterpolation)
318
+ raise(_("We don't want this translated %s") % ['crazy'] # rubocop:disable I18n/GetText/DecorateStringFormattingUsingPercent)
319
319
  ```
320
320
 
321
321
  ## Known Issues
@@ -2,11 +2,10 @@
2
2
 
3
3
  lib = File.expand_path('lib', __dir__)
4
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
- rubocop_version = '~> 0.51'
6
5
 
7
6
  Gem::Specification.new do |spec|
8
7
  spec.name = 'rubocop-i18n'
9
- spec.version = '2.0.2'
8
+ spec.version = '3.0.0'
10
9
  spec.authors = ['Puppet', 'Brandon High', 'TP Honey', 'Helen Campbell']
11
10
  spec.email = ['team-modules@puppet.com', 'brandon.high@puppet.com', 'tp@puppet.com', 'helen@puppet.com']
12
11
 
@@ -22,11 +21,12 @@ Gem::Specification.new do |spec|
22
21
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
22
  spec.require_paths = ['lib']
24
23
 
24
+ spec.required_ruby_version = '>= 2.5.8'
25
+
25
26
  spec.add_development_dependency 'bundler', '>= 1.17.3'
26
27
  spec.add_development_dependency 'pry', '~> 0.13.1'
27
28
  spec.add_development_dependency 'rake', '>= 12.3.3'
28
29
  spec.add_development_dependency 'rb-readline', '~> 0.5.5'
29
30
  spec.add_development_dependency 'rspec', '~> 3.0'
30
- spec.add_development_dependency 'rubocop', rubocop_version
31
- spec.add_runtime_dependency 'rubocop', rubocop_version
31
+ spec.add_runtime_dependency 'rubocop', '~> 1.0'
32
32
  end
metadata CHANGED
@@ -1,17 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop-i18n
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.2
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet
8
8
  - Brandon High
9
9
  - TP Honey
10
10
  - Helen Campbell
11
- autorequire:
11
+ autorequire:
12
12
  bindir: exe
13
13
  cert_chain: []
14
- date: 2020-05-19 00:00:00.000000000 Z
14
+ date: 2020-12-14 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: bundler
@@ -89,28 +89,14 @@ dependencies:
89
89
  requirements:
90
90
  - - "~>"
91
91
  - !ruby/object:Gem::Version
92
- version: '0.51'
93
- type: :development
94
- prerelease: false
95
- version_requirements: !ruby/object:Gem::Requirement
96
- requirements:
97
- - - "~>"
98
- - !ruby/object:Gem::Version
99
- version: '0.51'
100
- - !ruby/object:Gem::Dependency
101
- name: rubocop
102
- requirement: !ruby/object:Gem::Requirement
103
- requirements:
104
- - - "~>"
105
- - !ruby/object:Gem::Version
106
- version: '0.51'
92
+ version: '1.0'
107
93
  type: :runtime
108
94
  prerelease: false
109
95
  version_requirements: !ruby/object:Gem::Requirement
110
96
  requirements:
111
97
  - - "~>"
112
98
  - !ruby/object:Gem::Version
113
- version: '0.51'
99
+ version: '1.0'
114
100
  description: RuboCop rules for detecting and autocorrecting undecorated strings for
115
101
  i18n (gettext and rails-i18n)
116
102
  email:
@@ -122,6 +108,8 @@ executables: []
122
108
  extensions: []
123
109
  extra_rdoc_files: []
124
110
  files:
111
+ - ".github/ISSUE_TEMPLATE/bug_report.md"
112
+ - ".github/ISSUE_TEMPLATE/feature_request.md"
125
113
  - ".gitignore"
126
114
  - ".rubocop.yml"
127
115
  - ".rubocop_todo.yml"
@@ -151,7 +139,7 @@ homepage: https://github.com/puppetlabs/rubocop-i18n
151
139
  licenses:
152
140
  - Apache-2.0
153
141
  metadata: {}
154
- post_install_message:
142
+ post_install_message:
155
143
  rdoc_options: []
156
144
  require_paths:
157
145
  - lib
@@ -159,16 +147,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
159
147
  requirements:
160
148
  - - ">="
161
149
  - !ruby/object:Gem::Version
162
- version: '0'
150
+ version: 2.5.8
163
151
  required_rubygems_version: !ruby/object:Gem::Requirement
164
152
  requirements:
165
153
  - - ">="
166
154
  - !ruby/object:Gem::Version
167
155
  version: '0'
168
156
  requirements: []
169
- rubyforge_project:
170
- rubygems_version: 2.7.6.2
171
- signing_key:
157
+ rubygems_version: 3.1.4
158
+ signing_key:
172
159
  specification_version: 4
173
160
  summary: RuboCop rules for i18n
174
161
  test_files: []