zmbush / coffeelint-ruby

This adds some simple bindings to ruby to enable use of coffeelint
MIT License
32 stars 23 forks source link

Centralize config file handling #28

Closed msalzburg closed 9 years ago

msalzburg commented 9 years ago

Hey Zachary,

I moved the config file handling (locating and parsing the file) into a separate class.

The CoffeeLint.lint method now uses the new .locate and .parse methods by default, unless a specific :config_file options was given. This simplifies the usage and configuration of the coffeelint bin and rake task.

Also third party gems like e.g. pronto-coffeelint don't have to duplicate the lookup behavior.

I would like to see this merged ^^

What do you think about it?

zmbush commented 9 years ago

Looks good other than the nit with the test.

msalzburg commented 9 years ago

Nice catch - updated the spec accordingly.

msalzburg commented 9 years ago

I also refactored the definition of the default_locations. This way config files in the ENV['HOME'] variable can be applied more easily.

While reviewing the changes I was wondering if the order of the look ups needs an adjustment.

Currently we are are looking up files like this:

file passed via options[:config_file] in CoffeeLint.lint

OR

1 coffeelint.json 2 .coffeelint.json 3 config/coffeelint.json 4 config/.coffeelint.json 5 file defined in ENV[‘COFFEELINT_CONFIG’] 6 ENV[‘HOME’]/coffeelint.json 7 ENV[‘HOME’]/.coffeelint.json

Any suggestions?

msalzburg commented 9 years ago

Hey Zachary,

just wondering - are you merging this request? Will there be a release coming up?

Best Martin

msalzburg commented 9 years ago

Thanks!!!