gemwork 0.7.8 → 0.7.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5814942677e2ae7070660fc2bf0b3d3dae6fd08744f15b8e74fb997b7e1d4382
4
- data.tar.gz: 7e672645c76d464a3458dcf086182e102761df89031326ac01d36319c4e124a3
3
+ metadata.gz: d2e343966a1395439c2480be144d1b021e71b3b393e2c5a37a3e042fb9d9e26a
4
+ data.tar.gz: c4394858040c87beaf9721891e99f28b46673c40ebdd77bc5640f610bf7ad33c
5
5
  SHA512:
6
- metadata.gz: 506f5bbf2f788b11ce8258c2c376695881ab19f89435df05896be4c8b8b8bdabcdc4977339d2a5c2e450c9e97a0b00f090452e6b0e63e88f602ef6fc5d7b6c77
7
- data.tar.gz: d15d91a6345c8254dd4b8f8754f275f53ccdb9eee91cea5bde579885e75277ef524146059f3b52ba0357b89968a3ebc679178133f766e0b1a334cb117bb9690f
6
+ metadata.gz: 9b64fd4b8b8fd79164d315ec7ec04f7ca0b2211f860c92878c11d3e157e30c376110394a72ebddfce515c1393ebe7ab31741dfe2c7fdb428f3f13c960182c899
7
+ data.tar.gz: 767a780744a8429e0fe7682380e36dc5452205e6f2c2e1c28f9c7c9c64c2fae1f07cc58e672ab1230baa7d5062b572f807f40f20be1b610e9cb4ee247e879cef
data/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.7.11] - 2025-2-15
4
+ (0.7.10 yanked)
5
+
6
+ - Minimize `rake brakeman` output when no warnings; return failure otherwise
7
+ - Fail on error in Rubocop rake task
8
+ - Add documentation to README + example config file for erb_lint
9
+
10
+ ## [0.7.9] - 2025-2-13
11
+
12
+ - Add rake task for `erb_lint` for Rails apps
13
+
3
14
  ## [0.7.8] - 2025-2-12
4
15
 
5
16
  - Ignore `create` and `update` methods (controller actions) for Metrics/MethodLength cop
data/README.md CHANGED
@@ -58,7 +58,7 @@ Running `rake -T` after this will reveal the additional tasks defined by Gemwork
58
58
 
59
59
  ### Rails
60
60
 
61
- For a Rails project, you may need to conditionally run the above by returning early unless the current environment is development. Further, you may want to include other tasks, such as `eslint`, `prettier`, `brakeman`, and `test:system`.
61
+ For a Rails project, you may need to conditionally run the above by returning early unless the current environment is development. Further, you may want to include other gems & their rake tasks, such as: [`erb_lint`](#erb_lint), [`eslint`](#eslint), [`prettier`](#prettier), `brakeman`, and `test:system`.
62
62
 
63
63
  ```ruby
64
64
  # frozen_string_literal: true
@@ -69,8 +69,9 @@ spec = Gem::Specification.find_by_name("gemwork")
69
69
 
70
70
  # Load additional tasks defined by Gemwork.
71
71
  Dir.glob(
72
- Pathname.new(spec.gem_dir).
73
- join("lib", "tasks", "{util,rubocop,reek,eslint,prettier,brakeman}.rake")) do |task|
72
+ Pathname.new(spec.gem_dir).join(
73
+ "lib/tasks",
74
+ "{util,rubocop,erb_lint,reek,eslint,prettier,brakeman}.rake")) do |task|
74
75
  load(task)
75
76
  end
76
77
 
@@ -80,6 +81,7 @@ task :default do
80
81
  run_tasks(%i[
81
82
  test
82
83
  rubocop
84
+ erb_lint
83
85
  reek
84
86
  eslint
85
87
  prettier
@@ -214,11 +216,34 @@ require "gemwork/test/support/spec_dsl"
214
216
 
215
217
  For a Rails app, additional configuration may be desired to improve linter support.
216
218
 
219
+ #### erb_lint
220
+
221
+ https://github.com/Shopify/erb_lint
222
+
223
+ Install with:
224
+
225
+ ```
226
+ group :development do
227
+ gem "erb_lint", require: false
228
+ end
229
+ ```
230
+
231
+ Add [.erb_lint.yml](https://github.com/pdobb/gemwork/blob/main/lib/erb_lint/.erb_lint.yml) to the Rails project's root.
232
+
233
+ Run with:
234
+
235
+ ```bash
236
+ rake erb_lint
237
+
238
+ # To run on manually, on a specific path:
239
+ erb_lint --format=compact path/to/template.html.erb
240
+ ```
241
+
217
242
  #### eslint
218
243
 
219
244
  The below fixes eslint linting errors in Rails (7+, ...) projects.
220
245
 
221
- ```json
246
+ ```javascript
222
247
  // .eslintrc.json
223
248
 
224
249
  {
@@ -247,7 +272,7 @@ General config recommendations for prettier:
247
272
  vendor
248
273
  ```
249
274
 
250
- ```json
275
+ ```javascript
251
276
  // .prettierrc.json
252
277
 
253
278
  {
@@ -286,6 +311,7 @@ For Rails projects, you may want to manually install additional gems as well:
286
311
 
287
312
  - [rubocop-rails](https://github.com/rubocop/rubocop-rails) -- A RuboCop extension focused on enforcing Rails best practices and coding conventions.
288
313
  - [rubocop-capybara](https://github.com/rubocop/rubocop-capybara) -- Code style checking for Capybara files.
314
+ - [erb_lint](https://github.com/Shopify/erb_lint) -- erb linting, including with Rubocop
289
315
 
290
316
  ## Development
291
317
 
@@ -0,0 +1,35 @@
1
+ EnableDefaultLinters: true
2
+ linters:
3
+ DeprecatedClasses:
4
+ enabled: false
5
+ ErbSafety:
6
+ enabled: true
7
+ HardCodedString:
8
+ enabled: false
9
+ PartialInstanceVariable:
10
+ enabled: true
11
+ Rubocop:
12
+ enabled: true
13
+ rubocop_config:
14
+ inherit_from:
15
+ - .rubocop.yml
16
+ Layout/InitialIndentation:
17
+ Enabled: false
18
+ Layout/LeadingEmptyLines:
19
+ Enabled: false
20
+ Layout/MultilineArrayLineBreaks:
21
+ Enabled: false
22
+ Layout/TrailingEmptyLines:
23
+ Enabled: false
24
+ Layout/TrailingWhitespace:
25
+ Enabled: false
26
+ Lint/UselessAssignment:
27
+ Enabled: false
28
+ Style/FrozenStringLiteralComment:
29
+ Enabled: false
30
+ RequireScriptNonce:
31
+ enabled: false
32
+ SpaceInHtmlTag:
33
+ enabled: false
34
+ StrictLocals:
35
+ enabled: true
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Gemwork
4
- VERSION = "0.7.8"
4
+ VERSION = "0.7.11"
5
5
  end
@@ -5,10 +5,19 @@ task(:brakeman, :output_files) do |_task, args|
5
5
  require "brakeman"
6
6
 
7
7
  files = args[:output_files].split if args[:output_files]
8
- Brakeman.run(
9
- app_path: ".",
10
- quiet: true,
11
- output_files: files,
12
- print_report: true,
13
- pager: false)
8
+ result =
9
+ Brakeman.run(
10
+ app_path: ".",
11
+ quiet: true,
12
+ output_files: files,
13
+ print_report: false,
14
+ pager: false)
15
+
16
+ if result.warnings.empty?
17
+ puts "\e[32m0 warnings\e[0m"
18
+ else
19
+ puts "\e[31mWarnings found\e[0m"
20
+ puts result.report
21
+ exit 1
22
+ end
14
23
  end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ desc "Run erb_lint on **/*.html.erb"
4
+ task :erb_lint do
5
+ system("bundle exec erb_lint --format=compact --lint-all") ||
6
+ exit($CHILD_STATUS.exitstatus)
7
+ end
@@ -3,5 +3,5 @@
3
3
  require "rubocop/rake_task"
4
4
 
5
5
  RuboCop::RakeTask.new do |t|
6
- t.fail_on_error = false
6
+ t.fail_on_error = true
7
7
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gemwork
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.8
4
+ version: 0.7.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul DobbinSchmaltz
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2025-02-12 00:00:00.000000000 Z
10
+ date: 2025-02-15 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: rake
@@ -202,6 +202,7 @@ files:
202
202
  - LICENSE.txt
203
203
  - README.md
204
204
  - lib/.DS_Store
205
+ - lib/erb_lint/.erb_lint.yml
205
206
  - lib/gemwork.rb
206
207
  - lib/gemwork/.DS_Store
207
208
  - lib/gemwork/test/support/much_stub-rails.rb
@@ -230,6 +231,7 @@ files:
230
231
  - lib/rubocop/style-rails.yml
231
232
  - lib/rubocop/style.yml
232
233
  - lib/tasks/brakeman.rake
234
+ - lib/tasks/erb_lint.rake
233
235
  - lib/tasks/eslint.rake
234
236
  - lib/tasks/prettier.rake
235
237
  - lib/tasks/reek.rake