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

Are there any way to call checks from program? #334

Open
kazuooooo opened this issue Aug 14, 2018 · 2 comments
Open

Are there any way to call checks from program? #334

kazuooooo opened this issue Aug 14, 2018 · 2 comments

Comments

@kazuooooo
Copy link
Contributor

kazuooooo commented Aug 14, 2018

Hi, I'm making rails_best_practices plugin for pre-commit gem.

So, I want to call rails_best_practices checks from program like this code.
https://github.com/jish/pre-commit/blob/master/lib/plugins/pre_commit/checks/rubocop.rb#L32

::RuboCop::CLI.new.run(args) == 0

I check command.rb file
and it looks it can't be called from program.

Are there some way to call from program?
or if it need CLI class, I'm glad to make it :)

thanks,

@flyerhzm
Copy link
Owner

@kazuooooo I think you can simply call like

  analyzer = RailsBestPractices::Analyzer.new(path, options)
  analyzer.analyze
# analyzer.runner.errors.empty?  if true, there's no violation.

A PR to create CLI class is welcome

@kazuooooo
Copy link
Contributor Author

@filiptepper
Thank you for your reply!

Yes, but to call this method, it need option parse like in command.rb

analyzer = RailsBestPractices::Analyzer.new(path, options)

I'll try to create CLI class, thank you 👍

@kazuooooo kazuooooo mentioned this issue Oct 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants