Yet more Rubocopping

This commit is contained in:
Maruno17
2021-12-23 00:27:17 +00:00
parent 514fe13ca2
commit 132a16950d
171 changed files with 1455 additions and 1647 deletions

View File

@@ -39,10 +39,10 @@ module FileLineData
def self.linereport
if @section
if @key != nil
return _INTL("File {1}, section {2}, key {3}\r\n{4}\r\n\r\n", @file, @section, @key, @value)
else
if @key.nil?
return _INTL("File {1}, section {2}\r\n{3}\r\n\r\n", @file, @section, @value)
else
return _INTL("File {1}, section {2}, key {3}\r\n{4}\r\n\r\n", @file, @section, @key, @value)
end
else
return _INTL("File {1}, line {2}\r\n{3}\r\n\r\n", @file, @lineno, @linedata)
@@ -79,7 +79,7 @@ module Compiler
def csvQuote(str, always = false)
return "" if nil_or_empty?(str)
if always || str[/[,\"]/] # || str[/^\s/] || str[/\s$/] || str[/^#/]
str = str.gsub(/[\"]/, "\\\"")
str = str.gsub(/\"/, "\\\"")
str = "\"#{str}\""
end
return str
@@ -110,7 +110,7 @@ module Compiler
havesection = true
lastsection = {}
else
if sectionname == nil
if sectionname.nil?
FileLineData.setLine(line, lineno)
raise _INTL("Expected a section at the beginning of the file. This error may also occur if the file was not saved in UTF-8.\r\n{1}", FileLineData.linereport)
end
@@ -168,7 +168,7 @@ module Compiler
lastsection = []
havesection = true
else
if sectionname == nil
if sectionname.nil?
raise _INTL("Expected a section at the beginning of the file (line {1}). Sections begin with '[name of section]'", lineno)
end
lastsection.push(line.gsub(/^\s+/, "").gsub(/\s+$/, ""))
@@ -366,7 +366,7 @@ module Compiler
return idx
when Hash
value = enumer[ret]
if value == nil
if value.nil?
raise _INTL("Undefined value {1} (expected one of: {2})\r\n{3}", ret, enumer.keys.inspect, FileLineData.linereport)
end
return value
@@ -597,10 +597,10 @@ module Compiler
enumer = schema[2 + i]
case enumer
when Array
if enumer[value] != nil
file.write(enumer[value])
else
if enumer[value].nil?
file.write(value)
else
file.write(enumer[value])
end
when Symbol, String
mod = Object.const_get(enumer.to_sym)
@@ -864,7 +864,7 @@ module Compiler
compile_all(mustCompile)
rescue Exception
e = $!
raise e if "#{e.class}" == "Reset" || e.is_a?(Reset) || e.is_a?(SystemExit)
raise e if e.class.to_s == "Reset" || e.is_a?(Reset) || e.is_a?(SystemExit)
pbPrintException(e)
dataFiles.length.times do |i|
begin

View File

@@ -785,7 +785,7 @@ module Compiler
raise _INTL("Species ID '{1}' is not defined in {2}.\r\n{3}", species_symbol, path, FileLineData.linereport)
elsif form == 0
raise _INTL("A form cannot be defined with a form number of 0.\r\n{1}", FileLineData.linereport)
elsif used_forms[species_symbol] && used_forms[species_symbol].include?(form)
elsif used_forms[species_symbol]&.include?(form)
raise _INTL("Form {1} for species ID {2} is defined twice.\r\n{3}", form, species_symbol, FileLineData.linereport)
end
used_forms[species_symbol] = [] if !used_forms[species_symbol]

View File

@@ -542,7 +542,7 @@ module Compiler
current_family = nil
list.each do |species|
next if !species
if current_family && current_family.include?(species)
if current_family&.include?(species)
f.write(",") if comma
else
current_family = GameData::Species.get(species).get_family_species
@@ -739,7 +739,7 @@ module Compiler
btTrainersRequiredTypes.keys.each do |key|
schema = btTrainersRequiredTypes[key]
record = bttrainers[i][schema[0]]
next if record == nil
next if record.nil?
f.write(sprintf("%s = ", key))
case key
when "Type"

View File

@@ -134,7 +134,7 @@ module Compiler
end
def push_event(list, cmd, params = nil, indent = 0)
list.push(RPG::EventCommand.new(cmd, indent, params ? params : []))
list.push(RPG::EventCommand.new(cmd, indent, params || []))
end
def push_end(list)
@@ -353,7 +353,7 @@ module Compiler
priorities = getTilesetPriorities(map, mapID)
[2, 1, 0].each do |i|
tile_id = map.data[x, y, i]
return false if tile_id == nil
return false if tile_id.nil?
passage = passages[tile_id]
if !passage
raise "The tile used on map #{mapID} at coordinates (#{x}, #{y}) on layer #{i + 1} doesn't exist in the tileset. " +
@@ -371,7 +371,7 @@ module Compiler
passages = getTilesetPassages(map, mapID)
[2, 1, 0].each do |i|
tile_id = map.data[x, y, i]
return false if tile_id == nil
return false if tile_id.nil?
passage = passages[tile_id]
if !passage
raise "The tile used on map #{mapID} at coordinates (#{x}, #{y}) on layer #{i + 1} doesn't exist in the tileset. " +