LittleWeasel 3.0.4 → 5.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (153) hide show
  1. checksums.yaml +5 -5
  2. data/.github/workflows/codeql-analysis.yml +72 -0
  3. data/.gitignore +19 -17
  4. data/.reek.yml +17 -0
  5. data/.rspec +4 -2
  6. data/.rubocop.yml +187 -0
  7. data/.ruby-version +1 -1
  8. data/.yardopts +2 -0
  9. data/CHANGELOG.md +21 -1
  10. data/Gemfile +3 -1
  11. data/Gemfile.lock +114 -0
  12. data/Jenkinsfile +20 -0
  13. data/LittleWeasel.gemspec +31 -18
  14. data/README.md +408 -42
  15. data/Rakefile +296 -3
  16. data/lib/LittleWeasel/block_results.rb +81 -0
  17. data/lib/LittleWeasel/configure.rb +98 -0
  18. data/lib/LittleWeasel/dictionary.rb +125 -0
  19. data/lib/LittleWeasel/dictionary_key.rb +48 -0
  20. data/lib/LittleWeasel/dictionary_manager.rb +91 -0
  21. data/lib/LittleWeasel/errors/dictionary_file_already_loaded_error.rb +9 -0
  22. data/lib/LittleWeasel/errors/dictionary_file_empty_error.rb +8 -0
  23. data/lib/LittleWeasel/errors/dictionary_file_not_found_error.rb +8 -0
  24. data/lib/LittleWeasel/errors/dictionary_file_too_large_error.rb +16 -0
  25. data/lib/LittleWeasel/errors/language_required_error.rb +8 -0
  26. data/lib/LittleWeasel/errors/must_override_error.rb +8 -0
  27. data/lib/LittleWeasel/filters/en_us/currency_filter.rb +19 -0
  28. data/lib/LittleWeasel/filters/en_us/numeric_filter.rb +19 -0
  29. data/lib/LittleWeasel/filters/en_us/single_character_word_filter.rb +21 -0
  30. data/lib/LittleWeasel/filters/word_filter.rb +59 -0
  31. data/lib/LittleWeasel/filters/word_filter_managable.rb +80 -0
  32. data/lib/LittleWeasel/filters/word_filter_validatable.rb +31 -0
  33. data/lib/LittleWeasel/filters/word_filterable.rb +19 -0
  34. data/lib/LittleWeasel/filters/word_filters_validatable.rb +29 -0
  35. data/lib/LittleWeasel/metadata/dictionary_metadata.rb +145 -0
  36. data/lib/LittleWeasel/metadata/invalid_words_metadata.rb +134 -0
  37. data/lib/LittleWeasel/metadata/invalid_words_service_results.rb +45 -0
  38. data/lib/LittleWeasel/metadata/metadata_observable_validatable.rb +22 -0
  39. data/lib/LittleWeasel/metadata/metadata_observerable.rb +90 -0
  40. data/lib/LittleWeasel/metadata/metadatable.rb +134 -0
  41. data/lib/LittleWeasel/modules/class_name_to_symbol.rb +26 -0
  42. data/lib/LittleWeasel/modules/configurable.rb +26 -0
  43. data/lib/LittleWeasel/modules/deep_dup.rb +11 -0
  44. data/lib/LittleWeasel/modules/dictionary_cache_keys.rb +34 -0
  45. data/lib/LittleWeasel/modules/dictionary_cache_servicable.rb +26 -0
  46. data/lib/LittleWeasel/modules/dictionary_cache_validatable.rb +18 -0
  47. data/lib/LittleWeasel/modules/dictionary_creator_servicable.rb +27 -0
  48. data/lib/LittleWeasel/modules/dictionary_file_loader.rb +67 -0
  49. data/lib/LittleWeasel/modules/dictionary_key_validatable.rb +17 -0
  50. data/lib/LittleWeasel/modules/dictionary_keyable.rb +24 -0
  51. data/lib/LittleWeasel/modules/dictionary_metadata_servicable.rb +29 -0
  52. data/lib/LittleWeasel/modules/dictionary_metadata_validatable.rb +15 -0
  53. data/lib/LittleWeasel/modules/dictionary_source_validatable.rb +15 -0
  54. data/lib/LittleWeasel/modules/dictionary_sourceable.rb +86 -0
  55. data/lib/LittleWeasel/modules/dictionary_validatable.rb +18 -0
  56. data/lib/LittleWeasel/modules/language.rb +24 -0
  57. data/lib/LittleWeasel/modules/language_validatable.rb +14 -0
  58. data/lib/LittleWeasel/modules/locale.rb +23 -0
  59. data/lib/LittleWeasel/modules/order_validatable.rb +16 -0
  60. data/lib/LittleWeasel/modules/orderable.rb +17 -0
  61. data/lib/LittleWeasel/modules/region.rb +24 -0
  62. data/lib/LittleWeasel/modules/region_validatable.rb +14 -0
  63. data/lib/LittleWeasel/modules/tag_validatable.rb +14 -0
  64. data/lib/LittleWeasel/modules/taggable.rb +31 -0
  65. data/lib/LittleWeasel/modules/word_results_validatable.rb +28 -0
  66. data/lib/LittleWeasel/preprocessors/en_us/capitalize_preprocessor.rb +22 -0
  67. data/lib/LittleWeasel/preprocessors/preprocessed_word.rb +29 -0
  68. data/lib/LittleWeasel/preprocessors/preprocessed_word_validatable.rb +56 -0
  69. data/lib/LittleWeasel/preprocessors/preprocessed_words.rb +59 -0
  70. data/lib/LittleWeasel/preprocessors/preprocessed_words_validatable.rb +28 -0
  71. data/lib/LittleWeasel/preprocessors/word_preprocessable.rb +19 -0
  72. data/lib/LittleWeasel/preprocessors/word_preprocessor.rb +123 -0
  73. data/lib/LittleWeasel/preprocessors/word_preprocessor_managable.rb +114 -0
  74. data/lib/LittleWeasel/preprocessors/word_preprocessor_validatable.rb +40 -0
  75. data/lib/LittleWeasel/preprocessors/word_preprocessors_validatable.rb +24 -0
  76. data/lib/LittleWeasel/services/dictionary_cache_service.rb +211 -0
  77. data/lib/LittleWeasel/services/dictionary_creator_service.rb +94 -0
  78. data/lib/LittleWeasel/services/dictionary_file_loader_service.rb +37 -0
  79. data/lib/LittleWeasel/services/dictionary_killer_service.rb +35 -0
  80. data/lib/LittleWeasel/services/dictionary_metadata_service.rb +116 -0
  81. data/lib/LittleWeasel/services/invalid_words_service.rb +59 -0
  82. data/lib/LittleWeasel/version.rb +3 -1
  83. data/lib/LittleWeasel/word_results.rb +146 -0
  84. data/lib/LittleWeasel.rb +72 -186
  85. data/spec/factories/dictionary.rb +43 -0
  86. data/spec/factories/dictionary_cache_service.rb +95 -0
  87. data/spec/factories/dictionary_creator_service.rb +16 -0
  88. data/spec/factories/dictionary_file_loader_service.rb +13 -0
  89. data/spec/factories/dictionary_hash.rb +39 -0
  90. data/spec/factories/dictionary_key.rb +14 -0
  91. data/spec/factories/dictionary_killer_service.rb +14 -0
  92. data/spec/factories/dictionary_manager.rb +10 -0
  93. data/spec/factories/dictionary_metadata.rb +16 -0
  94. data/spec/factories/dictionary_metadata_service.rb +16 -0
  95. data/spec/factories/numeric_filter.rb +12 -0
  96. data/spec/factories/preprocessed_word.rb +16 -0
  97. data/spec/factories/preprocessed_words.rb +41 -0
  98. data/spec/factories/single_character_word_filter.rb +12 -0
  99. data/spec/factories/word_results.rb +16 -0
  100. data/spec/lib/LittleWeasel/block_results_spec.rb +248 -0
  101. data/spec/lib/LittleWeasel/configure_spec.rb +74 -0
  102. data/spec/lib/LittleWeasel/dictionary_key_spec.rb +118 -0
  103. data/spec/lib/LittleWeasel/dictionary_manager_spec.rb +166 -0
  104. data/spec/lib/LittleWeasel/dictionary_spec.rb +289 -0
  105. data/spec/lib/LittleWeasel/filters/en_us/currency_filter_spec.rb +80 -0
  106. data/spec/lib/LittleWeasel/filters/en_us/numeric_filter_spec.rb +66 -0
  107. data/spec/lib/LittleWeasel/filters/en_us/single_character_word_filter_spec.rb +58 -0
  108. data/spec/lib/LittleWeasel/filters/word_filter_managable_spec.rb +180 -0
  109. data/spec/lib/LittleWeasel/filters/word_filter_spec.rb +151 -0
  110. data/spec/lib/LittleWeasel/filters/word_filter_validatable_spec.rb +94 -0
  111. data/spec/lib/LittleWeasel/filters/word_filters_validatable_spec.rb +48 -0
  112. data/spec/lib/LittleWeasel/integraton_tests/dictionary_integration_spec.rb +201 -0
  113. data/spec/lib/LittleWeasel/metadata/dictionary_creator_servicable_spec.rb +54 -0
  114. data/spec/lib/LittleWeasel/metadata/dictionary_metadata_spec.rb +209 -0
  115. data/spec/lib/LittleWeasel/metadata/invalid_words_metadata_spec.rb +155 -0
  116. data/spec/lib/LittleWeasel/metadata/metadata_observerable_spec.rb +31 -0
  117. data/spec/lib/LittleWeasel/metadata/metadatable_spec.rb +35 -0
  118. data/spec/lib/LittleWeasel/modules/class_name_to_symbol_spec.rb +21 -0
  119. data/spec/lib/LittleWeasel/modules/dictionary_file_loader_spec.rb +125 -0
  120. data/spec/lib/LittleWeasel/modules/dictionary_sourceable_spec.rb +81 -0
  121. data/spec/lib/LittleWeasel/modules/language_spec.rb +112 -0
  122. data/spec/lib/LittleWeasel/modules/locale_spec.rb +95 -0
  123. data/spec/lib/LittleWeasel/modules/region_spec.rb +112 -0
  124. data/spec/lib/LittleWeasel/preprocessors/en_us/capitalize_preprocessor_spec.rb +34 -0
  125. data/spec/lib/LittleWeasel/preprocessors/preprocessed_word_spec.rb +105 -0
  126. data/spec/lib/LittleWeasel/preprocessors/preprocessed_word_validatable_spec.rb +143 -0
  127. data/spec/lib/LittleWeasel/preprocessors/preprocessed_words_spec.rb +77 -0
  128. data/spec/lib/LittleWeasel/preprocessors/preprocessed_words_validatable_spec.rb +58 -0
  129. data/spec/lib/LittleWeasel/preprocessors/word_preprocessor_managable_spec.rb +242 -0
  130. data/spec/lib/LittleWeasel/preprocessors/word_preprocessor_spec.rb +218 -0
  131. data/spec/lib/LittleWeasel/preprocessors/word_preprocessor_validatable_spec.rb +109 -0
  132. data/spec/lib/LittleWeasel/preprocessors/word_preprocessors_validatable_spec.rb +49 -0
  133. data/spec/lib/LittleWeasel/services/dictionary_cache_service_spec.rb +444 -0
  134. data/spec/lib/LittleWeasel/services/dictionary_creator_service_spec.rb +119 -0
  135. data/spec/lib/LittleWeasel/services/dictionary_file_loader_service_spec.rb +71 -0
  136. data/spec/lib/LittleWeasel/services/dictionary_metadata_service_spec.rb +279 -0
  137. data/spec/lib/LittleWeasel/word_results_spec.rb +275 -0
  138. data/spec/lib/LittleWeasel/workflow/workflow_spec.rb +20 -0
  139. data/spec/spec_helper.rb +117 -6
  140. data/spec/support/factory_bot.rb +15 -0
  141. data/spec/support/file_helpers.rb +46 -0
  142. data/spec/support/files/empty-dictionary.txt +0 -0
  143. data/{lib/dictionary → spec/support/files/en-US-big.txt} +262156 -31488
  144. data/spec/support/files/en-US-tagged.txt +26 -0
  145. data/spec/support/files/en-US.txt +26 -0
  146. data/spec/support/files/en.txt +26 -0
  147. data/spec/support/files/es-ES.txt +27 -0
  148. data/spec/support/files/es.txt +27 -0
  149. data/spec/support/general_helpers.rb +68 -0
  150. data/spec/support/shared_contexts.rb +107 -0
  151. data/spec/support/shared_examples.rb +105 -0
  152. metadata +418 -70
  153. data/spec/checker/checker_spec.rb +0 -286
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: df58b4978d62918800204788d128be7549284bee
4
- data.tar.gz: 9a023735953290cea1a6e8f52f14110d86ee8d64
2
+ SHA256:
3
+ metadata.gz: 99ff1b68a2ef5252c7db91a9407b9f580c41fcf994b9f139e3f0df05a3a747bc
4
+ data.tar.gz: 107edfb03a8a9b60a2701005175b6352b699279abb0d3d11f9f1708df09755cc
5
5
  SHA512:
6
- metadata.gz: 67e12da5910b23fcf50a2a8d3f3fcc28c1c31d87dd3e1df05727359b1ddb362f95c917e00646d568b0d1558530a7379b1b7eb3ee6eb2a8d321d2282b093fd984
7
- data.tar.gz: 2155e97a76545a9b5608b7ae7d7cf12c8bb0b26403d1ad7435a42efabc0ae332e6c19775a63910488341222e4e7fb2764c0efc8f3383a126cd2c05c41ab53e72
6
+ metadata.gz: 0fafbb1416486a516734f2ea08bc464a797bb63ed14388ed837e3f812cfe0e9bb600aa9b36b0608eb196ae18a4bb6f49423b2594a3ac565ef3ecece8e9733bec
7
+ data.tar.gz: c8dc7d656636e4dc17a32341c324cd7c0e83271251b355c6ac1e1cc87746088745251e32d4cc9352f5cd296829abe2b3fac491d4b201b10cb66c6a45fb99fe63
@@ -0,0 +1,72 @@
1
+ # For most projects, this workflow file will not need changing; you simply need
2
+ # to commit it to your repository.
3
+ #
4
+ # You may wish to alter this file to override the set of languages analyzed,
5
+ # or to provide custom queries or build logic.
6
+ #
7
+ # ******** NOTE ********
8
+ # We have attempted to detect the languages in your repository. Please check
9
+ # the `language` matrix defined below to confirm you have the correct set of
10
+ # supported CodeQL languages.
11
+ #
12
+ name: "CodeQL"
13
+
14
+ on:
15
+ push:
16
+ branches: [ "master" ]
17
+ pull_request:
18
+ # The branches below must be a subset of the branches above
19
+ branches: [ "master" ]
20
+ schedule:
21
+ - cron: '38 19 * * 0'
22
+
23
+ jobs:
24
+ analyze:
25
+ name: Analyze
26
+ runs-on: ubuntu-latest
27
+ permissions:
28
+ actions: read
29
+ contents: read
30
+ security-events: write
31
+
32
+ strategy:
33
+ fail-fast: false
34
+ matrix:
35
+ language: [ 'ruby' ]
36
+ # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
37
+ # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
38
+
39
+ steps:
40
+ - name: Checkout repository
41
+ uses: actions/checkout@v3
42
+
43
+ # Initializes the CodeQL tools for scanning.
44
+ - name: Initialize CodeQL
45
+ uses: github/codeql-action/init@v2
46
+ with:
47
+ languages: ${{ matrix.language }}
48
+ # If you wish to specify custom queries, you can do so here or in a config file.
49
+ # By default, queries listed here will override any specified in a config file.
50
+ # Prefix the list here with "+" to use these queries and those in the config file.
51
+
52
+ # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
53
+ # queries: security-extended,security-and-quality
54
+
55
+
56
+ # Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
57
+ # If this step fails, then you should remove it and run the build manually (see below)
58
+ - name: Autobuild
59
+ uses: github/codeql-action/autobuild@v2
60
+
61
+ # ℹ️ Command-line programs to run using the OS shell.
62
+ # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
63
+
64
+ # If the Autobuild fails above, remove it and uncomment the following three lines.
65
+ # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
66
+
67
+ # - run: |
68
+ # echo "Run, Build Application using script"
69
+ # ./location_of_script_within_repo/buildscript.sh
70
+
71
+ - name: Perform CodeQL Analysis
72
+ uses: github/codeql-action/analyze@v2
data/.gitignore CHANGED
@@ -1,18 +1,20 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ /rdoc/
1
11
  *.gem
2
- *.rbc
3
- .bundle
4
- .config
5
- .yardoc
6
- credentials
7
- Gemfile.lock
8
- InstalledFiles
9
- _yardoc
10
- coverage
11
- doc/
12
- lib/bundler/man
13
- pkg
14
- rdoc
15
- spec/reports
16
- test/tmp
17
- test/version_tmp
18
- tmp
12
+
13
+ # rspec failure tracking
14
+ .rspec_status
15
+
16
+ /.vscode/
17
+ *.code-workspace
18
+
19
+ scratch.rb
20
+ readme.txt
data/.reek.yml ADDED
@@ -0,0 +1,17 @@
1
+ exclude_paths:
2
+ - vendor
3
+ detectors:
4
+ TooManyInstanceVariables:
5
+ exclude:
6
+ - "LittleWeasel::Configuration"
7
+ - "LittleWeasel::WordResults"
8
+ # private methods do not have to depend on instance state
9
+ # https://github.com/troessner/reek/blob/master/docs/Utility-Function.md
10
+ UtilityFunction:
11
+ public_methods_only: true
12
+ # Check for variable name that doesn't communicate its intent well enough
13
+ # https://github.com/troessner/reek/blob/master/docs/Uncommunicative-Variable-Name.md
14
+ UncommunicativeVariableName:
15
+ accept:
16
+ - /^_$/
17
+ - /^e$/
data/.rspec CHANGED
@@ -1,2 +1,4 @@
1
- --color
2
- --profile
1
+ --require spec_helper
2
+ --format d
3
+ --force-color
4
+ --warnings
data/.rubocop.yml ADDED
@@ -0,0 +1,187 @@
1
+ require:
2
+ - rubocop-performance
3
+ - rubocop-rspec
4
+
5
+ AllCops:
6
+ TargetRubyVersion: 3.0.1
7
+ NewCops: enable
8
+ Exclude:
9
+ - '.git/**/*'
10
+ - '.idea/**/*'
11
+ - 'init/*'
12
+ - 'Rakefile'
13
+ - '*.gemspec'
14
+ - 'spec/**/*'
15
+ - 'vendor/**/*'
16
+
17
+ # Align the elements of a hash literal if they span more than one line.
18
+ Layout/HashAlignment:
19
+ EnforcedLastArgumentHashStyle: always_ignore
20
+
21
+ # Alignment of parameters in multi-line method definition.
22
+ # The `with_fixed_indentation` style aligns the following lines with one
23
+ # level of indentation relative to the start of the line with the method
24
+ # definition.
25
+ #
26
+ # def my_method(a,
27
+ # b)
28
+ Layout/ParameterAlignment:
29
+ EnforcedStyle: with_fixed_indentation
30
+
31
+ # Alignment of parameters in multi-line method call.
32
+ # The `with_fixed_indentation` style aligns the following lines with one
33
+ # level of indentation relative to the start of the line with the method call.
34
+ #
35
+ # my_method(a,
36
+ # b)
37
+ Layout/ArgumentAlignment:
38
+ EnforcedStyle: with_fixed_indentation
39
+
40
+ # a = case n
41
+ # when 0
42
+ # x * 2
43
+ # else
44
+ # y / 3
45
+ # end
46
+ Layout/CaseIndentation:
47
+ EnforcedStyle: end
48
+
49
+ # Enforces a configured order of definitions within a class body
50
+ Layout/ClassStructure:
51
+ Enabled: true
52
+
53
+ # Align `end` with the matching keyword or starting expression except for
54
+ # assignments, where it should be aligned with the LHS.
55
+ Layout/EndAlignment:
56
+ EnforcedStyleAlignWith: variable
57
+ AutoCorrect: true
58
+
59
+ # The `consistent` style enforces that the first element in an array
60
+ # literal where the opening bracket and the first element are on
61
+ # seprate lines is indented the same as an array literal which is not
62
+ # defined inside a method call.
63
+ Layout/FirstArrayElementIndentation:
64
+ EnforcedStyle: consistent
65
+
66
+ # The `consistent` style enforces that the first key in a hash
67
+ # literal where the opening brace and the first key are on
68
+ # seprate lines is indented the same as a hash literal which is not
69
+ # defined inside a method call.
70
+ Layout/FirstHashElementIndentation:
71
+ EnforcedStyle: consistent
72
+
73
+ # Indent multi-line methods instead of aligning with periods
74
+ Layout/MultilineMethodCallIndentation:
75
+ EnforcedStyle: indented
76
+
77
+ # Allow `debug` in tasks for now
78
+ Lint/Debugger:
79
+ Exclude:
80
+ - 'RakeFile'
81
+
82
+ # A calculated magnitude based on number of assignments, branches, and
83
+ # conditions.
84
+ # NOTE: This is temporarily disabled until we can eliminate existing Rubocop
85
+ # complaints
86
+ Metrics/AbcSize:
87
+ Enabled: false
88
+
89
+ # Avoid long blocks with many lines.
90
+ Metrics/BlockLength:
91
+ Exclude:
92
+ - 'RakeFile'
93
+ - 'db/seeds.rb'
94
+ - 'spec/**/*.rb'
95
+
96
+ # Avoid classes longer than 100 lines of code.
97
+ # NOTE: This is temporarily disabled until we can eliminate existing Rubocop
98
+ # complaints
99
+ Metrics/ClassLength:
100
+ Max: 200
101
+ Exclude:
102
+ - 'spec/**/*.rb'
103
+
104
+ # A complexity metric that is strongly correlated to the number of test cases
105
+ # needed to validate a method.
106
+ Metrics/CyclomaticComplexity:
107
+ Max: 9
108
+
109
+ # Limit lines to 80 characters
110
+ Layout/LineLength:
111
+ Exclude:
112
+ - 'RakeFile'
113
+ - 'spec/**/*.rb'
114
+
115
+ # Avoid methods longer than 15 lines of code.
116
+ Metrics/MethodLength:
117
+ Max: 20
118
+ IgnoredMethods:
119
+ - swagger_path
120
+ - operation
121
+
122
+
123
+ # A complexity metric geared towards measuring complexity for a human reader.
124
+ Metrics/PerceivedComplexity:
125
+ Max: 10
126
+
127
+ Naming/FileName:
128
+ Exclude:
129
+ - 'lib/LittleWeasel.rb'
130
+
131
+ # Allow `downcase == ` instead of forcing `casecmp`
132
+ Performance/Casecmp:
133
+ Enabled: false
134
+
135
+ # Require children definitions to be nested or compact in classes and modules
136
+ Style/ClassAndModuleChildren:
137
+ Enabled: false
138
+
139
+ # Document classes and non-namespace modules.
140
+ # (Disabled for now, may revisit later)
141
+ Style/Documentation:
142
+ Enabled: false
143
+
144
+ # Checks the formatting of empty method definitions.
145
+ Style/EmptyMethod:
146
+ EnforcedStyle: expanded
147
+
148
+ # Add the frozen_string_literal comment to the top of files to help transition
149
+ # to frozen string literals by default.
150
+ Style/FrozenStringLiteralComment:
151
+ EnforcedStyle: always
152
+
153
+ # Check for conditionals that can be replaced with guard clauses
154
+ Style/GuardClause:
155
+ Enabled: false
156
+
157
+ Style/MixinUsage:
158
+ Exclude:
159
+ - 'RakeFile'
160
+
161
+ # Avoid multi-line method signatures.
162
+ Style/MultilineMethodSignature:
163
+ Enabled: true
164
+
165
+ # Don't use option hashes when you can use keyword arguments.
166
+ Style/OptionHash:
167
+ Enabled: true
168
+
169
+ # Use return instead of return nil.
170
+ Style/ReturnNil:
171
+ Enabled: true
172
+
173
+ # Allow code like `return x, y` as it's occasionally handy.
174
+ Style/RedundantReturn:
175
+ AllowMultipleReturnValues: true
176
+
177
+ # Prefer symbols instead of strings as hash keys.
178
+ Style/StringHashKeys:
179
+ Enabled: true
180
+
181
+ # Checks if configured preferred methods are used over non-preferred.
182
+ Style/StringMethods:
183
+ Enabled: true
184
+
185
+ # Checks for use of parentheses around ternary conditions.
186
+ Style/TernaryParentheses:
187
+ EnforcedStyle: require_parentheses_when_complex
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.0.0-p481
1
+ 3.0.1
data/.yardopts ADDED
@@ -0,0 +1,2 @@
1
+ --protected
2
+ --private
data/CHANGELOG.md CHANGED
@@ -1,3 +1,23 @@
1
+ ### 5.0.1
2
+ * bug fix
3
+ * Fix error loading support files in LittleWeasel.rb.
4
+ ### 5.0.0
5
+ * changes
6
+ * Add spec coverage where lacking.
7
+ * Remove unused DictionaryLoaderService and associated modules, specs, factories.
8
+ * Refactor Locale, Language and Region modules to simplify.
9
+ * Fix up DictionaryManager#dictionary_for which was published
10
+ half-baked in 4.0.0.
11
+ * DeprecateDictionaryCacheService#dictionary_exists? (plural); add typical DeprecateDictionaryCacheService#dictionary_exist? method in its palce.
12
+ * Update rake gem version to eliminate command injection vulerability.
13
+ * Change description and summary reflecting 4.0.0 changes.
14
+ * Various reek gem violation fixes/suppressions where reasonable.
15
+ * Fix most rubocop violations.
16
+
17
+ ### 4.0.0
18
+ * enhancements
19
+ * Complete overhaul; see README.md
20
+
1
21
  ### 3.0.4
2
22
  * enhancements
3
23
  * Relax requirements on ruby version to ~> 2.0.
@@ -13,4 +33,4 @@
13
33
  * None
14
34
 
15
35
  * bug fix
16
- * Calling #exists? no longer alters the original input.
36
+ * Calling #exists? no longer alters the original input.
data/Gemfile CHANGED
@@ -1,4 +1,6 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  # Specify your gem's dependencies in LittleWeasel.gemspec
4
- gemspec
6
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,114 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ LittleWeasel (5.0.1)
5
+ activesupport (~> 6.1, >= 6.1.3.2)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ activesupport (6.1.6.1)
11
+ concurrent-ruby (~> 1.0, >= 1.0.2)
12
+ i18n (>= 1.6, < 2)
13
+ minitest (>= 5.1)
14
+ tzinfo (~> 2.0)
15
+ zeitwerk (~> 2.3)
16
+ ast (2.4.2)
17
+ benchmark-ips (2.10.0)
18
+ byebug (11.1.3)
19
+ coderay (1.1.3)
20
+ concurrent-ruby (1.1.10)
21
+ diff-lcs (1.5.0)
22
+ docile (1.4.0)
23
+ factory_bot (6.2.1)
24
+ activesupport (>= 5.0.0)
25
+ i18n (1.12.0)
26
+ concurrent-ruby (~> 1.0)
27
+ kwalify (0.7.2)
28
+ method_source (1.0.0)
29
+ minitest (5.16.3)
30
+ parallel (1.22.1)
31
+ parser (3.1.2.1)
32
+ ast (~> 2.4.1)
33
+ pry (0.14.1)
34
+ coderay (~> 1.1)
35
+ method_source (~> 1.0)
36
+ pry-byebug (3.10.1)
37
+ byebug (~> 11.0)
38
+ pry (>= 0.13, < 0.15)
39
+ rainbow (3.1.1)
40
+ rake (12.3.3)
41
+ redcarpet (3.5.1)
42
+ reek (6.1.1)
43
+ kwalify (~> 0.7.0)
44
+ parser (~> 3.1.0)
45
+ rainbow (>= 2.0, < 4.0)
46
+ regexp_parser (2.5.0)
47
+ rexml (3.2.5)
48
+ rspec (3.11.0)
49
+ rspec-core (~> 3.11.0)
50
+ rspec-expectations (~> 3.11.0)
51
+ rspec-mocks (~> 3.11.0)
52
+ rspec-core (3.11.0)
53
+ rspec-support (~> 3.11.0)
54
+ rspec-expectations (3.11.0)
55
+ diff-lcs (>= 1.2.0, < 2.0)
56
+ rspec-support (~> 3.11.0)
57
+ rspec-mocks (3.11.1)
58
+ diff-lcs (>= 1.2.0, < 2.0)
59
+ rspec-support (~> 3.11.0)
60
+ rspec-support (3.11.0)
61
+ rubocop (1.9.1)
62
+ parallel (~> 1.10)
63
+ parser (>= 3.0.0.0)
64
+ rainbow (>= 2.2.2, < 4.0)
65
+ regexp_parser (>= 1.8, < 3.0)
66
+ rexml
67
+ rubocop-ast (>= 1.2.0, < 2.0)
68
+ ruby-progressbar (~> 1.7)
69
+ unicode-display_width (>= 1.4.0, < 3.0)
70
+ rubocop-ast (1.21.0)
71
+ parser (>= 3.1.1.0)
72
+ rubocop-performance (1.14.3)
73
+ rubocop (>= 1.7.0, < 2.0)
74
+ rubocop-ast (>= 0.4.0)
75
+ rubocop-rspec (2.4.0)
76
+ rubocop (~> 1.0)
77
+ rubocop-ast (>= 1.1.0)
78
+ ruby-progressbar (1.11.0)
79
+ simplecov (0.21.2)
80
+ docile (~> 1.1)
81
+ simplecov-html (~> 0.11)
82
+ simplecov_json_formatter (~> 0.1)
83
+ simplecov-html (0.12.3)
84
+ simplecov_json_formatter (0.1.4)
85
+ tzinfo (2.0.5)
86
+ concurrent-ruby (~> 1.0)
87
+ unicode-display_width (2.2.0)
88
+ webrick (1.7.0)
89
+ yard (0.9.28)
90
+ webrick (~> 1.7.0)
91
+ zeitwerk (2.6.0)
92
+
93
+ PLATFORMS
94
+ ruby
95
+
96
+ DEPENDENCIES
97
+ LittleWeasel!
98
+ benchmark-ips (~> 2.3)
99
+ bundler (~> 2.2, >= 2.2.17)
100
+ factory_bot (~> 6.2)
101
+ pry-byebug (~> 3.9)
102
+ rake (~> 12.3, >= 12.3.3)
103
+ redcarpet (~> 3.5, >= 3.5.1)
104
+ reek (~> 6.0, >= 6.0.4)
105
+ rspec (~> 3.10)
106
+ rubocop (~> 1.9.1)
107
+ rubocop-performance (~> 1.11, >= 1.11.3)
108
+ rubocop-rspec (~> 2.3)
109
+ simplecov (~> 0.21.2)
110
+ webrick (~> 1.7)
111
+ yard (~> 0.9.26)
112
+
113
+ BUNDLED WITH
114
+ 2.2.17
data/Jenkinsfile ADDED
@@ -0,0 +1,20 @@
1
+ pipeline {
2
+ agent { docker { image 'ruby:3.0.1' } }
3
+ stages {
4
+ stage('requirements') {
5
+ steps {
6
+ sh 'gem install bundler -v 2.2.17'
7
+ }
8
+ }
9
+ stage('build') {
10
+ steps {
11
+ sh 'bundle install'
12
+ }
13
+ }
14
+ stage('test') {
15
+ steps {
16
+ sh 'bundle exec rspec'
17
+ }
18
+ }
19
+ }
20
+ }
data/LittleWeasel.gemspec CHANGED
@@ -1,28 +1,41 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path('lib', __dir__)
3
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
5
  require 'LittleWeasel/version'
5
6
 
6
7
  Gem::Specification.new do |spec|
7
- spec.name = "LittleWeasel"
8
+ spec.name = 'LittleWeasel'
8
9
  spec.version = LittleWeasel::VERSION
9
- spec.authors = ["Gene M. Angelo, Jr."]
10
- spec.email = ["public.gma@gmail.com"]
11
- spec.description = %q{Simple spellchecker for single, or multiple word blocks.}
12
- spec.summary = %q{Simply checks a word or group of words for validity against an english dictionary file.}
13
- spec.homepage = "http://www.geneangelo.com"
14
- spec.license = "MIT"
10
+ spec.authors = ['Gene M. Angelo, Jr.']
11
+ spec.email = ['public.gma@gmail.com']
12
+ spec.description = 'Spellchecker+ with preprocessing and filtering for single and multiple word blocks.'
13
+ spec.summary = 'Checks a word or group of words for validity against a dictionary/ies provided. Word filtering and word preprocessing is available.'
14
+ spec.homepage = 'http://www.geneangelo.com'
15
+ spec.license = 'MIT'
15
16
 
16
- spec.files = `git ls-files`.split($/)
17
+ spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
17
18
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
19
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
- spec.require_paths = ["lib"]
20
+ spec.require_paths = ['lib']
20
21
 
21
- spec.required_ruby_version = '~> 2.0'
22
- spec.add_runtime_dependency 'activesupport', '~> 4.1', '>= 4.1.1'
23
- spec.add_development_dependency "bundler", "~> 1.3"
24
- spec.add_development_dependency "rake", '~> 0'
25
- spec.add_development_dependency "rspec", '~> 3.0', '>= 3.0.0'
26
- spec.add_development_dependency "yard", "0.8.6.1"
27
- spec.add_development_dependency "redcarpet", '~> 2.3', '>= 2.3.0'
22
+ spec.required_ruby_version = '~> 3.0', '>= 3.0.1'
23
+ spec.add_runtime_dependency 'activesupport', '~> 6.1', '>= 6.1.3.2'
24
+ spec.add_development_dependency 'benchmark-ips', '~> 2.3'
25
+ spec.add_development_dependency 'bundler', '~> 2.2', '>= 2.2.17'
26
+ spec.add_development_dependency 'factory_bot', '~> 6.2'
27
+ spec.add_development_dependency 'pry-byebug', '~> 3.9'
28
+ spec.add_development_dependency 'rake', '~> 12.3', '>= 12.3.3'
29
+ spec.add_development_dependency 'redcarpet', '~> 3.5', '>= 3.5.1'
30
+ spec.add_development_dependency 'reek', '~> 6.0', '>= 6.0.4'
31
+ spec.add_development_dependency 'rspec', '~> 3.10'
32
+ # This verson of rubocop is returning errors.
33
+ # spec.add_development_dependency 'rubocop', '~> 1.14'
34
+ spec.add_development_dependency 'rubocop', '~> 1.9.1'
35
+ spec.add_development_dependency 'rubocop-performance', '~> 1.11', '>= 1.11.3'
36
+ spec.add_development_dependency 'rubocop-rspec', '~> 2.3'
37
+ spec.add_development_dependency 'simplecov', '~> 0.21.2'
38
+ # Needed for yard
39
+ spec.add_development_dependency 'webrick', '~> 1.7'
40
+ spec.add_development_dependency 'yard', '~> 0.9.26'
28
41
  end