yujinakayama / atom-lint

Obsolete: Generic code linting support for Atom
https://atom.io/packages/atom-lint
MIT License
111 stars 33 forks source link

Add support for Rails Cop #78

Closed richrace closed 10 years ago

richrace commented 10 years ago

rubocop needs to be ran from the project directory where the Rails app lives to work. Therefore, if rubocop is used then change the CWD to the project path if the Rails flag has been set.

To enable this add rails: true to your config.cson e.g.

'atom-lint':
  'ignoredNames': [
    'tmp/**'
  ]
  'rubocop':
    'rails': true
    'ignoredNames': [
      'db/**'
      'spec/**'
    ]

All specs pass in Atom (0.118.0 using React Editor). Using the rake command one fails, but it also fails in master, hopefully a separate issue.

CommandRunner
  run
    when environment variables of the login shell cannot be fetched
      it runs the command with the current env
yujinakayama commented 10 years ago

Thanks for the pull request.

I agree that rubocop should be run in the project root directory. I also think all linter commands should alway be run there since it would make the logic simpler and there's no disadvantage.

richrace commented 10 years ago

Ok sounds good.

Do you want me to close this PR and come back with a new one for just setting the cwd?

yujinakayama commented 10 years ago

Do you want me to close this PR and come back with a new one for just setting the cwd?

No you need not. You can add further changes in the current branch, squash the commits, and git push -f, then this pull request will be updated.

richrace commented 10 years ago

Here we go. Will set the CWD for any linter.

yujinakayama commented 10 years ago

As noted above, could you remove the rails configuration option handling? I'm planning to add more generic option to specify CLI arguments.

richrace commented 10 years ago

This is ready to be merged now.

yujinakayama commented 10 years ago

Thanks!