Skip to content
This repository has been archived by the owner on May 3, 2024. It is now read-only.

Commit

Permalink
Fix issue where .rubocop_todo.yml is poorly formatted (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Evanczuk authored Sep 23, 2022
1 parent e8aec81 commit 532ac88
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
package_protections (2.2.0)
package_protections (2.2.1)
activesupport
parse_packwerk
rubocop
Expand Down
2 changes: 2 additions & 0 deletions lib/package_protections/private.rb
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@ def self.exclude_for_rule(rule)
excludes = T.let(Set.new, T::Set[String])

Private.rubocop_todo_ymls.each do |todo_yml|
next if !todo_yml

config = todo_yml[rule]
next if config.nil?

Expand Down
2 changes: 1 addition & 1 deletion package_protections.gemspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Gem::Specification.new do |spec|
spec.name = 'package_protections'
spec.version = '2.2.0'
spec.version = '2.2.1'
spec.authors = ['Gusto Engineers']
spec.email = ['[email protected]']
spec.summary = 'Package protections for Rails apps'
Expand Down
11 changes: 11 additions & 0 deletions spec/package_protections_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -808,6 +808,17 @@ def get_new_violations
)
end

it 'does not fail if a .rubocop_todo.yml is in the wrong format' do
apples_package_yml_with_namespace_protection_set_to_fail_on_any

write_file('packs/apples/app/public/tool.rb', '')
write_file('packs/apples/.rubocop_todo.yml', <<~YML.strip)
YML

offenses = PackageProtections.get_offenses(packages: get_packages, new_violations: [])
expect(offenses).to contain_exactly(0).offense
end

it 'succeeds if another pack\'s file is in the rubocop TODO' do
apples_package_yml_with_namespace_protection_set_to_fail_on_any

Expand Down

0 comments on commit 532ac88

Please sign in to comment.