Skip to content

Commit

Permalink
Add quality checks for entries (2factorauth#6132)
Browse files Browse the repository at this point in the history
* Add quality checks for entries files

* Fix rubocop errors

fix rubocop errors v2

fix typo

* Change file permissions

* Apply Suggestions
  • Loading branch information
ApCoder123 authored Oct 3, 2021
1 parent f47e0ae commit a8fadcc
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/repository.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ jobs:
run: bundle exec ruby ./tests/validate-images.rb
- name: Validate URL/Domain reachability
run: bundle exec ruby ./tests/validate-urls.rb
- name: Quality Checks
run: bundle exec ruby ./tests/quality-checks.rb
- name: Validate Ruby scripts
run: bundle exec rubocop

Expand Down
18 changes: 18 additions & 0 deletions tests/quality-checks.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

require 'json'

# Fetch created (but not renamed) files in entries/**
diff = `git diff --name-only --diff-filter=Ar origin/master...HEAD entries/`.split("\n")

diff&.each do |path|
entry = JSON.parse(File.read(path)).values[0]
next unless entry.key? 'tfa'

# rubocop:disable Layout/LineLength
puts "::notice file=#{path} title=Missing Documentation:: Since there is no documentation available, please could you provide us with screenshots of the setup/login process as evidence of 2FA? Please remember to block out any personal information." unless entry['documentation']
puts "::warning file=#{path}:: A `custom-software` tag is needed since it has been included in the `tfa` array." if entry['tfa'].include?('custom-software') && !entry['custom-software']
puts "::warning file=#{path}:: A `custom-hardware` tag is needed since it has been included in the `tfa` array." if entry['tfa'].include?('custom-hardware') && !entry['custom-hardware']
# rubocop:enable Layout/LineLength
end

0 comments on commit a8fadcc

Please sign in to comment.