From 390d6597f6ceb033dbcd569fbd293e66af91fd52 Mon Sep 17 00:00:00 2001 From: esotericpig Date: Sun, 24 Jul 2022 21:27:30 -1000 Subject: [PATCH] Fix Rubocop issues --- README.md | 2 +- lib/unclekryon.rb | 4 ++-- lib/unclekryon/hacker.rb | 6 +++--- lib/unclekryon/iso/country.rb | 6 +----- lib/unclekryon/iso/language.rb | 6 +----- lib/unclekryon/iso/region.rb | 9 +-------- lib/unclekryon/iso/subregion.rb | 9 +-------- lib/unclekryon/server.rb | 8 ++++---- lib/unclekryon/trainer.rb | 7 ++----- lib/unclekryon/uploader.rb | 8 ++++---- 10 files changed, 20 insertions(+), 45 deletions(-) diff --git a/README.md b/README.md index 3bf194d..a348d7c 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ $ bundle exec rake -T [GNU GPL v3+](LICENSE) > UncleKryon-server (https://github.com/esotericpig/UncleKryon-server) -> Copyright (c) 2017-2021 Jonathan Bradley Whited +> Copyright (c) 2017-2022 Jonathan Bradley Whited > > UncleKryon-server is free software: you can redistribute it and/or modify > it under the terms of the GNU General Public License as published by diff --git a/lib/unclekryon.rb b/lib/unclekryon.rb index 1ea3999..842b9eb 100644 --- a/lib/unclekryon.rb +++ b/lib/unclekryon.rb @@ -3,7 +3,7 @@ #-- # This file is part of UncleKryon-server. -# Copyright (c) 2017-2021 Jonathan Bradley Whited +# Copyright (c) 2017-2022 Jonathan Bradley Whited # # SPDX-License-Identifier: GPL-3.0-or-later #++ @@ -355,7 +355,7 @@ def gsub_updated_on(dirname,updated_on) updated_on = Util.format_datetime(updated_on) Dir.glob(File.join(dirname,'*.yaml')) do |filepath| - lines = IO.readlines(filepath) + lines = File.readlines(filepath) update_count = 0 lines.each_with_index do |line,i| diff --git a/lib/unclekryon/hacker.rb b/lib/unclekryon/hacker.rb index a11d846..9417a47 100644 --- a/lib/unclekryon/hacker.rb +++ b/lib/unclekryon/hacker.rb @@ -3,7 +3,7 @@ #-- # This file is part of UncleKryon-server. -# Copyright (c) 2017-2021 Jonathan Bradley Whited +# Copyright (c) 2017-2022 Jonathan Bradley Whited # # SPDX-License-Identifier: GPL-3.0-or-later #++ @@ -198,7 +198,7 @@ def parse_kryon_aum_year_albums(year,begin_album=nil) if !begin_album.nil? album_index = find_kryon_aum_year_album(artist,begin_album,year,index)[1] - albums = albums[album_index..-1] + albums = albums[album_index..] end albums.each do |album_id| @@ -262,7 +262,7 @@ def train_kryon_aum_year_albums(year,begin_album=nil) if !begin_album.nil? album_index = find_kryon_aum_year_album(artist,begin_album,year,index)[1] - albums = albums[album_index..-1] + albums = albums[album_index..] end albums.each do |album_id| diff --git a/lib/unclekryon/iso/country.rb b/lib/unclekryon/iso/country.rb index e3d8e58..cbd3ff6 100644 --- a/lib/unclekryon/iso/country.rb +++ b/lib/unclekryon/iso/country.rb @@ -3,7 +3,7 @@ #-- # This file is part of UncleKryon-server. -# Copyright (c) 2018-2021 Jonathan Bradley Whited +# Copyright (c) 2018-2022 Jonathan Bradley Whited # # SPDX-License-Identifier: GPL-3.0-or-later #++ @@ -63,10 +63,6 @@ def to_s class Countries < BaseIsos DEFAULT_FILEPATH = "#{DEFAULT_DIR}/countries.yaml" - def initialize - super() - end - def self.load_file(filepath=DEFAULT_FILEPATH) return Countries.new.load_file(filepath) end diff --git a/lib/unclekryon/iso/language.rb b/lib/unclekryon/iso/language.rb index dd38c94..e4290bf 100644 --- a/lib/unclekryon/iso/language.rb +++ b/lib/unclekryon/iso/language.rb @@ -3,7 +3,7 @@ #-- # This file is part of UncleKryon-server. -# Copyright (c) 2018-2021 Jonathan Bradley Whited +# Copyright (c) 2018-2022 Jonathan Bradley Whited # # SPDX-License-Identifier: GPL-3.0-or-later #++ @@ -111,10 +111,6 @@ def to_s class Languages < BaseIsos DEFAULT_FILEPATH = "#{DEFAULT_DIR}/languages.yaml" - def initialize - super() - end - def find_by_kryon(text,add_english: false,**options) langs = [] regexes = [ diff --git a/lib/unclekryon/iso/region.rb b/lib/unclekryon/iso/region.rb index b9f9ebd..0d520d2 100644 --- a/lib/unclekryon/iso/region.rb +++ b/lib/unclekryon/iso/region.rb @@ -3,7 +3,7 @@ #-- # This file is part of UncleKryon-server. -# Copyright (c) 2018-2021 Jonathan Bradley Whited +# Copyright (c) 2018-2022 Jonathan Bradley Whited # # SPDX-License-Identifier: GPL-3.0-or-later #++ @@ -16,18 +16,11 @@ ## module UncleKryon class Region < BaseIso - def initialize - super() - end end class Regions < BaseIsos DEFAULT_FILEPATH = "#{DEFAULT_DIR}/regions.yaml" - def initialize - super() - end - def self.load_file(filepath=DEFAULT_FILEPATH) return Regions.new.load_file(filepath) end diff --git a/lib/unclekryon/iso/subregion.rb b/lib/unclekryon/iso/subregion.rb index 8dbead1..7544f94 100644 --- a/lib/unclekryon/iso/subregion.rb +++ b/lib/unclekryon/iso/subregion.rb @@ -3,7 +3,7 @@ #-- # This file is part of UncleKryon-server. -# Copyright (c) 2019-2021 Jonathan Bradley Whited +# Copyright (c) 2019-2022 Jonathan Bradley Whited # # SPDX-License-Identifier: GPL-3.0-or-later #++ @@ -16,18 +16,11 @@ ## module UncleKryon class Subregion < BaseIso - def initialize - super() - end end class Subregions < BaseIsos DEFAULT_FILEPATH = "#{DEFAULT_DIR}/subregions.yaml" - def initialize - super() - end - def self.load_file(filepath=DEFAULT_FILEPATH) return Subregions.new.load_file(filepath) end diff --git a/lib/unclekryon/server.rb b/lib/unclekryon/server.rb index 08ddcfa..7ed7b65 100644 --- a/lib/unclekryon/server.rb +++ b/lib/unclekryon/server.rb @@ -3,7 +3,7 @@ #-- # This file is part of UncleKryon-server. -# Copyright (c) 2017-2021 Jonathan Bradley Whited +# Copyright (c) 2017-2022 Jonathan Bradley Whited # # SPDX-License-Identifier: GPL-3.0-or-later #++ @@ -15,6 +15,6 @@ class Server end end -if $PROGRAM_NAME == __FILE__ - # Test here. -end +#if $PROGRAM_NAME == __FILE__ +# # Test here. +#end diff --git a/lib/unclekryon/trainer.rb b/lib/unclekryon/trainer.rb index ac72a6c..a806368 100644 --- a/lib/unclekryon/trainer.rb +++ b/lib/unclekryon/trainer.rb @@ -3,7 +3,7 @@ #-- # This file is part of UncleKryon-server. -# Copyright (c) 2017-2021 Jonathan Bradley Whited +# Copyright (c) 2017-2022 Jonathan Bradley Whited # # SPDX-License-Identifier: GPL-3.0-or-later #++ @@ -147,10 +147,7 @@ def save_to_file end Util.mk_dirs_from_filepath(@filepath) - - File.open(@filepath,'w') do |f| - f.write(to_s) - end + File.write(@filepath,to_s) end def [](id) diff --git a/lib/unclekryon/uploader.rb b/lib/unclekryon/uploader.rb index 71f4fa7..6c4ec61 100644 --- a/lib/unclekryon/uploader.rb +++ b/lib/unclekryon/uploader.rb @@ -3,7 +3,7 @@ #-- # This file is part of UncleKryon-server. -# Copyright (c) 2017-2021 Jonathan Bradley Whited +# Copyright (c) 2017-2022 Jonathan Bradley Whited # # SPDX-License-Identifier: GPL-3.0-or-later #++ @@ -15,6 +15,6 @@ class Uploader end end -if $PROGRAM_NAME == __FILE__ - # Test here. -end +#if $PROGRAM_NAME == __FILE__ +# # Test here. +#end