audit: fix code review changes
This commit is contained in:
parent
3bfca5bcee
commit
0b95f030fd
@ -112,7 +112,9 @@ module Homebrew
|
|||||||
style_results = Style.check_style_json(style_files, options) if style_files
|
style_results = Style.check_style_json(style_files, options) if style_files
|
||||||
# load licenses
|
# load licenses
|
||||||
full_path = File.join(File.dirname(__FILE__), "../data/spdx.json")
|
full_path = File.join(File.dirname(__FILE__), "../data/spdx.json")
|
||||||
spdx_ids = JSON.parse(File.open(full_path).read)
|
spdx_ids = File.open(full_path, "r") do |f|
|
||||||
|
JSON.parse(f.read)
|
||||||
|
end
|
||||||
new_formula_problem_lines = []
|
new_formula_problem_lines = []
|
||||||
audit_formulae.sort.each do |f|
|
audit_formulae.sort.each do |f|
|
||||||
only = only_cops ? ["style"] : args.only
|
only = only_cops ? ["style"] : args.only
|
||||||
@ -347,7 +349,7 @@ module Homebrew
|
|||||||
].freeze
|
].freeze
|
||||||
|
|
||||||
def audit_license
|
def audit_license
|
||||||
if ! formula.license.blank?
|
if !formula.license.blank?
|
||||||
if @spdx_ids.key?(formula.license)
|
if @spdx_ids.key?(formula.license)
|
||||||
return unless @online
|
return unless @online
|
||||||
|
|
||||||
|
|||||||
@ -97,8 +97,12 @@ module Homebrew
|
|||||||
|
|
||||||
describe "#audit_license" do
|
describe "#audit_license" do
|
||||||
let(:spdx_ids) {
|
let(:spdx_ids) {
|
||||||
full_path = File.join(File.expand_path(File.dirname(__FILE__) + "../../../data/"), "spdx.json")
|
# full_path = File.join(File.expand_path(File.dirname(__FILE__) + "../../../data/"), "spdx.json")
|
||||||
JSON.parse(File.open(full_path).read)
|
full_path = File.join(File.dirname(__FILE__), "../../data/spdx.json")
|
||||||
|
p full_path
|
||||||
|
File.open(full_path, "r") do |f|
|
||||||
|
JSON.parse(f.read)
|
||||||
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
let(:custom_spdx_id) { "zzz" }
|
let(:custom_spdx_id) { "zzz" }
|
||||||
@ -145,9 +149,9 @@ module Homebrew
|
|||||||
"as what is indicated on its Github repo" do
|
"as what is indicated on its Github repo" do
|
||||||
fa = formula_auditor "cask", <<~RUBY, spdx_ids: spdx_ids, online: true, core_tap: true
|
fa = formula_auditor "cask", <<~RUBY, spdx_ids: spdx_ids, online: true, core_tap: true
|
||||||
class Cask < Formula
|
class Cask < Formula
|
||||||
url "https://github.com/cask/cask/archive/v0.8.4.tar.gz"
|
url "https://github.com/cask/cask/archive/v0.8.4.tar.gz"
|
||||||
head "https://github.com/cask/cask.git"
|
head "https://github.com/cask/cask.git"
|
||||||
license "GPL-3.0"
|
license "GPL-3.0"
|
||||||
end
|
end
|
||||||
RUBY
|
RUBY
|
||||||
|
|
||||||
@ -157,12 +161,11 @@ module Homebrew
|
|||||||
|
|
||||||
it "checks online and detects that a formula-specified license is not "\
|
it "checks online and detects that a formula-specified license is not "\
|
||||||
"the same as what is indicated on its Github repository" do
|
"the same as what is indicated on its Github repository" do
|
||||||
# odie "lol"
|
|
||||||
fa = formula_auditor "cask", <<~RUBY, online: true, spdx_ids: spdx_ids, core_tap: true
|
fa = formula_auditor "cask", <<~RUBY, online: true, spdx_ids: spdx_ids, core_tap: true
|
||||||
class Cask < Formula
|
class Cask < Formula
|
||||||
url "https://github.com/cask/cask/archive/v0.8.4.tar.gz"
|
url "https://github.com/cask/cask/archive/v0.8.4.tar.gz"
|
||||||
head "https://github.com/cask/cask.git"
|
head "https://github.com/cask/cask.git"
|
||||||
license "#{standard_mismatch_spdx_id}"
|
license "#{standard_mismatch_spdx_id}"
|
||||||
end
|
end
|
||||||
RUBY
|
RUBY
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user