Fix Style/FrozenStringLiteralComment cop.

This commit is contained in:
Robert Haines 2021-05-23 18:24:22 +01:00
parent 0e4dc676a0
commit e10badf68e
98 changed files with 209 additions and 31 deletions

View File

@ -146,13 +146,6 @@ Style/Documentation:
Style/FormatStringToken:
EnforcedStyle: unannotated
# Offense count: 97
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
# SupportedStyles: always, always_true, never
Style/FrozenStringLiteralComment:
Enabled: false
# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: AllowSplatArgument.

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'simplecov-lcov'
SimpleCov::Formatter::LcovFormatter.config do |c|

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
source 'https://rubygems.org'
gemspec

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
guard :minitest do
# with Minitest::Unit
watch(%r{^test/(.*)\/?(.*)_test\.rb$})

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'bundler/gem_tasks'
require 'rake/testtask'
require 'rubocop/rake_task'

View File

@ -1,4 +1,5 @@
#!/usr/bin/env ruby
# frozen_string_literal: true
require 'bundler/setup'
require 'zip'

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'English'
require 'delegate'
require 'singleton'

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Zip
class CentralDirectory
include Enumerable

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Zip
class Compressor #:nodoc:all
def finish; end

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Zip
RUNNING_ON_WINDOWS = RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/i
@ -38,27 +40,27 @@ module Zip
FSTYPE_ATHEOS = 30
FSTYPES = {
FSTYPE_FAT => 'FAT'.freeze,
FSTYPE_AMIGA => 'Amiga'.freeze,
FSTYPE_VMS => 'VMS (Vax or Alpha AXP)'.freeze,
FSTYPE_UNIX => 'Unix'.freeze,
FSTYPE_VM_CMS => 'VM/CMS'.freeze,
FSTYPE_ATARI => 'Atari ST'.freeze,
FSTYPE_HPFS => 'OS/2 or NT HPFS'.freeze,
FSTYPE_MAC => 'Macintosh'.freeze,
FSTYPE_Z_SYSTEM => 'Z-System'.freeze,
FSTYPE_CPM => 'CP/M'.freeze,
FSTYPE_TOPS20 => 'TOPS-20'.freeze,
FSTYPE_NTFS => 'NTFS'.freeze,
FSTYPE_QDOS => 'SMS/QDOS'.freeze,
FSTYPE_ACORN => 'Acorn RISC OS'.freeze,
FSTYPE_VFAT => 'Win32 VFAT'.freeze,
FSTYPE_MVS => 'MVS'.freeze,
FSTYPE_BEOS => 'BeOS'.freeze,
FSTYPE_TANDEM => 'Tandem NSK'.freeze,
FSTYPE_THEOS => 'Theos'.freeze,
FSTYPE_MAC_OSX => 'Mac OS/X (Darwin)'.freeze,
FSTYPE_ATHEOS => 'AtheOS'.freeze
FSTYPE_FAT => 'FAT',
FSTYPE_AMIGA => 'Amiga',
FSTYPE_VMS => 'VMS (Vax or Alpha AXP)',
FSTYPE_UNIX => 'Unix',
FSTYPE_VM_CMS => 'VM/CMS',
FSTYPE_ATARI => 'Atari ST',
FSTYPE_HPFS => 'OS/2 or NT HPFS',
FSTYPE_MAC => 'Macintosh',
FSTYPE_Z_SYSTEM => 'Z-System',
FSTYPE_CPM => 'CP/M',
FSTYPE_TOPS20 => 'TOPS-20',
FSTYPE_NTFS => 'NTFS',
FSTYPE_QDOS => 'SMS/QDOS',
FSTYPE_ACORN => 'Acorn RISC OS',
FSTYPE_VFAT => 'Win32 VFAT',
FSTYPE_MVS => 'MVS',
FSTYPE_BEOS => 'BeOS',
FSTYPE_TANDEM => 'Tandem NSK',
FSTYPE_THEOS => 'Theos',
FSTYPE_MAC_OSX => 'Mac OS/X (Darwin)',
FSTYPE_ATHEOS => 'AtheOS'
}.freeze
COMPRESSION_METHOD_STORE = 0

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Zip
class DecryptedIo #:nodoc:all
CHUNK_SIZE = 32_768

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Zip
class Encrypter #:nodoc:all
end

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Zip
module NullEncryption
def header_bytesize

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Zip
module TraditionalEncryption
def initialize(password)

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Zip
class Decompressor #:nodoc:all
CHUNK_SIZE = 32_768

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Zip
class Deflater < Compressor #:nodoc:all
def initialize(output_stream, level = Zip.default_compression, encrypter = NullEncrypter.new)

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'rubygems'
module Zip

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'pathname'
module Zip
class Entry

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Zip
class EntrySet #:nodoc:all
include Enumerable

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Zip
class Error < StandardError; end
class EntryExistsError < Error; end

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Zip
class ExtraField < Hash
ID_MAP = {}

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Zip
class ExtraField::Generic
def self.register_map

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Zip
# PKWARE NTFS Extra Field (0x000a)
# Only Tag 0x0001 is supported

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Zip
# Olf Info-ZIP Extra for UNIX uid/gid and file timestampes
class ExtraField::OldUnix < ExtraField::Generic

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Zip
# Info-ZIP Additional timestamp field
class ExtraField::UniversalTime < ExtraField::Generic

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Zip
# Info-ZIP Extra for UNIX uid/gid
class ExtraField::IUnix < ExtraField::Generic

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Zip
# Info-ZIP Extra for Zip64 size
class ExtraField::Zip64 < ExtraField::Generic

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Zip
# placeholder to reserve space for a Zip64 extra information record, for the
# local file header only, that we won't know if we'll need until after

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Zip
# ZipFile is modeled after java.util.zip.ZipFile from the Java SDK.
# The most important methods are those inherited from

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'zip'
module Zip

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Zip
class Inflater < Decompressor #:nodoc:all
def initialize(*args)

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Zip
# InputStream is the basic class for reading zip entries in a
# zip file. It is possible to create a InputStream object directly,

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Zip
module IOExtras #:nodoc:
CHUNK_SIZE = 131_072

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Zip
module IOExtras
# Implements many of the convenience methods of IO

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Zip
module IOExtras
# Implements many of the output convenience methods of IO.

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Zip
class NullCompressor < Compressor #:nodoc:all
include Singleton

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Zip
module NullDecompressor #:nodoc:all
module_function

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Zip
module NullInputStream #:nodoc:all
include ::Zip::NullDecompressor

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Zip
# ZipOutputStream is the basic class for writing zip files. It is
# possible to create a ZipOutputStream object directly, passing

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Zip
class PassThruCompressor < Compressor #:nodoc:all
def initialize(output_stream)

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Zip
class PassThruDecompressor < Decompressor #:nodoc:all
def initialize(*args)

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Zip
class StreamableDirectory < Entry
def initialize(zipfile, entry, src_path = nil, permission = nil)

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Zip
class StreamableStream < DelegateClass(Entry) # :nodoc:all
def initialize(entry)

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Zip
VERSION = '3.0.0'
end

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
lib = File.expand_path('lib', __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'zip/version'

View File

@ -1,4 +1,5 @@
#!/usr/bin/env ruby
# frozen_string_literal: true
$LOAD_PATH << '../lib'
system('zip example.zip example.rb gtk_ruby_zip.rb')

View File

@ -1,4 +1,5 @@
#!/usr/bin/env ruby
# frozen_string_literal: true
$LOAD_PATH << '../lib'

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'zip'
# This is a simple example which uses rubyzip to

View File

@ -1,4 +1,5 @@
#!/usr/bin/env ruby
# frozen_string_literal: true
$LOAD_PATH << '../lib'

View File

@ -1,4 +1,5 @@
#!/usr/bin/env ruby
# frozen_string_literal: true
$VERBOSE = true

View File

@ -1,4 +1,5 @@
#!/usr/bin/env ruby
# frozen_string_literal: true
$LOAD_PATH << '../lib'

View File

@ -1,4 +1,5 @@
#!/usr/bin/env ruby
# frozen_string_literal: true
$VERBOSE = true

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
class BasicZipFileTest < MiniTest::Test

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
class Bzip2SupportTest < MiniTest::Test

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
class ZipCaseSensitivityTest < MiniTest::Test

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
class ZipCentralDirectoryEntryTest < MiniTest::Test

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
class ZipCentralDirectoryTest < MiniTest::Test

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
class ConstantsTest < MiniTest::Test

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
class NullEncrypterTest < MiniTest::Test

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
class TraditionalEncrypterTest < MiniTest::Test

View File

@ -1,4 +1,5 @@
#!/usr/bin/env ruby
# frozen_string_literal: true
class NotZippedRuby
def return_true

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
class DecompressorTest < MiniTest::Test
TEST_COMPRESSION_METHOD = 255

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
class DeflaterTest < MiniTest::Test

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
class EncryptionTest < MiniTest::Test

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
class ZipEntrySetTest < MiniTest::Test

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
class ZipEntryTest < MiniTest::Test

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
class ErrorsTest < MiniTest::Test

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
class ZipExtraFieldTest < MiniTest::Test

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
class ZipExtraFieldUTTest < MiniTest::Test

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
class ZipFileExtractDirectoryTest < MiniTest::Test

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
class ZipFileExtractTest < MiniTest::Test

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
class FileOptionsTest < MiniTest::Test
@ -8,9 +10,9 @@ class FileOptionsTest < MiniTest::Test
EXTPATH_1 = ::File.join(Dir.tmpdir, 'extracted_1.txt').freeze
EXTPATH_2 = ::File.join(Dir.tmpdir, 'extracted_2.txt').freeze
EXTPATH_3 = ::File.join(Dir.tmpdir, 'extracted_3.txt').freeze
ENTRY_1 = 'entry_1.txt'.freeze
ENTRY_2 = 'entry_2.txt'.freeze
ENTRY_3 = 'entry_3.txt'.freeze
ENTRY_1 = 'entry_1.txt'
ENTRY_2 = 'entry_2.txt'
ENTRY_3 = 'entry_3.txt'
def teardown
::File.unlink(ZIPPATH) if ::File.exist?(ZIPPATH)

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
class FilePermissionsTest < MiniTest::Test

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
class ZipFileSplitTest < MiniTest::Test

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
class ZipFileTest < MiniTest::Test

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
require 'zip/filesystem'

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
require 'zip/filesystem'

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
require 'zip/filesystem'

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
require 'zip/filesystem'

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
require 'zip/filesystem'

View File

@ -1,4 +1,5 @@
#!/usr/bin/env ruby
# frozen_string_literal: true
$VERBOSE = true

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
class InflaterTest < MiniTest::Test
include DecompressorTests

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
class ZipInputStreamTest < MiniTest::Test

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
require 'zip/ioextras'

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
require 'zip/ioextras'

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
require 'zip/ioextras'

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
class ZipLocalEntryTest < MiniTest::Test

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
class ZipOutputStreamTest < MiniTest::Test

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
class PassThruCompressorTest < MiniTest::Test

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
class PassThruDecompressorTest < MiniTest::Test
include DecompressorTests

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
class PathTraversalTest < MiniTest::Test

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
require 'fileutils'
require_relative '../../samples/example_recursive'

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
class ZipSettingsTest < MiniTest::Test

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
class StoredSupportTest < MiniTest::Test

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'simplecov'
require 'minitest/autorun'
require 'minitest/unit'

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
class ZipUnicodeFileNamesAndComments < MiniTest::Test

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
if ENV['FULL_ZIP64_TEST']
require 'minitest/autorun'
require 'minitest/unit'

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
class Zip64SupportTest < MiniTest::Test