Coder Social home page Coder Social logo

Comments (6)

asottile avatar asottile commented on July 30, 2024

In GitLab by @sigmavirus24 on Dec 27, 2014, 09:21

@joe-gordon0 a merge request would be helpful in explaining the difference between the proposed flag and the existing --diff flag (because I've honestly forgotten how it differs since we last talked about this). Relatedly, the comment in that patch set doesn't explain how what you're doing there differs from --diff.

from flake8.

asottile avatar asottile commented on July 30, 2024

In GitLab by @joe-gordon0 on Feb 15, 2015, 14:43

Currently flake8 -diff takes a diff as stdin. So git diff HEAD^ | flake8 -diff Then pep8 (as part of flake8) extracts the filenames from the diff, excludes any that do not match the filename filter (so we can ignore things that aren't python files etc.) and then runs pep8/flake8 against those files (as read from the filesystem -- which isn't obvious).

The idea here is to add support to flake8 to do the same thing without having to do manually call 'git diff HEAD^' and teach flake8 to detect if its running on files in a VCS and automatically extract the right files to run against.

This would allow users to trivially run flake8 on just the changed files any time they want. Instead of just in pre-commit git hook.

Another option is to just better document how to do this in flake8's documentation. The same thing can easily be made easier via git aliases:

[alias]
    flake8 = "!git diff HEAD^ | flake8 --diff "

Thoughts on what approach is preferred?

from flake8.

asottile avatar asottile commented on July 30, 2024

In GitLab by @sigmavirus24 on Feb 22, 2015, 11:10

So as you pointed out, the --diff handling is part of pep8. There's no reason flake8 couldn't detect the usage of --diff sans stdin and not try to find a vcs to pull the diff from. We already have VCS discovery code for the --install-hook option.

+1 from me.

from flake8.

asottile avatar asottile commented on July 30, 2024

In GitLab by @adiroiban on Dec 4, 2015, 02:05

I am using something like this https://github.com/twisted/twisted/blob/fe7853b08c78756a473c8747ce1e7bd1f4cdaa5b/bin/admin/tx-pyflakes for my private project.

The example is something proposed for Twisted... but not accepted as it better to just use flake8 and not reinvent the wheel :)

The command line option can look like

flake8 --vcs-branch=master some/path

in this way it should also work for people with different main branch names

The initial implementation can only support git and later extended to hg or other tools.
VCS can be autodetected.

What do you say? Does it make sense?

Thanks!

from flake8.

asottile avatar asottile commented on July 30, 2024

In GitLab by @sigmavirus24 on Oct 20, 2018, 10:26

closed

from flake8.

asottile avatar asottile commented on July 30, 2024

In GitLab by @asottile on Oct 2, 2020, 16:38

changed the description

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.