gitlab-styles 6.5.0 → 6.6.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: 4f15e657637a0d30fed824f3d8312b970b9ee9bebc5a0feb603b83fa884b1705
4
- data.tar.gz: fef3baec21ab04501f316d754a02aab77fb4dc816a048f87070d6d1b4a28f74c
3
+ metadata.gz: f43bff11daad05b1bb5f442c18f3fa7b8ef871e60f7675dd165f55b1515953f7
4
+ data.tar.gz: 57317b8cb40639df642e1d058f342eba63979b237f18cc5d5290065aef5a3a5f
5
5
  SHA512:
6
- metadata.gz: 9954e550cf2ead877c73939a6f20893be5a584eb2c4f0850ea2cb5c8f4e976f3a20d3f910c0a39072c87e666cba51a8f5d283c56e33e2b2db76b1376f18cab7f
7
- data.tar.gz: a54833e11f28072707ca11e21428820d888a8c95f89a5577e2633d324311400eca5d277b93311a405239397ca9ad3abac2a9982fcd5ace63f5a4491af970d513
6
+ metadata.gz: bb319a3ada8ae43e77ba1de5aeb4234e9c6d8c97848f3ae3870222a4b0a4f4ae2f8f2d6356f8cd9b9747101482758834ceacb5cd2cef09519fd17e736a272c05
7
+ data.tar.gz: bb37685d5084df12a4820c47ce43ec0106aa50e05f9a7ddbde97c9956a7ec50e62fac388a968ba909c356c66324511fa5f407455b538ea1d183d2fa2f20367d1
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
12
12
  spec.email = ['gitlab_rubygems@gitlab.com']
13
13
 
14
14
  spec.summary = 'GitLab style guides and shared style configs.'
15
- spec.homepage = 'https://gitlab.com/gitlab-org/gitlab-styles'
15
+ spec.homepage = 'https://gitlab.com/gitlab-org/ruby/gems/gitlab-styles'
16
16
  spec.license = 'MIT'
17
17
 
18
18
  spec.files = `git ls-files -z`.split("\x0").reject do |f|
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Gitlab
4
+ module Styles
5
+ module Rubocop
6
+ module Cop
7
+ module Performance
8
+ # This cop flags inefficient uses of rubyzip's Zip::File, since when instantiated
9
+ # it reads the file's Central Directory into memory entirely. For zips with many
10
+ # files and directories, this can be very expensive even when the archive's size
11
+ # in bytes is small.
12
+ #
13
+ # See also:
14
+ # - https://github.com/rubyzip/rubyzip/issues/506
15
+ # - https://github.com/rubyzip/rubyzip#notes-on-zipinputstream
16
+ class Rubyzip < RuboCop::Cop::Cop
17
+ MSG = 'Be careful when opening or iterating zip files via Zip::File. ' \
18
+ 'Zip archives may contain many entries, and their file index is ' \
19
+ 'read into memory upon construction, which can lead to ' \
20
+ 'high memory use and poor performance. ' \
21
+ 'Consider iterating archive entries via Zip::InputStream instead.'
22
+
23
+ def_node_matcher :reads_central_directory?, <<-PATTERN
24
+ (send
25
+ (const
26
+ (const {nil? (cbase)} :Zip) :File) {:new :open :foreach} ...)
27
+ PATTERN
28
+
29
+ def on_send(node)
30
+ return unless reads_central_directory?(node)
31
+
32
+ add_offense(node)
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Gitlab
4
4
  module Styles
5
- VERSION = '6.5.0'
5
+ VERSION = '6.6.0'
6
6
  end
7
7
  end
@@ -1,6 +1,7 @@
1
1
  ---
2
2
  require:
3
3
  - rubocop-performance
4
+ - ./lib/gitlab/styles/rubocop
4
5
 
5
6
  # Used to identify usages of ancestors.include? and change them to use ⇐ instead.
6
7
  # https://docs.rubocop.org/rubocop-performance/1.8/cops_performance.html#performanceancestorsinclude
@@ -112,3 +113,9 @@ Performance/Sum:
112
113
  # Checks for `.times.map` calls.
113
114
  Performance/TimesMap:
114
115
  Enabled: true
116
+
117
+ # Flags potentially expensive operations on ZIP archives.
118
+ Performance/Rubyzip:
119
+ Enabled: true
120
+ Exclude:
121
+ - 'spec/**/*'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitlab-styles
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.5.0
4
+ version: 6.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitLab
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-11-17 00:00:00.000000000 Z
11
+ date: 2021-11-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop
@@ -177,6 +177,7 @@ files:
177
177
  - lib/gitlab/styles/rubocop/cop/line_break_after_guard_clauses.rb
178
178
  - lib/gitlab/styles/rubocop/cop/line_break_around_conditional_block.rb
179
179
  - lib/gitlab/styles/rubocop/cop/migration/update_large_table.rb
180
+ - lib/gitlab/styles/rubocop/cop/performance/rubyzip.rb
180
181
  - lib/gitlab/styles/rubocop/cop/polymorphic_associations.rb
181
182
  - lib/gitlab/styles/rubocop/cop/rails/include_url_helper.rb
182
183
  - lib/gitlab/styles/rubocop/cop/redirect_with_status.rb
@@ -211,7 +212,7 @@ files:
211
212
  - rubocop-rspec.yml
212
213
  - rubocop-security.yml
213
214
  - rubocop-style.yml
214
- homepage: https://gitlab.com/gitlab-org/gitlab-styles
215
+ homepage: https://gitlab.com/gitlab-org/ruby/gems/gitlab-styles
215
216
  licenses:
216
217
  - MIT
217
218
  metadata: {}