packwerk 1.0.2 → 1.2.0

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.
Files changed (120) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +14 -5
  3. data/.ruby-version +1 -1
  4. data/Gemfile +1 -1
  5. data/Gemfile.lock +129 -111
  6. data/README.md +8 -1
  7. data/USAGE.md +39 -17
  8. data/dev.yml +1 -1
  9. data/exe/packwerk +1 -1
  10. data/gemfiles/Gemfile-rails-6-0 +22 -0
  11. data/lib/packwerk.rb +73 -34
  12. data/lib/packwerk/application_load_paths.rb +3 -2
  13. data/lib/packwerk/application_validator.rb +85 -69
  14. data/lib/packwerk/association_inspector.rb +23 -11
  15. data/lib/packwerk/checker.rb +4 -7
  16. data/lib/packwerk/cli.rb +36 -93
  17. data/lib/packwerk/configuration.rb +10 -2
  18. data/lib/packwerk/const_node_inspector.rb +13 -14
  19. data/lib/packwerk/constant_discovery.rb +2 -0
  20. data/lib/packwerk/constant_name_inspector.rb +0 -1
  21. data/lib/packwerk/dependency_checker.rb +12 -17
  22. data/lib/packwerk/deprecated_references.rb +25 -8
  23. data/lib/packwerk/file_processor.rb +0 -4
  24. data/lib/packwerk/formatters/offenses_formatter.rb +43 -0
  25. data/lib/packwerk/formatters/progress_formatter.rb +9 -4
  26. data/lib/packwerk/generators/configuration_file.rb +0 -1
  27. data/lib/packwerk/inflector.rb +0 -2
  28. data/lib/packwerk/node.rb +9 -2
  29. data/lib/packwerk/node_processor.rb +15 -32
  30. data/lib/packwerk/node_processor_factory.rb +0 -5
  31. data/lib/packwerk/node_visitor.rb +1 -4
  32. data/lib/packwerk/offense.rb +2 -8
  33. data/lib/packwerk/offense_collection.rb +84 -0
  34. data/lib/packwerk/offenses_formatter.rb +15 -0
  35. data/lib/packwerk/output_style.rb +20 -0
  36. data/lib/packwerk/output_styles/coloured.rb +29 -0
  37. data/lib/packwerk/output_styles/plain.rb +26 -0
  38. data/lib/packwerk/package.rb +8 -0
  39. data/lib/packwerk/package_set.rb +8 -5
  40. data/lib/packwerk/parse_run.rb +104 -0
  41. data/lib/packwerk/parsed_constant_definitions.rb +2 -4
  42. data/lib/packwerk/parsers.rb +0 -2
  43. data/lib/packwerk/parsers/erb.rb +4 -2
  44. data/lib/packwerk/parsers/factory.rb +10 -3
  45. data/lib/packwerk/privacy_checker.rb +22 -17
  46. data/lib/packwerk/reference_extractor.rb +0 -8
  47. data/lib/packwerk/reference_offense.rb +49 -0
  48. data/lib/packwerk/result.rb +9 -0
  49. data/lib/packwerk/run_context.rb +4 -20
  50. data/lib/packwerk/sanity_checker.rb +1 -3
  51. data/lib/packwerk/spring_command.rb +1 -1
  52. data/lib/packwerk/version.rb +1 -1
  53. data/lib/packwerk/violation_type.rb +0 -2
  54. data/library.yml +1 -1
  55. data/packwerk.gemspec +1 -0
  56. data/service.yml +1 -4
  57. data/shipit.rubygems.yml +5 -1
  58. data/sorbet/rbi/gems/{actioncable@6.1.0.alpha-d80c18a391e33552ae2d943e68af56946f883f65.rbi → actioncable@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi} +56 -36
  59. data/sorbet/rbi/gems/{actionmailbox@6.1.0.alpha-d80c18a391e33552ae2d943e68af56946f883f65.rbi → actionmailbox@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi} +25 -28
  60. data/sorbet/rbi/gems/{actionmailer@6.1.0.alpha-d80c18a391e33552ae2d943e68af56946f883f65.rbi → actionmailer@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi} +43 -24
  61. data/sorbet/rbi/gems/{actionpack@6.1.0.alpha-d80c18a391e33552ae2d943e68af56946f883f65.rbi → actionpack@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi} +382 -284
  62. data/sorbet/rbi/gems/{actiontext@6.1.0.alpha-d80c18a391e33552ae2d943e68af56946f883f65.rbi → actiontext@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi} +76 -40
  63. data/sorbet/rbi/gems/{actionview@6.1.0.alpha-d80c18a391e33552ae2d943e68af56946f883f65.rbi → actionview@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi} +206 -195
  64. data/sorbet/rbi/gems/{activejob@6.1.0.alpha-d80c18a391e33552ae2d943e68af56946f883f65.rbi → activejob@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi} +64 -75
  65. data/sorbet/rbi/gems/{activemodel@6.1.0.alpha-d80c18a391e33552ae2d943e68af56946f883f65.rbi → activemodel@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi} +103 -56
  66. data/sorbet/rbi/gems/{activerecord@6.1.0.alpha-d80c18a391e33552ae2d943e68af56946f883f65.rbi → activerecord@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi} +1250 -898
  67. data/sorbet/rbi/gems/{activestorage@6.1.0.alpha-d80c18a391e33552ae2d943e68af56946f883f65.rbi → activestorage@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi} +92 -120
  68. data/sorbet/rbi/gems/{activesupport@6.1.0.alpha-d80c18a391e33552ae2d943e68af56946f883f65.rbi → activesupport@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi} +292 -193
  69. data/sorbet/rbi/gems/{ast@2.4.1.rbi → ast@2.4.2.rbi} +2 -1
  70. data/sorbet/rbi/gems/{better_html@1.0.15.rbi → better_html@1.0.16.rbi} +2 -2
  71. data/sorbet/rbi/gems/{concurrent-ruby@1.1.6.rbi → concurrent-ruby@1.1.8.rbi} +12 -9
  72. data/sorbet/rbi/gems/{erubi@1.9.0.rbi → erubi@1.10.0.rbi} +3 -1
  73. data/sorbet/rbi/gems/{i18n@1.8.2.rbi → i18n@1.8.10.rbi} +19 -52
  74. data/sorbet/rbi/gems/{loofah@2.5.0.rbi → loofah@2.9.0.rbi} +3 -1
  75. data/sorbet/rbi/gems/marcel@1.0.0.rbi +70 -0
  76. data/sorbet/rbi/gems/{mini_mime@1.0.2.rbi → mini_mime@1.0.3.rbi} +6 -6
  77. data/sorbet/rbi/gems/{mini_portile2@2.4.0.rbi → minitest-focus@1.2.1.rbi} +2 -2
  78. data/sorbet/rbi/gems/{minitest@5.14.0.rbi → minitest@5.14.4.rbi} +31 -29
  79. data/sorbet/rbi/gems/{mocha@1.11.2.rbi → mocha@1.12.0.rbi} +25 -36
  80. data/sorbet/rbi/gems/{nio4r@2.5.2.rbi → nio4r@2.5.7.rbi} +21 -20
  81. data/sorbet/rbi/gems/{nokogiri@1.10.9.rbi → nokogiri@1.11.2.rbi} +193 -154
  82. data/sorbet/rbi/gems/parallel@1.20.1.rbi +117 -0
  83. data/sorbet/rbi/gems/parlour@6.0.0.rbi +1272 -0
  84. data/sorbet/rbi/gems/{parser@2.7.1.4.rbi → parser@3.0.0.0.rbi} +287 -174
  85. data/sorbet/rbi/gems/{pry@0.13.1.rbi → pry@0.14.0.rbi} +1 -1
  86. data/sorbet/rbi/gems/racc@1.5.2.rbi +57 -0
  87. data/sorbet/rbi/gems/{rack@2.2.2.rbi → rack@2.2.3.rbi} +23 -35
  88. data/sorbet/rbi/gems/{rails@6.1.0.alpha-d80c18a391e33552ae2d943e68af56946f883f65.rbi → rails@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi} +1 -1
  89. data/sorbet/rbi/gems/{railties@6.1.0.alpha-d80c18a391e33552ae2d943e68af56946f883f65.rbi → railties@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi} +132 -121
  90. data/sorbet/rbi/gems/{rake@13.0.1.rbi → rake@13.0.3.rbi} +16 -20
  91. data/sorbet/rbi/gems/{parallel@1.19.1.rbi → regexp_parser@2.1.1.rbi} +2 -2
  92. data/sorbet/rbi/gems/rubocop-ast@1.4.1.rbi +8 -0
  93. data/sorbet/rbi/gems/{rubocop-performance@1.5.2.rbi → rubocop-performance@1.10.2.rbi} +1 -1
  94. data/sorbet/rbi/gems/{rubocop-shopify@1.0.2.rbi → rubocop-shopify@2.0.1.rbi} +1 -1
  95. data/sorbet/rbi/gems/{rubocop-sorbet@0.3.7.rbi → rubocop-sorbet@0.6.1.rbi} +1 -1
  96. data/sorbet/rbi/gems/{rubocop@0.82.0.rbi → rubocop@1.12.0.rbi} +1 -1
  97. data/sorbet/rbi/gems/{ruby-progressbar@1.10.1.rbi → ruby-progressbar@1.11.0.rbi} +1 -1
  98. data/sorbet/rbi/gems/spoom@1.1.0.rbi +1061 -0
  99. data/sorbet/rbi/gems/{spring@2.1.0.rbi → spring@2.1.1.rbi} +7 -7
  100. data/sorbet/rbi/gems/{sprockets-rails@3.2.1.rbi → sprockets-rails@3.2.2.rbi} +88 -68
  101. data/sorbet/rbi/gems/{sprockets@4.0.0.rbi → sprockets@4.0.2.rbi} +8 -7
  102. data/sorbet/rbi/gems/{tapioca@0.4.5.rbi → tapioca@0.4.19.rbi} +109 -24
  103. data/sorbet/rbi/gems/{thor@1.0.1.rbi → thor@1.1.0.rbi} +16 -15
  104. data/sorbet/rbi/gems/{tzinfo@2.0.2.rbi → tzinfo@2.0.4.rbi} +21 -2
  105. data/sorbet/rbi/gems/{unicode-display_width@1.7.0.rbi → unicode-display_width@2.0.0.rbi} +1 -1
  106. data/sorbet/rbi/gems/{websocket-driver@0.7.1.rbi → websocket-driver@0.7.3.rbi} +29 -29
  107. data/sorbet/rbi/gems/{websocket-extensions@0.1.4.rbi → websocket-extensions@0.1.5.rbi} +2 -2
  108. data/sorbet/rbi/gems/zeitwerk@2.4.2.rbi +177 -0
  109. data/sorbet/tapioca/require.rb +1 -0
  110. metadata +78 -57
  111. data/lib/packwerk/checking_deprecated_references.rb +0 -40
  112. data/lib/packwerk/output_styles.rb +0 -41
  113. data/lib/packwerk/reference_lister.rb +0 -23
  114. data/lib/packwerk/updating_deprecated_references.rb +0 -51
  115. data/sorbet/rbi/gems/jaro_winkler@1.5.4.rbi +0 -8
  116. data/sorbet/rbi/gems/marcel@0.3.3.rbi +0 -30
  117. data/sorbet/rbi/gems/mimemagic@0.3.5.rbi +0 -47
  118. data/sorbet/rbi/gems/parlour@4.0.1.rbi +0 -561
  119. data/sorbet/rbi/gems/spoom@1.0.4.rbi +0 -418
  120. data/sorbet/rbi/gems/zeitwerk@2.3.0.rbi +0 -8
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3b54c31e7c1902a03feb01304c85c9f2363b769fdb5f3c3cea7f38c67ff77af3
4
- data.tar.gz: efefa11bf554021227ce63a876c891d5466ee7bcd173e319deb086c8ec9732a5
3
+ metadata.gz: ced63ca0995c039913777f3e8ba1aac428970d8fc515b1629c9212f71baab34b
4
+ data.tar.gz: 331b0a5f30e7104b4eb3e44920739ea592e7e3dc7df3dca339a74260fa13d62b
5
5
  SHA512:
6
- metadata.gz: 5765e07827c5c5fc6d297f916e80c6cd2a6e09984ba91a1f2186ce1209d7965c7d906b6ff06a6b50fd37c299cdb9f82188d57273faf6e0fe7c654983ff8c0e8d
7
- data.tar.gz: b44c1ba5e1c5b61dd2d3e4755b5c215f245cb412a05f272513a6eba83e561097d6f6e624d65f5e8fa7021479616433f0e37ca9b818f00363efd11f24f8b6bca6
6
+ metadata.gz: a487a501ca28d341a888eea2e0ec13c4831897680ce1d17bef2a4943408ff718d75cffe9a50030fd93d7a2388d161c7a3cd946a0764930f89016c2f2c81e5306
7
+ data.tar.gz: d4685f869617c8b1141125fcaacbde96839be3d239aa2422db6f76dbcb485f42fcde97e0c6aaa580ef4abcd847ebbfd9979fe4896f0bc5c7421d104673346981
@@ -7,10 +7,19 @@ jobs:
7
7
  runs-on: ubuntu-latest
8
8
  strategy:
9
9
  matrix:
10
+ gemfile:
11
+ - Gemfile
12
+ - gemfiles/Gemfile-rails-6-0
10
13
  ruby:
11
14
  - 2.6
12
15
  - 2.7
13
- name: Tests Ruby ${{ matrix.ruby }}
16
+ - 3.0
17
+ exclude:
18
+ - ruby: 2.6
19
+ gemfile: Gemfile
20
+ env:
21
+ BUNDLE_GEMFILE: ${{ matrix.gemfile }}
22
+ name: "Tests: Ruby ${{ matrix.ruby }} ${{ matrix.gemfile }}"
14
23
  steps:
15
24
  - uses: actions/checkout@v1
16
25
  - name: Set up Ruby ${{ matrix.ruby }}
@@ -26,10 +35,10 @@ jobs:
26
35
  runs-on: ubuntu-latest
27
36
  steps:
28
37
  - uses: actions/checkout@v1
29
- - name: Set up Ruby 2.6
38
+ - name: Set up Ruby
30
39
  uses: actions/setup-ruby@v1
31
40
  with:
32
- ruby-version: 2.6.x
41
+ ruby-version: 3.0.x
33
42
  - name: Run style checks
34
43
  run: |
35
44
  gem install bundler
@@ -39,10 +48,10 @@ jobs:
39
48
  runs-on: ubuntu-latest
40
49
  steps:
41
50
  - uses: actions/checkout@v1
42
- - name: Set up Ruby 2.6
51
+ - name: Set up Ruby
43
52
  uses: actions/setup-ruby@v1
44
53
  with:
45
- ruby-version: 2.6.x
54
+ ruby-version: 3.0.x
46
55
  - name: Run static type checks
47
56
  run: |
48
57
  gem install bundler
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.6.6
1
+ 3.0.0
data/Gemfile CHANGED
@@ -8,7 +8,7 @@ gemspec
8
8
  # Specify the same dependency sources as the application Gemfile
9
9
 
10
10
  gem("spring")
11
- gem("rails", github: "rails/rails")
11
+ gem("rails", github: "rails/rails", branch: "main")
12
12
  gem("constant_resolver", require: false)
13
13
  gem("sorbet-runtime", require: false)
14
14
  gem("rubocop-performance", require: false)
data/Gemfile.lock CHANGED
@@ -1,103 +1,106 @@
1
1
  GIT
2
2
  remote: https://github.com/rails/rails.git
3
- revision: d80c18a391e33552ae2d943e68af56946f883f65
3
+ revision: d612542336d9a61381311c95a27d801bb4094779
4
+ branch: main
4
5
  specs:
5
- actioncable (6.1.0.alpha)
6
- actionpack (= 6.1.0.alpha)
7
- activesupport (= 6.1.0.alpha)
6
+ actioncable (7.0.0.alpha)
7
+ actionpack (= 7.0.0.alpha)
8
+ activesupport (= 7.0.0.alpha)
8
9
  nio4r (~> 2.0)
9
10
  websocket-driver (>= 0.6.1)
10
- actionmailbox (6.1.0.alpha)
11
- actionpack (= 6.1.0.alpha)
12
- activejob (= 6.1.0.alpha)
13
- activerecord (= 6.1.0.alpha)
14
- activestorage (= 6.1.0.alpha)
15
- activesupport (= 6.1.0.alpha)
11
+ actionmailbox (7.0.0.alpha)
12
+ actionpack (= 7.0.0.alpha)
13
+ activejob (= 7.0.0.alpha)
14
+ activerecord (= 7.0.0.alpha)
15
+ activestorage (= 7.0.0.alpha)
16
+ activesupport (= 7.0.0.alpha)
16
17
  mail (>= 2.7.1)
17
- actionmailer (6.1.0.alpha)
18
- actionpack (= 6.1.0.alpha)
19
- actionview (= 6.1.0.alpha)
20
- activejob (= 6.1.0.alpha)
21
- activesupport (= 6.1.0.alpha)
18
+ actionmailer (7.0.0.alpha)
19
+ actionpack (= 7.0.0.alpha)
20
+ actionview (= 7.0.0.alpha)
21
+ activejob (= 7.0.0.alpha)
22
+ activesupport (= 7.0.0.alpha)
22
23
  mail (~> 2.5, >= 2.5.4)
23
24
  rails-dom-testing (~> 2.0)
24
- actionpack (6.1.0.alpha)
25
- actionview (= 6.1.0.alpha)
26
- activesupport (= 6.1.0.alpha)
25
+ actionpack (7.0.0.alpha)
26
+ actionview (= 7.0.0.alpha)
27
+ activesupport (= 7.0.0.alpha)
27
28
  rack (~> 2.0, >= 2.0.9)
28
29
  rack-test (>= 0.6.3)
29
30
  rails-dom-testing (~> 2.0)
30
31
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
31
- actiontext (6.1.0.alpha)
32
- actionpack (= 6.1.0.alpha)
33
- activerecord (= 6.1.0.alpha)
34
- activestorage (= 6.1.0.alpha)
35
- activesupport (= 6.1.0.alpha)
32
+ actiontext (7.0.0.alpha)
33
+ actionpack (= 7.0.0.alpha)
34
+ activerecord (= 7.0.0.alpha)
35
+ activestorage (= 7.0.0.alpha)
36
+ activesupport (= 7.0.0.alpha)
36
37
  nokogiri (>= 1.8.5)
37
- actionview (6.1.0.alpha)
38
- activesupport (= 6.1.0.alpha)
38
+ actionview (7.0.0.alpha)
39
+ activesupport (= 7.0.0.alpha)
39
40
  builder (~> 3.1)
40
41
  erubi (~> 1.4)
41
42
  rails-dom-testing (~> 2.0)
42
43
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
43
- activejob (6.1.0.alpha)
44
- activesupport (= 6.1.0.alpha)
44
+ activejob (7.0.0.alpha)
45
+ activesupport (= 7.0.0.alpha)
45
46
  globalid (>= 0.3.6)
46
- activemodel (6.1.0.alpha)
47
- activesupport (= 6.1.0.alpha)
48
- activerecord (6.1.0.alpha)
49
- activemodel (= 6.1.0.alpha)
50
- activesupport (= 6.1.0.alpha)
51
- activestorage (6.1.0.alpha)
52
- actionpack (= 6.1.0.alpha)
53
- activejob (= 6.1.0.alpha)
54
- activerecord (= 6.1.0.alpha)
55
- activesupport (= 6.1.0.alpha)
56
- marcel (~> 0.3.1)
57
- activesupport (6.1.0.alpha)
47
+ activemodel (7.0.0.alpha)
48
+ activesupport (= 7.0.0.alpha)
49
+ activerecord (7.0.0.alpha)
50
+ activemodel (= 7.0.0.alpha)
51
+ activesupport (= 7.0.0.alpha)
52
+ activestorage (7.0.0.alpha)
53
+ actionpack (= 7.0.0.alpha)
54
+ activejob (= 7.0.0.alpha)
55
+ activerecord (= 7.0.0.alpha)
56
+ activesupport (= 7.0.0.alpha)
57
+ marcel (~> 1.0.0)
58
+ mini_mime (~> 1.0.2)
59
+ activesupport (7.0.0.alpha)
58
60
  concurrent-ruby (~> 1.0, >= 1.0.2)
59
61
  i18n (>= 1.6, < 2)
60
- minitest (~> 5.1)
62
+ minitest (>= 5.1)
61
63
  tzinfo (~> 2.0)
62
64
  zeitwerk (~> 2.3)
63
- rails (6.1.0.alpha)
64
- actioncable (= 6.1.0.alpha)
65
- actionmailbox (= 6.1.0.alpha)
66
- actionmailer (= 6.1.0.alpha)
67
- actionpack (= 6.1.0.alpha)
68
- actiontext (= 6.1.0.alpha)
69
- actionview (= 6.1.0.alpha)
70
- activejob (= 6.1.0.alpha)
71
- activemodel (= 6.1.0.alpha)
72
- activerecord (= 6.1.0.alpha)
73
- activestorage (= 6.1.0.alpha)
74
- activesupport (= 6.1.0.alpha)
75
- bundler (>= 1.3.0)
76
- railties (= 6.1.0.alpha)
65
+ rails (7.0.0.alpha)
66
+ actioncable (= 7.0.0.alpha)
67
+ actionmailbox (= 7.0.0.alpha)
68
+ actionmailer (= 7.0.0.alpha)
69
+ actionpack (= 7.0.0.alpha)
70
+ actiontext (= 7.0.0.alpha)
71
+ actionview (= 7.0.0.alpha)
72
+ activejob (= 7.0.0.alpha)
73
+ activemodel (= 7.0.0.alpha)
74
+ activerecord (= 7.0.0.alpha)
75
+ activestorage (= 7.0.0.alpha)
76
+ activesupport (= 7.0.0.alpha)
77
+ bundler (>= 1.15.0)
78
+ railties (= 7.0.0.alpha)
77
79
  sprockets-rails (>= 2.0.0)
78
- railties (6.1.0.alpha)
79
- actionpack (= 6.1.0.alpha)
80
- activesupport (= 6.1.0.alpha)
80
+ railties (7.0.0.alpha)
81
+ actionpack (= 7.0.0.alpha)
82
+ activesupport (= 7.0.0.alpha)
81
83
  method_source
82
- rake (>= 0.8.7)
84
+ rake (>= 0.13)
83
85
  thor (~> 1.0)
84
86
 
85
87
  PATH
86
88
  remote: .
87
89
  specs:
88
- packwerk (1.0.2)
90
+ packwerk (1.2.0)
89
91
  activesupport (>= 5.2)
90
92
  ast
91
93
  better_html
92
94
  constant_resolver
95
+ parallel
93
96
  parser
94
97
  sorbet-runtime
95
98
 
96
99
  GEM
97
100
  remote: https://rubygems.org/
98
101
  specs:
99
- ast (2.4.1)
100
- better_html (1.0.15)
102
+ ast (2.4.2)
103
+ better_html (1.0.16)
101
104
  actionview (>= 4.0)
102
105
  activesupport (>= 4.0)
103
106
  ast (~> 2.0)
@@ -111,18 +114,17 @@ GEM
111
114
  colorize (0.8.1)
112
115
  commander (4.5.2)
113
116
  highline (~> 2.0.0)
114
- concurrent-ruby (1.1.6)
117
+ concurrent-ruby (1.1.8)
115
118
  constant_resolver (0.1.5)
116
119
  crass (1.0.6)
117
- erubi (1.9.0)
120
+ erubi (1.10.0)
118
121
  globalid (0.4.2)
119
122
  activesupport (>= 4.2.0)
120
123
  highline (2.0.3)
121
124
  html_tokenizer (0.0.7)
122
- i18n (1.8.2)
125
+ i18n (1.8.10)
123
126
  concurrent-ruby (~> 1.0)
124
- jaro_winkler (1.5.4)
125
- loofah (2.5.0)
127
+ loofah (2.9.0)
126
128
  crass (~> 1.0.2)
127
129
  nokogiri (>= 1.5.9)
128
130
  m (1.5.1)
@@ -130,31 +132,33 @@ GEM
130
132
  rake (>= 0.9.2.2)
131
133
  mail (2.7.1)
132
134
  mini_mime (>= 0.1.1)
133
- marcel (0.3.3)
134
- mimemagic (~> 0.3.2)
135
+ marcel (1.0.0)
135
136
  method_source (1.0.0)
136
- mimemagic (0.3.5)
137
- mini_mime (1.0.2)
138
- mini_portile2 (2.4.0)
139
- minitest (5.14.0)
137
+ mini_mime (1.0.3)
138
+ mini_portile2 (2.5.1)
139
+ minitest (5.14.4)
140
140
  minitest-focus (1.2.1)
141
141
  minitest (>= 4, < 6)
142
- mocha (1.11.2)
143
- nio4r (2.5.2)
144
- nokogiri (1.10.9)
145
- mini_portile2 (~> 2.4.0)
146
- parallel (1.19.1)
147
- parlour (4.0.1)
142
+ mocha (1.12.0)
143
+ nio4r (2.5.7)
144
+ nokogiri (1.11.5)
145
+ mini_portile2 (~> 2.5.0)
146
+ racc (~> 1.4)
147
+ nokogiri (1.11.5-x86_64-darwin)
148
+ racc (~> 1.4)
149
+ parallel (1.20.1)
150
+ parlour (6.0.0)
148
151
  commander (~> 4.5)
149
152
  parser
150
153
  rainbow (~> 3.0)
151
154
  sorbet-runtime (>= 0.5)
152
- parser (2.7.1.4)
155
+ parser (3.0.0.0)
153
156
  ast (~> 2.4.1)
154
- pry (0.13.1)
157
+ pry (0.14.0)
155
158
  coderay (~> 1.1)
156
159
  method_source (~> 1.0)
157
- rack (2.2.2)
160
+ racc (1.5.2)
161
+ rack (2.2.3)
158
162
  rack-test (1.1.0)
159
163
  rack (>= 1.0, < 3)
160
164
  rails-dom-testing (2.0.3)
@@ -163,59 +167,73 @@ GEM
163
167
  rails-html-sanitizer (1.3.0)
164
168
  loofah (~> 2.3)
165
169
  rainbow (3.0.0)
166
- rake (13.0.1)
167
- rexml (3.2.4)
168
- rubocop (0.82.0)
169
- jaro_winkler (~> 1.5.1)
170
+ rake (13.0.3)
171
+ regexp_parser (2.1.1)
172
+ rexml (3.2.5)
173
+ rubocop (1.12.0)
170
174
  parallel (~> 1.10)
171
- parser (>= 2.7.0.1)
175
+ parser (>= 3.0.0.0)
172
176
  rainbow (>= 2.2.2, < 4.0)
177
+ regexp_parser (>= 1.8, < 3.0)
173
178
  rexml
179
+ rubocop-ast (>= 1.2.0, < 2.0)
174
180
  ruby-progressbar (~> 1.7)
175
- unicode-display_width (>= 1.4.0, < 2.0)
176
- rubocop-performance (1.5.2)
177
- rubocop (>= 0.71.0)
178
- rubocop-shopify (1.0.2)
179
- rubocop (~> 0.82.0)
180
- rubocop-sorbet (0.3.7)
181
- ruby-progressbar (1.10.1)
181
+ unicode-display_width (>= 1.4.0, < 3.0)
182
+ rubocop-ast (1.4.1)
183
+ parser (>= 2.7.1.5)
184
+ rubocop-performance (1.10.2)
185
+ rubocop (>= 0.90.0, < 2.0)
186
+ rubocop-ast (>= 0.4.0)
187
+ rubocop-shopify (2.0.1)
188
+ rubocop (~> 1.11)
189
+ rubocop-sorbet (0.6.1)
190
+ rubocop
191
+ ruby-progressbar (1.11.0)
182
192
  smart_properties (1.15.0)
183
- sorbet (0.5.5898)
184
- sorbet-static (= 0.5.5898)
185
- sorbet-runtime (0.5.6049)
186
- sorbet-static (0.5.5898-universal-darwin-19)
187
- spoom (1.0.4)
193
+ sorbet (0.5.6360)
194
+ sorbet-static (= 0.5.6360)
195
+ sorbet-runtime (0.5.6360)
196
+ sorbet-static (0.5.6360-universal-darwin-14)
197
+ sorbet-static (0.5.6360-universal-darwin-15)
198
+ sorbet-static (0.5.6360-universal-darwin-16)
199
+ sorbet-static (0.5.6360-universal-darwin-17)
200
+ sorbet-static (0.5.6360-universal-darwin-18)
201
+ sorbet-static (0.5.6360-universal-darwin-19)
202
+ sorbet-static (0.5.6360-universal-darwin-20)
203
+ sorbet-static (0.5.6360-x86_64-linux)
204
+ spoom (1.1.0)
188
205
  colorize
189
- sorbet (~> 0.5.5)
206
+ sorbet (>= 0.5.6347)
190
207
  sorbet-runtime
191
208
  thor (>= 0.19.2)
192
- spring (2.1.0)
193
- sprockets (4.0.0)
209
+ spring (2.1.1)
210
+ sprockets (4.0.2)
194
211
  concurrent-ruby (~> 1.0)
195
212
  rack (> 1, < 3)
196
- sprockets-rails (3.2.1)
213
+ sprockets-rails (3.2.2)
197
214
  actionpack (>= 4.0)
198
215
  activesupport (>= 4.0)
199
216
  sprockets (>= 3.0.0)
200
- tapioca (0.4.5)
217
+ tapioca (0.4.19)
218
+ bundler (>= 1.17.3)
201
219
  parlour (>= 2.1.0)
202
220
  pry (>= 0.12.2)
203
221
  sorbet-runtime
204
222
  sorbet-static (>= 0.4.4471)
205
223
  spoom
206
224
  thor (>= 0.19.2)
207
- thor (1.0.1)
208
- tzinfo (2.0.2)
225
+ thor (1.1.0)
226
+ tzinfo (2.0.4)
209
227
  concurrent-ruby (~> 1.0)
210
- unicode-display_width (1.7.0)
211
- websocket-driver (0.7.1)
228
+ unicode-display_width (2.0.0)
229
+ websocket-driver (0.7.3)
212
230
  websocket-extensions (>= 0.1.0)
213
- websocket-extensions (0.1.4)
214
- zeitwerk (2.3.0)
231
+ websocket-extensions (0.1.5)
232
+ zeitwerk (2.4.2)
215
233
 
216
234
  PLATFORMS
217
235
  ruby
218
- x86_64-darwin-19
236
+ x86_64-darwin-20
219
237
 
220
238
  DEPENDENCIES
221
239
  bundler
@@ -236,4 +254,4 @@ DEPENDENCIES
236
254
  tapioca
237
255
 
238
256
  BUNDLED WITH
239
- 2.1.4
257
+ 2.2.14
data/README.md CHANGED
@@ -1,9 +1,16 @@
1
1
  # Packwerk [![Build Status](https://github.com/Shopify/packwerk/workflows/CI/badge.svg)](https://github.com/Shopify/packwerk/actions?query=workflow%3ACI)
2
2
 
3
+ ## NOTE: Packwerk is considered to be feature-complete for Shopify's uses. We are currently accepting bug fixes only, and it is not being actively developed. Please fork this project if you are interested in adding new features.
4
+
5
+ > "I know who you are and because of that I know what you do."
6
+ > This knowledge is a dependency that raises the cost of change.
7
+
8
+ -- _Sandi Metz, Practical Object-Oriented Design in Ruby_
9
+
3
10
  Packwerk is a Ruby gem used to enforce boundaries and modularize Rails applications.
4
11
 
5
12
  Packwerk can be used to:
6
- * Combine group of files into packages
13
+ * Combine groups of files into packages
7
14
  * Define package-level constant visibility (i.e. have publicly accessible constants)
8
15
  * Enforce privacy (inbound) and dependency (outbound) boundaries between packages
9
16
  * Help existing codebases to become more modular without obstructing development
data/USAGE.md CHANGED
@@ -1,22 +1,22 @@
1
1
  # Packwerk usage
2
2
 
3
3
  ## Table of Contents
4
- * [What problem does Packwerk solve?](#What-problem-does-Packwerk-solve?)
5
- * [What is a package?](#What-is-a-package?)
6
- * [Package principles](#Package-principles)
7
- * [Getting started](#Getting-started)
8
- * [Setting up the configuration file](#Setting-up-the-configuration-file)
9
- * [Inflections](#Inflections)
10
- * [Validating the package system](#Validating-the-package-system)
11
- * [Defining packages](#Defining-packages)
12
- * [Package metadata](#Package-metadata)
13
- * [Types of boundary checks](#Types-of-boundary-checks)
14
- * [Enforcing privacy boundary](#Enforcing-privacy-boundary)
15
- * [Using public folders](#Using-public-folders)
16
- * [Enforcing dependency boundary](#Enforcing-dependency-boundary)
17
- * [Checking for violations](#Checking-for-violations)
18
- * [Recording existing violations](#Recording-existing-violations)
19
- * [Understanding the list of deprecated references](#Understanding-the-list-of-deprecated-references)
4
+ * [What problem does Packwerk solve?](#what-problem-does-packwerk-solve)
5
+ * [What is a package?](#what-is-a-package)
6
+ * [Package principles](#package-principles)
7
+ * [Getting started](#getting-started)
8
+ * [Setting up the configuration file](#setting-up-the-configuration-file)
9
+ * [Inflections](#inflections)
10
+ * [Validating the package system](#validating-the-package-system)
11
+ * [Defining packages](#defining-packages)
12
+ * [Package metadata](#package-metadata)
13
+ * [Types of boundary checks](#types-of-boundary-checks)
14
+ * [Enforcing privacy boundary](#enforcing-privacy-boundary)
15
+ * [Using public folders](#using-public-folders)
16
+ * [Enforcing dependency boundary](#enforcing-dependency-boundary)
17
+ * [Checking for violations](#checking-for-violations)
18
+ * [Recording existing violations](#recording-existing-violations)
19
+ * [Understanding the list of deprecated references](#understanding-the-list-of-deprecated-references)
20
20
 
21
21
  ## What problem does Packwerk solve?
22
22
  Large applications need clear boundaries to avoid turning into a [ball of mud](https://en.wikipedia.org/wiki/Big_ball_of_mud). However, Ruby does not provide a good solution to enforcing boundaries between code.
@@ -63,10 +63,32 @@ Packwerk reads from the `packwerk.yml` configuration file in the root directory.
63
63
  |----------------------|-------------------------------------------|--------------|
64
64
  | include | **/*.{rb,rake,erb} | list of patterns for folder paths to include |
65
65
  | exclude | {bin,node_modules,script,tmp,vendor}/**/* | list of patterns for folder paths to exclude |
66
- | package_paths | **/ | patterns to find package configuration files, see: Defining packages |
66
+ | package_paths | **/ | a single pattern or a list of patterns to find package configuration files, see: [Defining packages](#Defining-packages) |
67
67
  | load_paths | All application autoload paths | list of load paths |
68
68
  | custom_associations | N/A | list of custom associations, if any |
69
+ | parallel | true | when true, fork code parsing out to subprocesses |
69
70
 
71
+ ### Using a custom ERB parser
72
+
73
+ You can specify a custom ERB parser if needed. For example, if you're using `<%graphql>` tags from https://github.com/github/graphql-client in your ERBs, you can use a custom parser subclass to comment them out so that Packwerk can parse the rest of the file:
74
+
75
+ ```ruby
76
+ class CustomParser < Packwerk::Parsers::Erb
77
+ def parse_buffer(buffer, file_path:)
78
+ preprocessed_source = buffer.source
79
+
80
+ # Comment out <%graphql ... %> tags. They won't contain any object
81
+ # references anyways.
82
+ preprocessed_source = preprocessed_source.gsub(/<%graphql/, "<%#")
83
+
84
+ preprocessed_buffer = Parser::Source::Buffer.new(file_path)
85
+ preprocessed_buffer.source = preprocessed_source
86
+ super(preprocessed_buffer, file_path: file_path)
87
+ end
88
+ end
89
+
90
+ Packwerk::Parsers::Factory.instance.erb_parser_class = CustomParser
91
+ ```
70
92
 
71
93
  ### Inflections
72
94