summaryrefslogtreecommitdiff
blob: f3557728a73348d1ee929652a717cac23d72d757 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
commit 435d1cbf995a659a82d1d4b42d25e3459556ef21
Author: Ian Lee <IanLee1521@gmail.com>
Date:   Tue Mar 17 21:52:23 2015 -0700

    Reverted fix for #368 which had unintended repurcussions in flake8 and other places.
    
    This fix reverts to the parsing of user config (~/.config/pep8), then local directory
    config files, and finally overrides with cli options as was the behavior back in 1.5.7

diff --git a/CHANGES.txt b/CHANGES.txt
index 85eb043..5499abd 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -5,6 +5,12 @@ Changelog
 1.6.x (unreleased)
 ------------------
 
+Changes:
+
+* Reverted the fix in #368, "options passed on command line are only ones
+  accepted" feature. This has many unintended consequences in pep8 and flake8
+  and needs to be reworked when I have more time.
+
 1.6.2 (2015-02-15)
 ------------------
 
diff --git a/pep8.py b/pep8.py
index 9f40381..4d993da 100755
--- a/pep8.py
+++ b/pep8.py
@@ -1984,24 +1984,24 @@ def read_config(options, args, arglist, parser):
 
     local_dir = os.curdir
 
+    if USER_CONFIG and os.path.isfile(USER_CONFIG):
+        if options.verbose:
+            print('user configuration: %s' % USER_CONFIG)
+        config.read(USER_CONFIG)
+
+    parent = tail = args and os.path.abspath(os.path.commonprefix(args))
+    while tail:
+        if config.read(os.path.join(parent, fn) for fn in PROJECT_CONFIG):
+            local_dir = parent
+            if options.verbose:
+                print('local configuration: in %s' % parent)
+            break
+        (parent, tail) = os.path.split(parent)
+
     if cli_conf and os.path.isfile(cli_conf):
         if options.verbose:
             print('cli configuration: %s' % cli_conf)
         config.read(cli_conf)
-    else:
-        if USER_CONFIG and os.path.isfile(USER_CONFIG):
-            if options.verbose:
-                print('user configuration: %s' % USER_CONFIG)
-            config.read(USER_CONFIG)
-
-        parent = tail = args and os.path.abspath(os.path.commonprefix(args))
-        while tail:
-            if config.read(os.path.join(parent, fn) for fn in PROJECT_CONFIG):
-                local_dir = parent
-                if options.verbose:
-                    print('local configuration: in %s' % parent)
-                break
-            (parent, tail) = os.path.split(parent)
 
     pep8_section = parser.prog
     if config.has_section(pep8_section):