Skip to content
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

Added option to set path to lint using swiftlint action #12197

Merged
merged 4 commits into from
Apr 3, 2018
Merged

Added option to set path to lint using swiftlint action #12197

merged 4 commits into from
Apr 3, 2018

Conversation

bguidolim
Copy link
Contributor

Checklist

  • I've run bundle exec rspec from the root directory to see all new and existing tests pass
  • I've followed the fastlane code style and run bundle exec rubocop -a to ensure the code style is valid
  • I've read the Contribution Guidelines
  • I've updated the documentation if necessary.

Motivation and Context

Currently we can use swiftlint action to run in the current folder, but if you want to run swiftlint only in a specific subfolder or other path outside of the current path is not possible.

This PR adds the option path to swiftlint action, so now it's possible to specify the path you want to run following the default behaviour of swiflint treatment for this specific folder.

I didn't find any issue related.

Copy link
Collaborator

@getaaron getaaron left a comment

Choose a reason for hiding this comment

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

Looks like a nice improvement. Just added one small suggestion.

FastlaneCore::ConfigItem.new(key: :path,
description: "Specify path to lint",
is_string: true,
optional: true),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we verify the path exists using ConfigItem's verify_block argument?

verify_block: proc do |value|
    UI.user_error!("Couldn't find path '#{File.expand_path(value)}'") unless File.exist?(value)
end),

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@bguidolim
Copy link
Contributor Author

AppVeyor failed on new unit test, but actually I don't know how to solve that. I don't have too much knowledge on Ruby, probably I did my test wrongly. @getaaron could take a look please?

Here is the error:

expected Exception with "Couldn't find path '/path/to/lint'", got #<FastlaneCore::Interface::FastlaneError: Couldn't find path 'C:/path/to/lint'> with backtrace:

path: '#{path}'
)
end").runner.execute(:test)
end.to raise_error("Couldn't find path '#{path}'")
Copy link
Member

Choose a reason for hiding this comment

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

The issue with the failing Windows test is it is putting a C: in front of the error so its not matching that "exact" string. Try... end.to raise_error(/Couldn't find path/)

end

it "adds invalid path option" do
path = "/path/to/lint"
Copy link
Member

Choose a reason for hiding this comment

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

Or maybe try changing this to a relative path path = "./path/to/lint"

Copy link
Member

@joshdholtz joshdholtz left a comment

Choose a reason for hiding this comment

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

Thanks for the addition! 😊

@joshdholtz joshdholtz merged commit 003c1b5 into fastlane:master Apr 3, 2018
@bguidolim bguidolim deleted the feature-swiftlint-path branch April 4, 2018 08:05
@fastlane-bot
Copy link

Hey @bguidolim 👋

Thank you for your contribution to fastlane and congrats on getting this pull request merged 🎉
The code change now lives in the master branch, however it wasn't released to RubyGems yet.
We usually ship about once a week, and your PR will be included in the next one.

Please let us know if this change requires an immediate release by adding a comment here 👍
We'll notify you once we shipped a new release with your changes 🚀

@getaaron
Copy link
Collaborator

getaaron commented Apr 6, 2018

Great work @bguidolim! Thanks for your help on this @joshdholtz

@fastlane-bot
Copy link

Congratulations! 🎉 This was released as part of fastlane 2.90.0 🚀

@fastlane fastlane locked and limited conversation to collaborators Jun 10, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants