Enable more rubocop cops (#9980)

* Remove self.check in python3.rb as tests were not actuallly being run

* Enable Lint/ImplicitStringConcatenation cop

* Enable Layout/CommentIndentation cop

* Remove unnecessary configuration of Layout/IndentationStyle to EnforcedStyle: spaces, as this is already the default

* Enable Layout/LeadingCommentSpace cop

* Enable Layout/SpaceInsideBlockBraces cop

* Enable Layout/SpaceInsideParens cop

* Enable Layout/TrailingEmptyLines cop

* Enable Lint/LiteralAsCondition cop

* Document the current issue stopping us from enabling Style/OptionalBooleanParameter

* Stop downloading our rubocop config when installing ruby_rubocop
This commit is contained in:
Maximilian Downey Twiss
2024-06-18 06:19:11 +10:00
committed by GitHub
parent fcb36066e2
commit 33901368d7
27 changed files with 54 additions and 118 deletions

View File

@@ -20,9 +20,6 @@ AllCops:
Security/Eval:
Enabled: false
Lint/ImplicitStringConcatenation:
Enabled: false
Lint/ShadowingOuterLocalVariable:
Enabled: false
@@ -39,9 +36,6 @@ Layout/HashAlignment:
# End temporarily disabled cops
Layout/CommentIndentation:
Enabled: false
Layout/EmptyLineAfterGuardClause:
Enabled: false
@@ -49,27 +43,9 @@ Layout/FirstHashElementIndentation:
Enabled: false
# EnforcedStyle: consistent
Layout/IndentationStyle:
EnforcedStyle: spaces
Layout/LeadingCommentSpace:
Enabled: false
Layout/LineLength:
Enabled: false
Layout/SpaceInsideBlockBraces:
Enabled: false
Layout/SpaceInsideParens:
Enabled: false
Layout/TrailingEmptyLines:
Enabled: false
Lint/LiteralAsCondition:
Enabled: false
Style/RedundantReturn:
Enabled: false
@@ -88,6 +64,7 @@ Style/GuardClause:
Style/DocumentDynamicEvalDefinition:
Enabled: false
# https://github.com/rubocop/rubocop/issues/12132
Style/OptionalBooleanParameter:
Enabled: false

View File

@@ -44,4 +44,3 @@ class Command
puts "Disk usage: #{human_size(size)}".lightgreen
end
end

View File

@@ -64,4 +64,3 @@ class Command
end
end
end

View File

@@ -19,7 +19,7 @@ class Autotools < Package
end
abort 'configure script not found!'.lightred unless File.file?('configure')
FileUtils.chmod('+x', 'configure')
if `grep -q /usr/bin/file configure`
if system('grep -q /usr/bin/file configure')
puts 'Using filefix.'.orange
system 'filefix'
end

View File

@@ -54,9 +54,7 @@ class Filecmd < Package
--enable-bzlib \
--enable-xzlib \
--enable-fsect-man5 \
--disable-libseccomp" # libseccomp is disabled because
# it causes file to return "Bad system call" errors when
# not run with root.
--disable-libseccomp" # libseccomp is disabled because it causes file to return "Bad system call" errors when not run with root.
# Build a static file binary for use in case needed with glibc brokenness.
Dir.mkdir 'builddir-static'

View File

@@ -14,4 +14,3 @@ class Gcr < Package
depends_on 'gcr_3'
depends_on 'gcr_4'
end

View File

@@ -93,31 +93,6 @@ class Python3 < Package
end
end
def self.check
# Chromebooks do not allow SIGHUP, so disable SIGHUP test
system 'sed', '-i', 'Lib/test/test_asyncio/test_events.py', '-e', "/Don't have SIGHUP/s/win32/linux/"
system 'sed', '-i', 'Lib/test/test_asyncio/test_subprocess.py', '-e', "/Don't have SIGHUP/s/win32/linux/"
# Chromebooks return EINVAL for F_NOTIFY DN_MULTISHOT, so disable test_fcntl_64_bit
system 'sed', '-i', 'Lib/test/test_fcntl.py', '-e', '/ARM Linux returns EINVAL for F_NOTIFY DN_MULTISHOT/s/$/\
@unittest.skipIf(platform.system() == '"'Linux'"', "Chromeos returns EINVAL for F_NOTIFY DN_MULTISHOT")/'
# imaplib test used to use a kind of security hole on a server in university and the hole is closed now.
# See https://bugs.python.org/issue30175 and https://github.com/python/cpython/pull/1320/files for details.
system 'sed', '-i', 'Lib/test/test_imaplib.py',
'-e', '/test_logincapa_with_client_certfile/i\ \ \ \ @unittest.skipIf(True,\
"bpo-30175: FIXME: cyrus.andrew.cmu.edu doesn\'t accept "\
"our randomly generated client x509 certificate anymore")',
'-e', '/test_logincapa_with_client_ssl_context/i\ \ \ \ @unittest.skipIf(True,\
"bpo-30175: FIXME: cyrus.andrew.cmu.edu doesn\'t accept "\
"our randomly generated client x509 certificate anymore")'
# Using /tmp breaks test_distutils, test_subprocess
# Proxy setting breaks test_httpservers, test_ssl,
# test_urllib, test_urllib2, test_urllib2_localnet
# system "http_proxy= https_proxy= ftp_proxy= make test"
end
def self.install
Dir.chdir 'builddir' do
system 'make', "DESTDIR=#{CREW_DEST_DIR}", 'install'

View File

@@ -9,8 +9,7 @@ class Ruby_rubocop < RUBY
version '1.63.2-ruby-3.3'
license 'MIT'
compatibility 'all'
source_url 'https://github.com/chromebrew/chromebrew/raw/master/.rubocop.yml'
source_sha256 '38f6c68465c7224bdd7bcb1b37f7b49283f46def71dc56553069e749afab4b85'
source_url 'SKIP'
depends_on 'libyaml'
depends_on 'xdg_base'
@@ -18,14 +17,4 @@ class Ruby_rubocop < RUBY
conflicts_ok
no_compile_needed
no_fhs
ruby_install_extras <<~EOF
FileUtils.mkdir_p "#{CREW_DEST_PREFIX}/.config/rubocop/" if Gem::Version.new(RUBY_VERSION.to_s) < Gem::Version.new('3.3')
FileUtils.install '.rubocop.yml', "#{CREW_DEST_PREFIX}/.config/rubocop/config.yml", mode: 0o644
EOF
def self.postinstall
puts "Chromebrew rubocop config file was installed at #{CREW_PREFIX}/.config/rubocop/config.yml".lightblue
puts 'This can be overridden by a ~/.rubocop.yml'.lightblue
end
end