yujinakayama / atom-lint

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

Allow specifying a config file for flake8. #95

Closed anaconda closed 9 years ago

anaconda commented 9 years ago

My ~/.config/flake8 (for CLI usage) had

count = true
show-pep8 = true
show-source = true

but atom-lint expected a different output from flake8 and thrown an exception (I've hacked it a few months ago, so I can't really remember the actual exception, that's not relevant though).

I'd like to have an option to specify the --config=file for flake8 - I'm indeed using the same configuration file, with the 3 settings above removed (~/.config/flake8-atom).

Here's my hack, but it lacks tests and looks probably ugly:

--- a/atom-lint/lib/linter/flake8.coffee.orig
+++ b/atom-lint/lib/linter/flake8.coffee
@@ -52,11 +52,15 @@ class Flake8
     command = []

     userFlake8Path = atom.config.get('atom-lint.flake8.path')
+    userFlake8Config = atom.config.get('atom-lint.flake8.config')

     if userFlake8Path?
       command.push(userFlake8Path)
     else
       command.push('flake8')

+    if userFlake8Config?
+      command.push("--config=#{userFlake8Config}")
+
     command.push(@filePath)
     command

Although I'm fine as I'm patching it after every update, I think it may be useful to someone else. I can't open a proper pull request as I'm really new to Atom packages/Coffeescript/...

v3ss0n commented 9 years ago

Good one. What is the problem with PR?

anaconda commented 9 years ago

If my changes are fine (i.e. not considered a ugly hack) and it doesn't need tests or any other changes, I can surely PR it.

yujinakayama commented 9 years ago

I'm OK for the change. :+1: