rubocop-hk 1.0.9 โ 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +82 -7
- data/config/default.yml +6 -3
- data/lib/rubocop/hk/version.rb +1 -1
- metadata +8 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4a57757c3616476f00576220bcfcfcb7d074bac9d76428decaae65d6c088ef1c
|
4
|
+
data.tar.gz: 6f0d46d1e3521cee22488d0218a061734bd9dcd492ff49e0df7fa0740bac5fc4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d77e3ccd41040583b742a9cc7c930d22295090613e79fa98c47b5587759ecb8bb55d7370ae79de9c6d6aa9fe63c011328d4cc7e370aa3a3bc26819aaf27b4249
|
7
|
+
data.tar.gz: e8132cee7ded0a47a6b4c9294f1df2216146643266950ad4c87e6d698fa5df3da3d98d5a481f19e2d7c73fad11bdda4b5836b518eec326413c718d7648629c2a
|
data/README.md
CHANGED
@@ -80,7 +80,7 @@ end
|
|
80
80
|
|
81
81
|
```bash
|
82
82
|
# 1. Add to your Gemfile
|
83
|
-
echo 'gem "rubocop-hk", "~> 1.
|
83
|
+
echo 'gem "rubocop-hk", "~> 1.1.1", require: false' >> Gemfile
|
84
84
|
|
85
85
|
# 2. Install the gem
|
86
86
|
bundle install
|
@@ -163,7 +163,7 @@ cat << 'EOF' >> Gemfile
|
|
163
163
|
|
164
164
|
# Code quality and style enforcement
|
165
165
|
group :development, :test do
|
166
|
-
gem "rubocop-hk", "~> 1.
|
166
|
+
gem "rubocop-hk", "~> 1.1.1", require: false
|
167
167
|
end
|
168
168
|
EOF
|
169
169
|
|
@@ -248,7 +248,7 @@ Add this line to your application's Gemfile:
|
|
248
248
|
|
249
249
|
```ruby
|
250
250
|
group :development, :test do
|
251
|
-
gem "rubocop-hk", "~> 1.
|
251
|
+
gem "rubocop-hk", "~> 1.1.1", require: false
|
252
252
|
end
|
253
253
|
```
|
254
254
|
|
@@ -522,7 +522,7 @@ cat >> Gemfile << 'EOF'
|
|
522
522
|
|
523
523
|
# Code quality and linting
|
524
524
|
group :development, :test do
|
525
|
-
gem "rubocop-hk", "~> 1.
|
525
|
+
gem "rubocop-hk", "~> 1.1.1", require: false
|
526
526
|
end
|
527
527
|
EOF
|
528
528
|
|
@@ -636,7 +636,7 @@ cd my_api
|
|
636
636
|
cat >> Gemfile << 'EOF'
|
637
637
|
|
638
638
|
group :development, :test do
|
639
|
-
gem "rubocop-hk", "~> 1.
|
639
|
+
gem "rubocop-hk", "~> 1.1.1", require: false
|
640
640
|
end
|
641
641
|
EOF
|
642
642
|
|
@@ -1226,6 +1226,79 @@ bundle exec rubocop --only Style/StringLiterals
|
|
1226
1226
|
bundle exec rubocop --auto-gen-config
|
1227
1227
|
```
|
1228
1228
|
|
1229
|
+
### ๐๏ธ **Overriding RuboCop Rules**
|
1230
|
+
|
1231
|
+
You can easily override or customize any RuboCop rule by adding it to your `.rubocop.yml` file:
|
1232
|
+
|
1233
|
+
```yaml
|
1234
|
+
# .rubocop.yml
|
1235
|
+
inherit_gem:
|
1236
|
+
rubocop-hk: config/default.yml
|
1237
|
+
|
1238
|
+
AllCops:
|
1239
|
+
TargetRubyVersion: 3.3
|
1240
|
+
TargetRailsVersion: 8.0
|
1241
|
+
|
1242
|
+
# ๐ซ Disable specific cops
|
1243
|
+
Style/Documentation:
|
1244
|
+
Enabled: false # Turn off documentation requirement
|
1245
|
+
|
1246
|
+
# ๐ข Adjust cop parameters
|
1247
|
+
Metrics/ClassLength:
|
1248
|
+
Max: 200 # Allow longer classes (default: 100)
|
1249
|
+
|
1250
|
+
Layout/LineLength:
|
1251
|
+
Max: 120 # Extend line length (default: 80)
|
1252
|
+
Exclude:
|
1253
|
+
- "db/migrate/*.rb" # Exclude migrations from line length
|
1254
|
+
|
1255
|
+
# ๐ฏ Enable/disable cops for specific files
|
1256
|
+
Style/FrozenStringLiteralComment:
|
1257
|
+
Enabled: true
|
1258
|
+
Exclude:
|
1259
|
+
- "bin/*"
|
1260
|
+
- "db/seeds.rb"
|
1261
|
+
|
1262
|
+
# ๐ Customize severity levels
|
1263
|
+
Style/StringLiterals:
|
1264
|
+
EnforcedStyle: double_quotes # Enforce double quotes
|
1265
|
+
Severity: error # Make violations errors instead of warnings
|
1266
|
+
|
1267
|
+
# ๐งช RSpec-specific overrides
|
1268
|
+
RSpec/ExampleLength:
|
1269
|
+
Max: 25 # Allow longer test examples (default: 15)
|
1270
|
+
|
1271
|
+
RSpec/MultipleExpectations:
|
1272
|
+
Max: 5 # Allow more expectations per test
|
1273
|
+
|
1274
|
+
# โก Performance cop customization
|
1275
|
+
Performance/Casecmp:
|
1276
|
+
Enabled: true
|
1277
|
+
Severity: warning
|
1278
|
+
|
1279
|
+
# ๐ Rails-specific overrides
|
1280
|
+
Rails/HasManyOrHasOneDependent:
|
1281
|
+
Enabled: true
|
1282
|
+
Severity: error # Make missing dependent option an error
|
1283
|
+
```
|
1284
|
+
|
1285
|
+
**๐ก Pro Tips for Overriding Rules:**
|
1286
|
+
|
1287
|
+
- **Start small**: Override one rule at a time and test the impact
|
1288
|
+
- **Use Exclude**: Prefer excluding specific files rather than disabling cops entirely
|
1289
|
+
- **Check severity**: Use `warning` instead of disabling if you want to keep visibility
|
1290
|
+
- **Document why**: Add comments explaining why you're overriding specific rules
|
1291
|
+
- **Team agreement**: Make sure your team agrees on rule changes
|
1292
|
+
|
1293
|
+
**๐ Finding Rule Names:**
|
1294
|
+
```bash
|
1295
|
+
# See all available cops
|
1296
|
+
bundle exec rubocop --show-cops
|
1297
|
+
|
1298
|
+
# Find which cop is flagging a specific issue
|
1299
|
+
bundle exec rubocop --format offenses
|
1300
|
+
```
|
1301
|
+
|
1229
1302
|
### ๐ง **Pre-commit Hook Setup**
|
1230
1303
|
|
1231
1304
|
```bash
|
@@ -1356,7 +1429,7 @@ EOF
|
|
1356
1429
|
```ruby
|
1357
1430
|
# Gemfile updates for Rails 7 compatibility
|
1358
1431
|
gem "rails", "~> 7.0.0"
|
1359
|
-
gem "rubocop-hk", "~> 1.
|
1432
|
+
gem "rubocop-hk", "~> 1.1.1"
|
1360
1433
|
|
1361
1434
|
# Update other gems
|
1362
1435
|
gem "rspec-rails", "~> 6.0" # Rails 7 compatible
|
@@ -3082,7 +3155,7 @@ bundle install
|
|
3082
3155
|
gem install rubocop-hk -v "~> 1.0.0"
|
3083
3156
|
|
3084
3157
|
# Version-specific fix for Rails 6:
|
3085
|
-
echo 'gem "rubocop-hk", "~> 1.
|
3158
|
+
echo 'gem "rubocop-hk", "~> 1.1.1", require: false' >> Gemfile
|
3086
3159
|
bundle install
|
3087
3160
|
```
|
3088
3161
|
|
@@ -3724,6 +3797,8 @@ If RuboCop HK helps you write better Ruby code, please consider:
|
|
3724
3797
|
|
3725
3798
|
**Made with โค๏ธ by [Hammad Khan](https://github.com/hammadxcm)**
|
3726
3799
|
|
3800
|
+
**๐ Visit: [https://fyniti.co.uk](https://fyniti.co.uk)**
|
3801
|
+
|
3727
3802
|
**[๐ Report Bug](https://github.com/hammadxcm/rubocop-hk/issues) โข
|
3728
3803
|
[โจ Request Feature](https://github.com/hammadxcm/rubocop-hk/issues/new?template=feature_request.md) โข
|
3729
3804
|
[๐ Documentation](https://github.com/hammadxcm/rubocop-hk/wiki) โข
|
data/config/default.yml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
AllCops:
|
2
2
|
# Target versions for Rails 6-8.x applications (2025)
|
3
|
-
TargetRubyVersion: 3.
|
4
|
-
TargetRailsVersion: 8.
|
3
|
+
TargetRubyVersion: 3.2
|
4
|
+
TargetRailsVersion: 8.1
|
5
5
|
|
6
6
|
# Enhanced exclusions for typical Rails project structure
|
7
7
|
Exclude:
|
@@ -31,11 +31,14 @@ AllCops:
|
|
31
31
|
# Enable new cops for modern Rails/Ruby features
|
32
32
|
NewCops: enable
|
33
33
|
|
34
|
+
# Parser engine (prism for Ruby 3.4+)
|
35
|
+
ParserEngine: parser_whitequark
|
36
|
+
|
34
37
|
# Extension suggestions for Rails 6-8.x
|
35
38
|
SuggestExtensions:
|
36
39
|
rubocop-performance: true
|
37
40
|
rubocop-thread_safety: false
|
38
|
-
rubocop-minitest:
|
41
|
+
rubocop-minitest: true
|
39
42
|
rubocop-capybara: true
|
40
43
|
|
41
44
|
Rails:
|
data/lib/rubocop/hk/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubocop-hk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hammad Khan
|
@@ -15,14 +15,14 @@ dependencies:
|
|
15
15
|
requirements:
|
16
16
|
- - "~>"
|
17
17
|
- !ruby/object:Gem::Version
|
18
|
-
version: 1.
|
18
|
+
version: 1.80.0
|
19
19
|
type: :runtime
|
20
20
|
prerelease: false
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
22
22
|
requirements:
|
23
23
|
- - "~>"
|
24
24
|
- !ruby/object:Gem::Version
|
25
|
-
version: 1.
|
25
|
+
version: 1.80.0
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: rubocop-performance
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|
@@ -43,14 +43,14 @@ dependencies:
|
|
43
43
|
requirements:
|
44
44
|
- - "~>"
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: 2.
|
46
|
+
version: 2.33.0
|
47
47
|
type: :runtime
|
48
48
|
prerelease: false
|
49
49
|
version_requirements: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
51
|
- - "~>"
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: 2.
|
53
|
+
version: 2.33.0
|
54
54
|
- !ruby/object:Gem::Dependency
|
55
55
|
name: rubocop-rspec
|
56
56
|
requirement: !ruby/object:Gem::Requirement
|
@@ -106,6 +106,7 @@ metadata:
|
|
106
106
|
homepage_uri: https://github.com/hammadxcm/rubocop-hk
|
107
107
|
source_code_uri: https://github.com/hammadxcm/rubocop-hk
|
108
108
|
changelog_uri: https://github.com/hammadxcm/rubocop-hk/blob/main/CHANGELOG.md
|
109
|
+
rubygems_mfa_required: 'true'
|
109
110
|
rdoc_options: []
|
110
111
|
require_paths:
|
111
112
|
- lib
|
@@ -113,14 +114,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
113
114
|
requirements:
|
114
115
|
- - ">="
|
115
116
|
- !ruby/object:Gem::Version
|
116
|
-
version: 3.
|
117
|
+
version: 3.2.0
|
117
118
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
118
119
|
requirements:
|
119
120
|
- - ">="
|
120
121
|
- !ruby/object:Gem::Version
|
121
122
|
version: '0'
|
122
123
|
requirements: []
|
123
|
-
rubygems_version: 3.
|
124
|
+
rubygems_version: 3.7.1
|
124
125
|
specification_version: 4
|
125
126
|
summary: RuboCop HK
|
126
127
|
test_files: []
|