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

New Check: all ruby files should have an encoding marker #15

Closed
wants to merge 2 commits into from
Closed

New Check: all ruby files should have an encoding marker #15

wants to merge 2 commits into from

Conversation

yob
Copy link
Contributor

@yob yob commented Jun 17, 2012

I have a project where team style dictates that every ruby file should have an encoding marker.

This is admittedly not something every team wants and wouldn't be a good default check.

Implementing the check was straight forward ( cf7e549 ), however I was surprised at the size of the subsequent commit that wired it into cane ( ba85d41 ).

What do you think about an addition to the rake task that allows teams to load custom checks? Something like:

 Cane::RakeTask.new(:cane) do |cane|
   cane.use EncodingCheck.new
   cane.use MethodLengthCheck.new(15)
   cane.use ObscureTeamCheck.new
   cane.use FilteredParamsCheck.new
 end

end

@xaviershay
Copy link
Contributor

Yeah you're right, wiring in new things is kind of insane. Maybe there is a way to combine your use suggestion (which I like) with a way to also set up the right command line params, documentation, etc...

@yob
Copy link
Contributor Author

yob commented Jun 18, 2012

I'm not seriously proposing EncodingCheck for merging upstream, it was mostly to provide code and context for my 'use' suggestion.

The one problem with it is how to support the command line. Is that what you're referring to with "a way to also set up the right command line params, documentation"?

@xaviershay
Copy link
Contributor

Yeah, I was thinking something like:

class EncodingCheck
  def self.command_line_options
    # Returns some meta data sufficient to specify command line options and rake task
    {}
  end
end

Then the CLI class can just iterate through all known checks and pull the meta data off them. That way, implementing a new check is all confined to the one class, rather than having to sprinkle things throughout the code base. Maybe it's simpler not even to go the meta data route, instead just call EncodingCheck.translate_cli_options(options). I'd have to play with it.

@xaviershay
Copy link
Contributor

No obvious next action, closing.

@xaviershay
Copy link
Contributor

.use method is supported in 2.1.0

@yob
Copy link
Contributor Author

yob commented Aug 26, 2012

thanks, it looks great!

On 26 August 2012 21:41, Xavier Shay notifications@github.com wrote:

.use method is supported in 2.1.0


Reply to this email directly or view it on GitHubhttps://github.com//pull/15#issuecomment-8036906.

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

Successfully merging this pull request may close these issues.

None yet

2 participants