Skip to content

Max Line Length in style guide ignored with python 3.14 when checking multiple files #2011

Open

Description

@badguy99

how did you install flake8?

Installed on demand from TOML requirements as part of uv run command launch

unmodified output of flake8 --bug-report

{
  "platform": {
    "python_implementation": "CPython",
    "python_version": "3.14.2",
    "system": "Linux"
  },
  "plugins": [
    {
      "plugin": "mccabe",
      "version": "0.7.0"
    },
    {
      "plugin": "pep8-naming",
      "version": "0.15.1"
    },
    {
      "plugin": "pycodestyle",
      "version": "2.14.0"
    },
    {
      "plugin": "pyflakes",
      "version": "3.4.0"
    }
  ],
  "version": "7.3.0"
}

describe the problem

what I expected to happen

when using flake8 programmatically it should be possible to check multiple files with the configured style guide. This works correctly with python3.12 but seems to be ignored when using python 3.14

set up style guide

Python 3.14.2 (main, Jan  9 2026, 09:06:43) [GCC 8.5.0 20210514 (Red Hat 8.5.0-28.0.1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
Ctrl click to launch VS Code Native REPL
>>> from flake8.api import legacy as flake8
>>> ignore_list = []
>>> line_length = 88
>>> style_guide = flake8.get_style_guide(extend_ignore=ignore_list, max_line_length=line_length, color="never")
>>> style_guide.options
Namespace(verbose=0, output_file=None, append_config=[], config=None, isolated=False, enable_extensions=None, require_plugins=None, filenames=[], quiet=0, color='never', count=False, exclude=['.svn', 'CVS', '.bzr', '.hg', '.git', '__pycache__', '.tox', '.nox', '.eggs', '*.egg'], extend_exclude=[], filename=['*.py'], stdin_display_name='stdin', format='default', hang_closing=False, ignore=None, extend_ignore=[], per_file_ignores='', max_line_length=88, max_doc_length=None, indent_size=4, select=None, extend_select=None, disable_noqa=False, show_source=False, statistics=False, exit_zero=False, jobs=JobsArgument('auto'), tee=False, benchmark=False, bug_report=False, max_complexity=-1, ignore_names=['setUp', 'tearDown', 'setUpClass', 'tearDownClass', 'setUpModule', 'tearDownModule', 'asyncSetUp', 'asyncTearDown', 'setUpTestData', 'failureException', 'longMessage', 'maxDiff'], classmethod_decorators=['classmethod'], staticmethod_decorators=['staticmethod'], builtins=None, doctests=False, extended_default_ignore=['N818'], extended_default_select=['C90', 'N8', 'F', 'E', 'W'])

Check files ignores the set max_line_length when running with multiple files

>>> style_guide.check_files(['file1.py', 'file2.py'])
file1.py:65:80: E501 line too long (88 > 79 characters)
file1.py:66:80: E501 line too long (85 > 79 characters)
file2.py:17:80: E501 line too long (81 > 79 characters)
file2.py:18:80: E501 line too long (87 > 79 characters)
file2.py:19:80: E501 line too long (88 > 79 characters)
<flake8.api.legacy.Report object at 0x7f070003b4d0>

However running the files individually works ok, and then it is possible to run the two files in the same check correctly

>>> style_guide.check_files(['file1.py'])
<flake8.api.legacy.Report object at 0x7f06ffc50690>
>>> style_guide.check_files(['file2.py'])
<flake8.api.legacy.Report object at 0x7f06ffc507d0>
>>> 
>>> 
>>> style_guide.check_files(['file1.py', 'file2.py'])
<flake8.api.legacy.Report object at 0x7f07001223f0>

Activity

  1. sigmavirus24 commented on Jan 16, 2026

    @sigmavirus24
    Member

    What happens when you run it from the CLI with verbose logging?

  2. badguy99 commented on Jan 16, 2026

    @badguy99
    Author

    It works from CLI

    > flake8 -v  --max-line-length 88 file1.py file2.py 
    flake8.checker            MainProcess    231 INFO     Making checkers
    flake8.main.application   MainProcess    521 INFO     Finished running
    flake8.main.application   MainProcess    521 INFO     Reporting errors
    flake8.main.application   MainProcess    521 INFO     Found a total of 0 violations and reported 0
    

    If I turn the verbosity up further, it looks like one file is on ForkServerPoolWorker-1 and the other file is on ForkServerPoolWorker-2

  3. sigmavirus24 commented on Jan 16, 2026

    @sigmavirus24
    Member

    You can set the verbosity on the python code as well to try to indicate difference between the two behaviors

  4. badguy99 commented on Jan 19, 2026

    @badguy99
    Author

    Frustratingly trying to set verbosity in the style guide programmatically runs in to the same issue, where specifying more than one file in the check_files list ignores all the options, then if you check just a single item list it is fine, and then it is also fine if you go back to the same two file list...

    > python
    Python 3.14.2 (main, Jan  9 2026, 09:06:43) [GCC 8.5.0 20210514 (Red Hat 8.5.0-28.0.1)] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    Ctrl click to launch VS Code Native REPL
    >>> from flake8.api import legacy as flake8
    >>> ignore_list = []
    >>> line_length = 88
    >>> verbose = 4
    >>> style_guide = flake8.get_style_guide(extend_ignore=ignore_list, max_line_length=line_length, color="never", verbose=verbose)
    >>> style_guide.options
    Namespace(verbose=4, output_file=None, append_config=[], config=None, isolated=False, enable_extensions=None, require_plugins=None, filenames=[], quiet=0, color='never', count=False, exclude=['.svn', 'CVS', '.bzr', '.hg', '.git', '__pycache__', '.tox', '.nox', '.eggs', '*.egg'], extend_exclude=[], filename=['*.py'], stdin_display_name='stdin', format='default', hang_closing=False, ignore=None, extend_ignore=[], per_file_ignores='', max_line_length=88, max_doc_length=None, indent_size=4, select=None, extend_select=None, disable_noqa=False, show_source=False, statistics=False, exit_zero=False, jobs=JobsArgument('auto'), tee=False, benchmark=False, bug_report=False, max_complexity=-1, ignore_names=['setUp', 'tearDown', 'setUpClass', 'tearDownClass', 'setUpModule', 'tearDownModule', 'asyncSetUp', 'asyncTearDown', 'setUpTestData', 'failureException', 'longMessage', 'maxDiff'], classmethod_decorators=['classmethod'], staticmethod_decorators=['staticmethod'], builtins=None, doctests=False, extended_default_ignore=['N818'], extended_default_select=['C90', 'N8', 'F', 'E', 'W'])
    
    
    >>> style_guide.check_files(['file1.py', 'file2.py'])
    file1.py:40:80: E501 line too long (87 > 79 characters)
    file1.py:62:80: E501 line too long (88 > 79 characters)
    file2.py:38:80: E501 line too long (81 > 79 characters)
    <flake8.api.legacy.Report object at 0x7f05319f74d0>
    >>> 
    
    
    >>> 
    >>> style_guide.check_files(['file1.py'])
    >>>     """Run pyflakes on the Python libraries.
    >>>     """Run pycodestyle (formally known as pep8).
    >>>     style = pycodestyle.StyleGuide(
    bracket depth 1 seen, col 34, visual min = 0
    ...         quiet=False,
    ...         max_line_length=line_length,
    ...         ignore=ignore_list,
    ...     )
    >>>         msg = (
    <snip>
    <flake8.api.legacy.Report object at 0x7f0531620690>
    >>> 
    
  5. abdiwaliosman47-cmd commented on Sep 30, 2026

    @abdiwaliosman47-cmd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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