diff --git a/.rubocop.yml b/.rubocop.yml index fdf5cb2..2756af9 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -10,6 +10,10 @@ inherit_gem: AllCops: TargetRubyVersion: 3.2 + Include: + - libexec/quran-json/* + - lib/quran-json/**/*.rb + - bin/* ## # Enabled cops @@ -24,5 +28,3 @@ Layout/ArgumentAlignment: Enabled: false Style/LambdaCall: Enabled: false -Style/FrozenStringLiteralComment: - Enabled: false diff --git a/bin/quran-json b/bin/quran-json index 4421660..b4a4dc8 100755 --- a/bin/quran-json +++ b/bin/quran-json @@ -1,4 +1,6 @@ #!/usr/bin/env ruby +# frozen_string_literal: true + require "json" ## diff --git a/lib/quran-json/quran/json.rb b/lib/quran-json/quran/json.rb index 82586a3..904af9e 100644 --- a/lib/quran-json/quran/json.rb +++ b/lib/quran-json/quran/json.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Quran module JSON require_relative "json/cmd" diff --git a/lib/quran-json/quran/json/cmd.rb b/lib/quran-json/quran/json/cmd.rb index 74ca78c..8e97934 100644 --- a/lib/quran-json/quran/json/cmd.rb +++ b/lib/quran-json/quran/json/cmd.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Quran::JSON::Cmd require "ryo" require "json" diff --git a/lib/quran-json/quran/json/pull.rb b/lib/quran-json/quran/json/pull.rb index 15f95ed..f49bca9 100644 --- a/lib/quran-json/quran/json/pull.rb +++ b/lib/quran-json/quran/json/pull.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Quran::JSON::Pull require "ryo" require "json" @@ -43,7 +45,7 @@ class Quran::JSON::Pull def write(surah_no, rows) mkdir_p(locale_dir) - rows[0] = Ryo.table_of(metadata[surah_no-1]) + rows[0] = Ryo.table_of(metadata[surah_no - 1]) write_json File.join(locale_dir, "#{surah_no}.json"), rows end @@ -100,8 +102,6 @@ class Quran::JSON::Pull end def sources - @sources ||= Ryo.from( - JSON.parse File.binread(File.join(data_dir, "sources.json")) - ) + @sources ||= Ryo.from read_json(File.join(data_dir, "sources.json")) end end diff --git a/libexec/quran-json/quran.com b/libexec/quran-json/quran.com index 128cf73..fed4fef 100755 --- a/libexec/quran-json/quran.com +++ b/libexec/quran-json/quran.com @@ -1,4 +1,6 @@ #!/usr/bin/env ruby +# frozen_string_literal: true + lib_dir = File.realpath File.join(__dir__, "..", "..", "lib", "quran-json") require File.join(lib_dir, "quran", "json") require "optparse" diff --git a/libexec/quran-json/www.searchtruth.com b/libexec/quran-json/www.searchtruth.com index b6ac15c..5687f6d 100755 --- a/libexec/quran-json/www.searchtruth.com +++ b/libexec/quran-json/www.searchtruth.com @@ -1,4 +1,6 @@ #!/usr/bin/env ruby +# frozen_string_literal: true + lib_dir = File.realpath File.join(__dir__, "..", "..", "lib", "quran-json") require File.join(lib_dir, "quran", "json") require "optparse"