Skip to content

--output-file with end of argument (--) worked in 3.7.9 but no longer works in 6.0.0 #1774

Open
@paisleyrob

Description

@paisleyrob

how did you install flake8?

$ cat requirements_hash.txt
GitPython==3.1.29 --hash=sha256:41eea0deec2deea139b459ac03656f0dd28fc4a3387240ec1d3c259a2c47850f2
PyYAML==6.0 --hash=sha256:68fb519c14306fec9720a2a5b45bc9f0c8d1b9c72adf45c37baedfcd949c35a23
bandit==1.7.4 --hash=sha256:412d3f259dab4077d0e7f0c11f50f650cc7d10db905d98f6520a95a18049658a4
coverage==7.0.0 --hash=sha256:b8f7cd942dda3795fc9eadf303cc53a422ac057e3b70c2ad6d4276ec6a83a5415
entrypoints==0.4 --hash=sha256:f174b5ff827504fd3cd97cc3f8649f3693f51538c7e4bdf3ef002c8429d42f9f6
flake8-bandit==4.1.1 --hash=sha256:4c8a53eb48f23d4ef1e59293657181a3c989d0077c9952717e98a0eace43e06d7
flake8-junit-report==2.1.0 --hash=sha256:f8890c1ebe0acb516fefacddec4b802bca9f89bb07db933e4ee3cd11ceaa1e8b8
flake8-polyfill==1.0.2 --hash=sha256:12be6a34ee3ab795b19ca73505e7b55826d5f6ad7230d31b18e106400169b9e99
flake8==6.0.0 --hash=sha256:3833794e27ff64ea4e9cf5d410082a8b97ff1a06c16aa3d2027339cd0f1195c710
gitdb==4.0.10 --hash=sha256:c286cf298426064079ed96a9e4a9d39e7f3e9bf15ba60701e95f5492f28415c711
mccabe==0.7.0 --hash=sha256:6c2d30ab6be0e4a46919781807b4f0d834ebdd6c6e3dca0bda5a15f863427b6e12
pbr==5.11.0 --hash=sha256:db2317ff07c84c4c63648c9064a79fe9d9f5c7ce85a9099d4b6258b3db83225a13
pycodestyle==2.10.0 --hash=sha256:8a4eaf0d0495c7395bdab3589ac2db602797d76207242c17d47018681570661014
pyflakes==3.0.1 --hash=sha256:ec55bf7fe21fff7f1ad2f7da62363d749e2a470500eab1b555334b67aa1ef8cf15
six==1.16.0 --hash=sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e025416
smmap==5.0.0 --hash=sha256:2aba19d6a040e78d8b09de5c57e96207b09ed71d8e55ce0959eeee6c8e190d9417
stevedore==4.1.1 --hash=sha256:aa6436565c069b2946fe4ebff07f5041e0c8bf18c7376dd29edf80cf7d524e4e18
typing-extensions==4.4.0 --hash=sha256:16fa4864408f655d35ec496218b85f79b3437c829e93320c7c9215ccfd92489e
$ PYTHONDONTWRITEBYTECODE=1 PYTHONHASHSEED=0 SOURCE_DATE_EPOCH=946702800 pip install --no-build-isolation --no-cache-dir --no-compile --require-hashes --requirement requirements_hash.txt

# Note: identical behavior with `pip install flake8` as the installation method.

unmodified output of flake8 --bug-report

{
  "platform": {
    "python_implementation": "CPython",
    "python_version": "3.11.1",
    "system": "Linux"
  },
  "plugins": [
    {
      "plugin": "flake8-bandit",
      "version": "4.1.1"
    },
    {
      "plugin": "mccabe",
      "version": "0.7.0"
    },
    {
      "plugin": "pycodestyle",
      "version": "2.10.0"
    },
    {
      "plugin": "pyflakes",
      "version": "3.0.1"
    }
  ],
  "version": "6.0.0"
}

describe the problem

I've been using flake8 in a CI environment called with something like:

find . -name '*.py' -print0 | xargs -0 flake --output-file output.txt --tee --

When upgrading to v6.0.0 I got errors from the above command. It appears to be some interaction between --output-file and --tee.

This sequence sums up the issue pretty well. If you use the -- which indicates no further arguments it fails to operate properly. I expected the last two commands to behave the same.

$ touch a
$ flake8 ./a
$ flake8 --output-file output.txt ./a
$ flake8 --output-file output.txt -- ./a
Unable to find qualified name for module: output.txt
--output-file:0:1: E902 FileNotFoundError: [Errno 2] No such file or directory: '--output-file'
$

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions