Skip to content
This repository has been archived by the owner on Apr 8, 2019. It is now read-only.

Add support for Rails Cop #78

Merged
merged 1 commit into from
Aug 18, 2014

Conversation

richrace
Copy link
Contributor

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
Copy link
Owner

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.

if @command[0].indexOf('rubocop') isnt -1 and
atom.config.get('atom-lint.rubocop.rails') is true and
atom.project.path?
_.extend(options, { cwd: atom.project.path })
Copy link
Owner

Choose a reason for hiding this comment

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

As I said, we can always set the cwd regardless whether the command is rubocop.

@richrace
Copy link
Contributor Author

Ok sounds good.

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

@yujinakayama
Copy link
Owner

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
Copy link
Contributor Author

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

@yujinakayama
Copy link
Owner

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

@richrace
Copy link
Contributor Author

This is ready to be merged now.

@yujinakayama
Copy link
Owner

Thanks!

yujinakayama added a commit that referenced this pull request Aug 18, 2014
@yujinakayama yujinakayama merged commit 4e07d5b into yujinakayama:master Aug 18, 2014
@richrace richrace deleted the rubocop-rails branch August 20, 2014 20:23
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants