Skip to content

Freeze all Ruby string literals #190

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
# frozen_string_literal: true

source 'https://rubygems.org'
gemspec name: 'classifier-reborn'
2 changes: 2 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'rubygems'
require 'rake'
require 'rake/testtask'
Expand Down
4 changes: 3 additions & 1 deletion classifier-reborn-jruby.gemspec
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

lib = File.expand_path('lib', __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'classifier-reborn/version'
Expand All @@ -7,7 +9,7 @@ Gem::Specification.new do |s|
s.specification_version = 2 if s.respond_to? :specification_version=
s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to? :required_rubygems_version=
s.rubygems_version = '2.2.2'
s.required_ruby_version = '>= 2.2'
s.required_ruby_version = '>= 2.4.0'

s.name = 'classifier-reborn-jruby'
s.version = ClassifierReborn::VERSION
Expand Down
4 changes: 3 additions & 1 deletion classifier-reborn.gemspec
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

lib = File.expand_path('lib', __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'classifier-reborn/version'
Expand All @@ -6,7 +8,7 @@ Gem::Specification.new do |s|
s.specification_version = 2 if s.respond_to? :specification_version=
s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to? :required_rubygems_version=
s.rubygems_version = '2.2.2'
s.required_ruby_version = '>= 2.2'
s.required_ruby_version = '>= 2.4.0'

s.name = 'classifier-reborn'
s.version = ClassifierReborn::VERSION
Expand Down
2 changes: 2 additions & 0 deletions lib/classifier-reborn.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

#--
# Copyright (c) 2005 Lucas Carlson
#
Expand Down
2 changes: 2 additions & 0 deletions lib/classifier-reborn/backends/bayes_memory_backend.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module ClassifierReborn
class BayesMemoryBackend
attr_reader :total_words, :total_trainings
Expand Down
2 changes: 2 additions & 0 deletions lib/classifier-reborn/backends/bayes_redis_backend.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require_relative 'no_redis_error'
# require redis when we run #intialize. This way only people using this backend
# will need to install and load the backend without having to
Expand Down
2 changes: 2 additions & 0 deletions lib/classifier-reborn/backends/no_redis_error.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

class NoRedisError < RuntimeError
def initialize
msg =
Expand Down
2 changes: 2 additions & 0 deletions lib/classifier-reborn/bayes.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# Author:: Lucas Carlson (mailto:[email protected])
# Copyright:: Copyright (c) 2005 Lucas Carlson
# License:: LGPL
Expand Down
2 changes: 2 additions & 0 deletions lib/classifier-reborn/category_namer.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# Author:: Lucas Carlson (mailto:[email protected])
# Copyright:: Copyright (c) 2005 Lucas Carlson
# License:: LGPL
Expand Down
2 changes: 2 additions & 0 deletions lib/classifier-reborn/extensions/hasher.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# Author:: Lucas Carlson (mailto:[email protected])
# Copyright:: Copyright (c) 2005 Lucas Carlson
# License:: LGPL
Expand Down
2 changes: 2 additions & 0 deletions lib/classifier-reborn/extensions/token_filter/stemmer.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# Author:: Lucas Carlson (mailto:[email protected])
# Copyright:: Copyright (c) 2005 Lucas Carlson
# License:: LGPL
Expand Down
2 changes: 2 additions & 0 deletions lib/classifier-reborn/extensions/token_filter/stopword.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# Author:: Lucas Carlson (mailto:[email protected])
# Copyright:: Copyright (c) 2005 Lucas Carlson
# License:: LGPL
Expand Down
2 changes: 2 additions & 0 deletions lib/classifier-reborn/extensions/token_filter/symbol.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# Author:: Lucas Carlson (mailto:[email protected])
# Copyright:: Copyright (c) 2005 Lucas Carlson
# License:: LGPL
Expand Down
2 changes: 2 additions & 0 deletions lib/classifier-reborn/extensions/tokenizer/token.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# Author:: Lucas Carlson (mailto:[email protected])
# Copyright:: Copyright (c) 2005 Lucas Carlson
# License:: LGPL
Expand Down
2 changes: 2 additions & 0 deletions lib/classifier-reborn/extensions/tokenizer/whitespace.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# Author:: Lucas Carlson (mailto:[email protected])
# Copyright:: Copyright (c) 2005 Lucas Carlson
# License:: LGPL
Expand Down
2 changes: 2 additions & 0 deletions lib/classifier-reborn/extensions/vector.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# Author:: Ernest Ellingson
# Copyright:: Copyright (c) 2005

Expand Down
2 changes: 2 additions & 0 deletions lib/classifier-reborn/extensions/vector_serialize.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module GSL
class Vector
def _dump(_v)
Expand Down
2 changes: 2 additions & 0 deletions lib/classifier-reborn/extensions/zero_vector.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

class Vector
def zero?
all?(&:zero?)
Expand Down
2 changes: 2 additions & 0 deletions lib/classifier-reborn/lsi.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# Author:: David Fayram (mailto:[email protected])
# Copyright:: Copyright (c) 2005 David Fayram II
# License:: LGPL
Expand Down
2 changes: 2 additions & 0 deletions lib/classifier-reborn/lsi/cached_content_node.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# Author:: Kelley Reynolds (mailto:[email protected])
# Copyright:: Copyright (c) 2015 Kelley Reynolds
# License:: LGPL
Expand Down
2 changes: 2 additions & 0 deletions lib/classifier-reborn/lsi/content_node.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# Author:: David Fayram (mailto:[email protected])
# Copyright:: Copyright (c) 2005 David Fayram II
# License:: LGPL
Expand Down
2 changes: 2 additions & 0 deletions lib/classifier-reborn/lsi/summarizer.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# Author:: Lucas Carlson (mailto:[email protected])
# Copyright:: Copyright (c) 2005 Lucas Carlson
# License:: LGPL
Expand Down
2 changes: 2 additions & 0 deletions lib/classifier-reborn/lsi/word_list.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# Author:: David Fayram (mailto:[email protected])
# Copyright:: Copyright (c) 2005 David Fayram II
# License:: LGPL
Expand Down
2 changes: 2 additions & 0 deletions lib/classifier-reborn/validators/classifier_validator.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module ClassifierReborn
module ClassifierValidator
module_function
Expand Down
4 changes: 3 additions & 1 deletion lib/classifier-reborn/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module ClassifierReborn
VERSION = '2.2.0'.freeze
VERSION = '2.2.0'
end
2 changes: 2 additions & 0 deletions test/backends/backend_common_tests.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module BackendCommonTests
def test_initial_values
assert @backend.total_words.zero?
Expand Down
2 changes: 2 additions & 0 deletions test/backends/backend_memory_test.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require File.dirname(__FILE__) + '/../test_helper'
require_relative './backend_common_tests'

Expand Down
2 changes: 2 additions & 0 deletions test/backends/backend_redis_test.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require File.dirname(__FILE__) + '/../test_helper'
require_relative './backend_common_tests'

Expand Down
2 changes: 2 additions & 0 deletions test/bayes/bayesian_common_benchmarks.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module BayesianCommonBenchmarks
MAX_RECORDS = 5000

Expand Down
2 changes: 2 additions & 0 deletions test/bayes/bayesian_common_tests.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module BayesianCommonTests
def test_good_training
assert_equal ['love'], @classifier.train_interesting('love')
Expand Down
2 changes: 2 additions & 0 deletions test/bayes/bayesian_integration_test.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require File.dirname(__FILE__) + '/../test_helper'
require_relative '../data/test_data_loader'

Expand Down
2 changes: 2 additions & 0 deletions test/bayes/bayesian_memory_benchmark.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require File.dirname(__FILE__) + '/../test_helper'
require_relative './bayesian_common_benchmarks'
require_relative '../data/test_data_loader'
Expand Down
2 changes: 2 additions & 0 deletions test/bayes/bayesian_memory_test.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require File.dirname(__FILE__) + '/../test_helper'
require_relative './bayesian_common_tests'

Expand Down
2 changes: 2 additions & 0 deletions test/bayes/bayesian_redis_benchmark.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require File.dirname(__FILE__) + '/../test_helper'
require_relative './bayesian_common_benchmarks'
require_relative '../data/test_data_loader'
Expand Down
2 changes: 2 additions & 0 deletions test/bayes/bayesian_redis_test.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require File.dirname(__FILE__) + '/../test_helper'
require_relative './bayesian_common_tests'

Expand Down
2 changes: 2 additions & 0 deletions test/data/test_data_loader.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module TestDataLoader
def self.sms_data
@@sms_data ||= load_sms_data
Expand Down
2 changes: 2 additions & 0 deletions test/extensions/hasher_test.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require_relative '../test_helper'
require 'tempfile'

Expand Down
2 changes: 2 additions & 0 deletions test/extensions/matrix_test.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

class MatrixTest < Minitest::Test
def test_zero_division
matrix = Matrix[[1, 0], [0, 1]]
Expand Down
2 changes: 2 additions & 0 deletions test/extensions/token_filter/stemmer_test.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require_relative '../../test_helper'
require 'tempfile'

Expand Down
2 changes: 2 additions & 0 deletions test/extensions/token_filter/stopword_test.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require_relative '../../test_helper'
require 'tempfile'

Expand Down
2 changes: 2 additions & 0 deletions test/extensions/token_filter/symbol_test.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require_relative '../../test_helper'
require 'tempfile'

Expand Down
2 changes: 2 additions & 0 deletions test/extensions/tokenizer/token_test.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require_relative '../../test_helper'
require 'tempfile'

Expand Down
2 changes: 2 additions & 0 deletions test/extensions/tokenizer/whitespace_test.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require_relative '../../test_helper'
require 'tempfile'

Expand Down
2 changes: 2 additions & 0 deletions test/extensions/zero_vector_test.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

class ZeroVectorTest < Minitest::Test
def test_zero?
vec0 = Vector[]
Expand Down
2 changes: 2 additions & 0 deletions test/lsi/lsi_test.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require File.dirname(__FILE__) + '/../test_helper'

class LSITest < Minitest::Test
Expand Down
2 changes: 2 additions & 0 deletions test/lsi/word_list_test.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require_relative '../test_helper'

class WordListTest < Minitest::Test
Expand Down
2 changes: 2 additions & 0 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

$LOAD_PATH.unshift(File.dirname(__FILE__) + '/../lib')

require 'minitest/autorun'
Expand Down
2 changes: 2 additions & 0 deletions test/validators/classifier_validation.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require File.dirname(__FILE__) + '/../test_helper'
require File.dirname(__FILE__) + '/../../lib/classifier-reborn/validators/classifier_validator'
require_relative '../data/test_data_loader'
Expand Down