AtomLinter / linter-phpmd

Atom linter plugin for php, using phpmd.
21 stars 4 forks source link

Ability to specify ruleset filename #59

Closed stipsan closed 8 years ago

stipsan commented 8 years ago

PHPMD allows you to actually enter a filename path in the ruleset command itself, but it requires you to enter the path. This commit allows passing a simple filename, and if it detects a xml filename passed without being a relative or absolute path it'll look in the current or parent directories to find the file.

Fixes #58

Arcanemagus commented 8 years ago

I'd say the proper fix to this is to simply set the cwd for running phpmd to the project root.

Arcanemagus commented 8 years ago

You can find the documentation for the exec() function here. Getting the proper project root can be done with:

options = {}
projectDir = atom.project.relativizePath(filePath)[0]
if projectDir?
  options.cwd = projectDir

The check if it exists is in there since it is possible to open a file in Atom without an associated Project directory.

stipsan commented 8 years ago

Thanks for the feedback! I'll implement the exec change next.

Arcanemagus commented 8 years ago

Btw, if you were interested in becoming a maintainer of this package I wouldn't be opposed to adding you here. I've got enough to do keeping all the other linter plugins up to date that I don't have the time to dedicate to properly maintaining this.

stipsan commented 8 years ago

Sure I'd love to help out in any way I can! 😃

Arcanemagus commented 8 years ago

Invite sent :tada:

If you have any questions I'm almost always on Atom's Slack instance, there is a #linter-plugin-dev channel there with a bunch of other authors of linter packages as well.

Arcanemagus commented 8 years ago

Btw, when working on this repo always use a branch for new things, the only time you should commit directly to master is for very small things that you know absolutely for a fact will not break anything (essentially, just documentation changes).

stipsan commented 8 years ago

Yeah sure, I didn't bother to rename the branch when I made the fork as I didn't imagine I predict doing more than a one-off PR 😊

Den 9. mai 2016 kl. 23.03 skrev Landon Abney notifications@github.com:

Btw, when working on this repo always use a branch for new things, the only time you should commit directly to master is for very small things that you know absolutely for a fact will not break anything (essentially, just documentation changes).

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub

Arcanemagus commented 8 years ago

Oh, and just to be clear, do the branch on here since you can now. That way anyone that has access to the repo can work on it if necessary :wink:.

stipsan commented 8 years ago

roger that! :)

man. 9. mai 2016 kl. 23.14 skrev Landon Abney notifications@github.com:

Oh, and just to be clear, do the branch on here since you can now. That way anyone that has access to the repo can work on it if necessary [image: :wink:].

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/AtomLinter/linter-phpmd/pull/59#issuecomment-217991904

stipsan commented 8 years ago

Closing this PR as work is moved to this branch: https://github.com/AtomLinter/linter-phpmd/tree/combine-rulesets-and-projectrules