Issue 1:
The below was reported by @HDembinski in a comment on gh-15489. That should be considered a bug if it's indeed not matching, so this should be looked at.

python dev.py lint should also runflake8, but for the PEP8 part should be the same. Can you point to a branch where you see one failing but the other passing?

Sorry, I don't have a clean reproducer, but I think this patch here

0545e5e

was a change that I made after python dev.py lint gave me no complains (about my new code), but python tools/lint_diff.py run by the CI job found those issues. I haven't looked into the implementation, but these two commands apparently do not apply the same rules.

Issue 2:
Describe your issue.

Currently there are two ways to lint changes locally. tools/lint_diff.py behaves as expected (and is what is ran in the CI job) whereas dev.py lint picks up lots up unrelated changes.

Reproducing Code Example

N/A

Error message

(scipy-dev) python tools/lint_diff.py
No lint errors found.
(scipy-dev) python dev.py lint
scipy/interpolate/tests/test_interpolate.py:539:19: E275 missing whitespace after keyword
scipy/spatial/tests/test_distance.py:2082:15: E275 missing whitespace after keyword
scipy/stats/_continuous_distns.py:697:15: E275 missing whitespace after keyword
scipy/stats/_continuous_distns.py:4424:15: E275 missing whitespace after keyword
scipy/stats/_discrete_distns.py:371:15: E275 missing whitespace after keyword
scipy/stats/_binned_statistic.py:570:7: E275 missing whitespace after keyword
scipy/stats/_binned_statistic.py:676:7: E275 missing whitespace after keyword
scipy/stats/tests/test_resampling.py:867:15: E275 missing whitespace after keyword
scipy/stats/tests/test_discrete_distns.py:475:15: E275 missing whitespace after keyword
scipy/stats/tests/test_axis_nan_policy.py:918:11: E275 missing whitespace after keyword
scipy/stats/tests/test_axis_nan_policy.py:919:11: E275 missing whitespace after keyword
scipy/stats/tests/test_axis_nan_policy.py:920:11: E275 missing whitespace after keyword
scipy/stats/tests/test_stats.py:4696:15: E275 missing whitespace after keyword
scipy/stats/tests/test_stats.py:4697:15: E275 missing whitespace after keyword
scipy/stats/tests/test_stats.py:4698:15: E275 missing whitespace after keyword
scipy/stats/tests/test_stats.py:4815:19: E275 missing whitespace after keyword
scipy/stats/tests/test_stats.py:4816:19: E275 missing whitespace after keyword
scipy/stats/tests/test_hypotests.py:472:15: E275 missing whitespace after keyword
scipy/stats/tests/test_hypotests.py:473:15: E275 missing whitespace after keyword
scipy/stats/tests/test_hypotests.py:479:15: E275 missing whitespace after keyword
scipy/stats/tests/test_hypotests.py:483:15: E275 missing whitespace after keyword
scipy/stats/tests/test_hypotests.py:484:15: E275 missing whitespace after keyword
scipy/stats/tests/test_sampling.py:404:19: E275 missing whitespace after keyword
scipy/stats/tests/test_sampling.py:1125:19: E275 missing whitespace after keyword
scipy/signal/_filter_design.py:2344:15: E275 missing whitespace after keyword
scipy/signal/_peak_finding.py:64:7: E275 missing whitespace after keyword
scipy/signal/_peak_finding.py:77:11: E275 missing whitespace after keyword
scipy/signal/_peak_finding.py:1062:7: E275 missing whitespace after keyword
scipy/signal/_peak_finding.py:1069:7: E275 missing whitespace after keyword
scipy/signal/_peak_finding.py:1099:15: E275 missing whitespace after keyword
scipy/signal/_peak_finding.py:1104:15: E275 missing whitespace after keyword
scipy/signal/tests/test_signaltools.py:1293:15: E275 missing whitespace after keyword
scipy/signal/tests/test_signaltools.py:1301:15: E275 missing whitespace after keyword
scipy/sparse/csgraph/tests/test_shortest_path.py:196:14: E275 missing whitespace after keyword
scipy/sparse/csgraph/tests/test_shortest_path.py:197:19: E275 missing whitespace after keyword
scipy/sparse/linalg/_eigen/lobpcg/tests/test_lobpcg.py:268:11: E275 missing whitespace after keyword
scipy/optimize/_linprog_util.py:305:15: E275 missing whitespace after keyword
scipy/optimize/_linprog_util.py:344:15: E275 missing whitespace after keyword
scipy/optimize/_linprog_util.py:383:15: E275 missing whitespace after keyword
scipy/optimize/_remove_redundancy.py:88:11: E275 missing whitespace after keyword
scipy/optimize/_dual_annealing.py:204:27: E275 missing whitespace after keyword
scipy/optimize/_dual_annealing.py:672:10: E275 missing whitespace after keyword
scipy/optimize/_linprog_ip.py:263:14: E275 missing whitespace after keyword
scipy/optimize/tests/test_zeros.py:426:23: E275 missing whitespace after keyword
scipy/optimize/tests/test_zeros.py:693:11: E275 missing whitespace after keyword
scipy/optimize/tests/test_zeros.py:697:11: E275 missing whitespace after keyword
scipy/optimize/tests/test_zeros.py:716:11: E275 missing whitespace after keyword
scipy/optimize/tests/test__differential_evolution.py:483:19: E275 missing whitespace after keyword
scipy/optimize/tests/test_differentiable_functions.py:145:15: E275 missing whitespace after keyword
scipy/optimize/tests/test_differentiable_functions.py:155:15: E275 missing whitespace after keyword
scipy/optimize/tests/test_differentiable_functions.py:158:15: E275 missing whitespace after keyword
scipy/io/arff/_arffread.py:189:11: E275 missing whitespace after keyword
scipy/integrate/_odepack_py.py:235:11: E275 missing whitespace after keyword
scipy/integrate/tests/test_quadpack.py:640:15: E275 missing whitespace after keyword
scipy/special/_basic.py:1784:11: E275 missing whitespace after keyword
scipy/linalg/_matfuncs.py:872:11: E275 missing whitespace after keyword
scipy/linalg/tests/test_lapack.py:1470:19: E275 missing whitespace after keyword
scipy/linalg/tests/test_lapack.py:1494:27: E275 missing whitespace after keyword
scipy/linalg/tests/test_lapack.py:1511:31: E275 missing whitespace after keyword
scipy/linalg/tests/test_lapack.py:1537:23: E275 missing whitespace after keyword
scipy/linalg/tests/test_lapack.py:1573:31: E275 missing whitespace after keyword
scipy/linalg/tests/test_lapack.py:1593:35: E275 missing whitespace after keyword
scipy/linalg/tests/test_decomp.py:2334:23: E275 missing whitespace after keyword

### SciPy/NumPy/Python version information

1.10.0.dev0+2164.77a8ec1 1.23.2 sys.version_info(major=3, minor=10, micro=6, releaselevel='final', serial=0)