Skip to content
  • Andrew Halberstadt's avatar
    2255a9ee
    Bug 1395126 - Support cascading configuration for flake8, r=bc · 2255a9ee
    Andrew Halberstadt authored
    This allows .flake8 files to override one another, and fixes a pretty bad known
    bug with our flake8 implementation. For example, say we have a .flake8 file at:
    /foo/.flake8
    
    Before this patch, if we ran |mach lint foo/bar|, the configuration defined in
    that .flake8 file wouldn't get picked up. It would only work if running the
    specific directory that contains it, e.g |mach lint foo|.
    
    This change additionally allows multiple .flake8 files to be used. So if
    there's one defined at both:
    /.flake8
    /foo/.flake8
    
    Then running |mach lint foo/bar| will first apply the root .flake8, then the
    one under /foo (overriding earlier configuration).
    
    This bug still doesn't make flake8 configuration perfect though. Any directory
    containing a .flake8 file still needs to be explicitly listed in the "include"
    section of /tools/lint/flake8.yml. Otherwise in the example above, if running
    |mach lint /|, it wouldn't be able to find /foo/.flake8. This is a hard problem
    and is likely best solved by fixing flake8's upstream configuration handling.
    
    Unfortunately this means we still can't switch from a whitelist to a blacklist.
    
    MozReview-Commit-ID: 3DZAi1QHYYo
    
    --HG--
    extra : rebase_source : 51298c5847f6c2792581d9b312c87b70fa716ee1
    2255a9ee
    Bug 1395126 - Support cascading configuration for flake8, r=bc
    Andrew Halberstadt authored
    This allows .flake8 files to override one another, and fixes a pretty bad known
    bug with our flake8 implementation. For example, say we have a .flake8 file at:
    /foo/.flake8
    
    Before this patch, if we ran |mach lint foo/bar|, the configuration defined in
    that .flake8 file wouldn't get picked up. It would only work if running the
    specific directory that contains it, e.g |mach lint foo|.
    
    This change additionally allows multiple .flake8 files to be used. So if
    there's one defined at both:
    /.flake8
    /foo/.flake8
    
    Then running |mach lint foo/bar| will first apply the root .flake8, then the
    one under /foo (overriding earlier configuration).
    
    This bug still doesn't make flake8 configuration perfect though. Any directory
    containing a .flake8 file still needs to be explicitly listed in the "include"
    section of /tools/lint/flake8.yml. Otherwise in the example above, if running
    |mach lint /|, it wouldn't be able to find /foo/.flake8. This is a hard problem
    and is likely best solved by fixing flake8's upstream configuration handling.
    
    Unfortunately this means we still can't switch from a whitelist to a blacklist.
    
    MozReview-Commit-ID: 3DZAi1QHYYo
    
    --HG--
    extra : rebase_source : 51298c5847f6c2792581d9b312c87b70fa716ee1
Loading