From 451c6b24ddea45d4a44dec612e26600446165a7c Mon Sep 17 00:00:00 2001 From: moseslgz Date: Wed, 31 Oct 2018 15:58:02 +0800 Subject: [PATCH 1/2] Improve error communication A developer is mistaken that adding an executable is compulsory. This improved error message should help users of this plugin better. --- lib/fastlane/plugin/lizard/actions/lizard_action.rb | 8 ++++++-- spec/lizard_spec.rb | 12 ++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/lib/fastlane/plugin/lizard/actions/lizard_action.rb b/lib/fastlane/plugin/lizard/actions/lizard_action.rb index 4fa4db6..5db1eee 100644 --- a/lib/fastlane/plugin/lizard/actions/lizard_action.rb +++ b/lib/fastlane/plugin/lizard/actions/lizard_action.rb @@ -6,8 +6,12 @@ def self.run(params) UI.user_error!("You have to install lizard using `[sudo] pip install lizard` or specify the executable path with the `:executable` option.") end - if params[:executable] && !File.exist?(params[:executable]) - UI.user_error!("The custom executable at '#{params[:executable]}' does not exist.") + if params[:executable] + if !File.exist?(params[:executable]) + UI.user_error!("The custom executable at '#{params[:executable]}' does not exist.") + elsif !File.file?(params[:executable]) + UI.user_error!("You need to point to the executable to lizard.py file!") + end end lizard_command = params[:executable].nil? ? "lizard" : "python #{params[:executable]}" diff --git a/spec/lizard_spec.rb b/spec/lizard_spec.rb index 8c19ca9..2753c9b 100644 --- a/spec/lizard_spec.rb +++ b/spec/lizard_spec.rb @@ -11,6 +11,7 @@ let(:custom_executable) { "../spec/fixtures/lizard.py" } let(:outdated_executable) { "../spec/fixtures/outdated_lizard.py" } let(:newer_executable) { "../spec/fixtures/newer_lizard.py" } + let(:wrong_executable) { "../spec/fixtures" } context "executable" do it "fails with invalid sourcemap path" do @@ -44,6 +45,17 @@ end").runner.execute(:test) end + it "should raise if executable is wrong" do + expect(FastlaneCore::UI).to receive(:user_error!).with(/You need to point to the executable to lizard.py file\!/).and_call_original + expect do + Fastlane::FastFile.new.parse("lane :test do + lizard( + executable: '#{wrong_executable}' + ) + end").runner.execute(:test) + end.to raise_error(/You need to point to the executable to lizard.py file\!/) + end + it "should raise if executable version is less than required" do expect(FastlaneCore::UI).to receive(:user_error!).with(/Your lizard version .* is outdated, please upgrade to at least version .* and start your lane again\!/).and_call_original expect do From c0bb4bfb8a77a6d2ffe926d2c3f1a41ddf265d1d Mon Sep 17 00:00:00 2001 From: moseslgz Date: Wed, 31 Oct 2018 16:09:04 +0800 Subject: [PATCH 2/2] add codecov document --- codecov.yml | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 codecov.yml diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 0000000..fa09aef --- /dev/null +++ b/codecov.yml @@ -0,0 +1,2 @@ +codecov: + token: 9b033b7b-e22e-45e6-8aba-eccef3026c0e