Coder Social home page Coder Social logo

Comments (11)

asottile avatar asottile commented on June 28, 2024

In GitLab by @sigmavirus24 on Oct 31, 2014, 08:13

This is intentional. Some people want to forcibly check a file that is otherwise excluded. This would be a bug if you instead ran:

flake8 --config=private/lint/flake8-hook.ini django_app

from flake8.

asottile avatar asottile commented on June 28, 2024

In GitLab by @cabello on Oct 31, 2014, 09:45

Is there an alternative besides applying the exclusion policy myself?

I am getting the list of files from bash in a commit hook: py_files=$(git diff --cached --name-only --diff-filter=ACM | grep ".py$");

from flake8.

asottile avatar asottile commented on June 28, 2024

In GitLab by @sigmavirus24 on Oct 31, 2014, 10:12

Why aren't you using flake8's commit hook. I'm pretty sure it already handles this.

from flake8.

asottile avatar asottile commented on June 28, 2024

In GitLab by @cabello on Oct 31, 2014, 13:18

I managed to make it working following your suggestion, instead of checking for files, I am checking for the changed folders, worked out nicely.

I am not sure why we are not using flake8 built-in commit hook though. =/

Thanks for the quick and prompt reply & help!

from flake8.

asottile avatar asottile commented on June 28, 2024

In GitLab by @sigmavirus24 on Nov 1, 2014, 18:18

Always happy to help @cabello !

Thanks for reporting this anyway

from flake8.

asottile avatar asottile commented on June 28, 2024

In GitLab by @dwaynebailey on Apr 28, 2016, 19:52

I'm using pre-commit and while this behaviour might be intentional it is actually massively inconsistent and undocumented.

If I supply --config to override any default config I really don't expect it to behave differently regardless of what I supply. If I supply dir/ it respects it, if I supply dir/file.py it doesn't.

It's also selectively takes configuration from my setup.cfg:

  • Its takes max-line-length= and statistics=
  • But ignores exclude= and ignore=

I'm sure there's a more logical way to say ignore my settings?

Current behaviour is full settings for dir/ or default, half settings for specified file.py. Pretty confusing tbh.

In the interest of those who come after. This pre-commit issue suggests some workarounds.

from flake8.

asottile avatar asottile commented on June 28, 2024

In GitLab by @sigmavirus24 on Apr 29, 2016, 05:46

Hi @dwaynebailey,

At the present time, all configuration file discovery, parsing, and management is handled by pycodestyle (formerly pep8). Flake8 3.0 has taken control of this aspect and now handles this on its own and has fixed the problem I think you are describing (where you expect --config to ignore all other config files on disk) while providing alternative methods for retaining the existing behaviour.

from flake8.

asottile avatar asottile commented on June 28, 2024

In GitLab by @davecremins on Dec 15, 2016, 06:29

This should not have been closed, this is still an issue in flake8 3.0.4

from flake8.

asottile avatar asottile commented on June 28, 2024

In GitLab by @thejcannon on Jan 31, 2020, 09:34

Has any thought been given to "solving" this issue in the same way isort has? By adding a flag that tells the tool to "force" the exclusions, even on cmd-line args. (See filter_files in the docs).

It's truly unfortunate to have to specify the exclusions in more than one place: The config file (pyproject.toml or otherwise) for tooling running on the code as a directory, and then one for each config file that controls a tool that runs on the code per-file (like pre-commit).

from flake8.

asottile avatar asottile commented on June 28, 2024

In GitLab by @asottile on Jan 31, 2020, 09:36

afaict this got "fixed" at some point:

[flake8]
exclude = t.py
import os
$ flake8 t.py
$

though I suspect it was on accident

from flake8.

asottile avatar asottile commented on June 28, 2024

In GitLab by @thejcannon on Jan 31, 2020, 09:54

Looks like that behavior is documented in issue 392, and the "bug" (un)fortunately doesn't apply to exclusion directories, just exclusion filenames. In my use case, there are several files in the directory, so I'm still out of luck 🤷

from flake8.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.