diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index e1e21ed2..8222dff0 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -6,15 +6,6 @@ # Note that changes in the inspected code, or installation of new # versions of RuboCop, may require this file to be generated again. -# Offense count: 7 -Lint/ShadowingOuterLocalVariable: - Exclude: - - '_contrib/updatetx.rb' - - '_plugins/contributors.rb' - - '_plugins/glossary.rb' - - '_plugins/sitemap.rb' - - '_plugins/translate.rb' - # Offense count: 10 # Cop supports --auto-correct. # Configuration parameters: IgnoreEmptyBlocks, AllowUnusedKeywordArguments. diff --git a/_contrib/updatetx.rb b/_contrib/updatetx.rb index 0f12ba18..15ceefa7 100755 --- a/_contrib/updatetx.rb +++ b/_contrib/updatetx.rb @@ -41,8 +41,8 @@ dirs.each do |dir| # Drop language in statements applied to many languages ( e.g. {% when 'ar' or 'fr' .. %} ) contents.gsub!(Regexp.new("{% when '" + lang + "' or (.*?) %}"), '{% when \1 %}') contents.gsub!(Regexp.new("{% when (.*?) or '" + lang + "' (.*?)%}"), '{% when \1 \2%}') - File.open(dir + '/' + file, 'w') do |file| - file.write(contents) + File.open(dir + '/' + file, 'w') do |f| + f.write(contents) end end end diff --git a/_plugins/contributors.rb b/_plugins/contributors.rb index a87add36..979b01fb 100644 --- a/_plugins/contributors.rb +++ b/_plugins/contributors.rb @@ -73,7 +73,7 @@ module Jekyll result.each do |key, value| contributors.push(value) end - contributors.sort_by { |c| - c['contributions'] } + contributors.sort_by { |commits| - commits['contributions'] } end def generate(site) diff --git a/_plugins/glossary.rb b/_plugins/glossary.rb index d53ecdab..0541ed05 100644 --- a/_plugins/glossary.rb +++ b/_plugins/glossary.rb @@ -134,14 +134,14 @@ module Jekyll devsearches_data_item = {} if cat == "Glossary" - items.each { |lang, list| + items.each { |language, list| list.each { |el| flat = el.flatten devsearches_json.push({ "label" => flat[0], "uri" => flat[1], "category" => cat, - "lang" => lang + "language" => language }) } # puts list diff --git a/_plugins/sitemap.rb b/_plugins/sitemap.rb index 847858d9..3c2723ae 100644 --- a/_plugins/sitemap.rb +++ b/_plugins/sitemap.rb @@ -47,13 +47,13 @@ module Jekyll sitemap.puts ' xmlns:xhtml="http://www.w3.org/1999/xhtml">' # Add translated pages with their alternative in each languages locs['en']['url'].each do |id, value| - locs.each do |lang, value| + locs.each do |lang, var| # Don't add a page if their url is not translated next if locs[lang]['url'][id].nil? or locs[lang]['url'][id] == '' sitemap.puts '' sitemap.puts ' https://bitcoin.org/' + lang + '/' + CGI::escape(locs[lang]['url'][id]) + '' - locs.each do |altlang, value| + locs.each do |altlang, altvar| next if locs[altlang]['url'][id].nil? or locs[altlang]['url'][id] == '' or altlang == lang sitemap.puts '