Skip to content

Commit

Permalink
update to readme and packwerk parity checker
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Evanczuk committed Jun 1, 2023
1 parent 741fb23 commit 26120cf
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ WIP: Rust implementation of packs for ruby

# Initial Milestone

- [ ] `packs generate_cache`, which can be used to update `tmp/cache/packwerk` for faster `packwerk` output. It should produce the exact same `json` that `packwerk` produces today. Challenges include:
- [ ] `packs generate_cache`, which can be used to update `tmp/cache/packwerk` for faster `packwerk` output. It should produce the exact same `json` that `packwerk` produces today.
Current Progress:
- Current progress is detected using `scripts/packwerk_parity_checker.rb`
- Currently, `packs` detects roughly 87% of references in Gusto's monolith
Remaining Challenges include:
- [ ] Parsing ERB
- [ ] Parsing Rails associations and rewriting them as constant references using a pluralizer. Initially, non-standard inflections will likely not be supported (although I may support it through hard-coded map in `packwerk.yml`)
- [ ] Replicating packwerk's behavior with respect to not recording "local definitions"
Expand Down
9 changes: 8 additions & 1 deletion scripts/packwerk_parity_checker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -104,16 +104,23 @@ def get_pretty_printed_string(object)
end

all_files = Dir['packs/**/*.rb']
# Shuffle can be used to find a simpler error to fix
all_files.shuffle! if ENV['SHUFFLE']

bar = ProgressBar.create(total: all_files.count, throttle_rate: 1, format: '%a %t [%c/%C files]: %B %j%%, %E')
found_failure = false
success_count = 0
all_count = 0
all_results = Parallel.map(all_files, in_threads: 8) do |f|
bar.increment
all_count += 1
next if found_failure && ENV['FAIL_FAST']
result = Result.from_file(f)
if result.success?
bar.log "Success for #{f}!"
success_count += 1
bar.log "Success! Success ratio is now: #{(success_count/all_count.to_f*100).round(2)} (#{f} was successful)!"
else
bar.log "Failure! Success ratio is now: #{(success_count/all_count.to_f*100).round(2)} (#{f} failed)!"
found_failure = true
end
result
Expand Down

0 comments on commit 26120cf

Please sign in to comment.