Skip to content

[Task #876] Add license scanning setup to the template #23

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions recipes/license_finder.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# frozen_string_literal: true

append_to_file 'Gemfile', after: /gem 'rubocop-infinum'.*\n/ do
<<~HEREDOC
gem 'license_finder', require: false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indentation problem here as well

HEREDOC
end

append_to_file '.overcommit.yml', after: /command: \['bundle', 'exec', 'rubocop'\].*\n/ do
<<~HEREDOC

LicenseFinder:
enabled: true
on_warn: fail
command: ['bundle', 'exec', 'license_finder']
requires_files: true
include:
- 'Gemfile*'
- 'package.json'
Comment on lines +12 to +19
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this needs to be indented one more level to the left to be correctly nested under PreCommit section.


HEREDOC
end
1 change: 1 addition & 0 deletions recipes/main.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@
apply_recipe('flipper')
apply_recipe('github')
apply_recipe('containers')
apply_recipe('license_finder')
apply_recipe('run_generators')
apply_recipe('commit')
13 changes: 13 additions & 0 deletions recipes/run_generators.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,16 @@
append_to_file 'lib/tasks/auto_annotate_models.rake', '# rubocop:enable Metrics/BlockLength, Rails/RakeEnvironment'
rails_command 'generate strong_migrations:install'
run 'bundle exec rubocop -A --fail-level=error --format=quiet'

# add a list of permitted licenses to license_finder configuration fileAdd commentMore actions
run 'bundle exec license_finder permitted_licenses add "New BSD" "Simplified BSD" ruby "2-clause BSDL" ' \
'"Python-2.0" MIT "Apache 2.0" ISC CC0-1.0 CC-BY-3.0 "Mozilla Public License 2.0" LGPL MIT-0 ' \
'"Brakeman Public Use License" Apache "(CC-BY-4.0 AND OFL-1.1 AND MIT)" CC-BY-4.0 ' \
'"MPL-2.0 OR Apache-2.0" "(MIT AND Zlib)" "(WTFPL OR MIT)" "PayPal SDK License" ' \
'"MIT (http://mootools.net/license.txt)" "(MIT AND CC-BY-3.0)" 0BSD BSD '

# add a list of restricted licenses to license_finder configuration file
run 'bundle exec license_finder restrict add GPL-2.0 GPL-3.0'

# add bundle-audit gem to approved gems list
run 'bundle exec license_finder approvals add bundler-audit'