question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Flakeheaven ignores baseline when using absolute path to file

See original GitHub issue

flakeheaven lint filename.py is clean because of baseline, but flakeheaven lint $(basename filename.py) gives errors.

As a minimal example, save the following file as flake8heavened

#!/usr/bin/env python
# -*- coding: utf-8 -*-
import re
import sys
from flakeheaven import flake8_entrypoint
if __name__ == '__main__':
    sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
    sys.exit(flake8_entrypoint())

Run flakeheaven baseline flake8helled >> .flakeheaven_baseline Then flakeheaven lint flake8helled is clean, but flakeheaven lint $(realpath flake8helled) is not.

This is an issue because VS Code (and may be other IDEs) use the absolute path to the files.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:10

github_iconTop GitHub Comments

1reaction
snmishracommented, Feb 4, 2022

@mcarans Thanks for merging in record time!

1reaction
snmishracommented, Feb 2, 2022

@mcarans I never used flakehell. I did try flakehell, but it was incompatible with flake8 4.0.0, discovered flakeheaven. The relevant code appears to be identical in flakehell.

I don’t think this is a bug, but a limitation of how the baseline is calculated. Currently, the filename is hashed as is, without considering whether it’s a relative or an absolute path. I wanted to check-in the baseline to git so we can share it across all developers. Since every developer will have a different abspath, it makes sense to use relative paths.

Unfortunately, VS Code (I haven’t checked other IDEs) uses absolute path to run the flake8 checks, which means the baseline file is ignored in the integration. Command-line works fine, of course.

Read more comments on GitHub >

github_iconTop Results From Across the Web

baseline for legacy projects · Issue #330 · PyCQA/flake8 · GitHub
flake8baseline to save all violations you already have into a json file. Then when you run your linter as flake8 --baseline=PATH all old...
Read more >
flakeheaven - PyPI
flakeheaven is a python linter built around flake8 to enable inheritable and complex toml configuration. This project is a fork of FlakeHell. FlakeHell...
Read more >
gitignore - Global Git Ignore with absolute path - Stack Overflow
First, it's worth mentioning a tricky bit about ignore file patterns: if they contain a leading or an embedded slash, they apply across ......
Read more >
What problem is Flakeheaven solving? : r/learnpython - Reddit
Short answer: flakeheaven is a python linter. It works on top of flake8 and adds some extensions and customization: pyproject.toml support. per- ...
Read more >
Path.GetFullPath Method (System.IO) - Microsoft Learn
The file or directory for which to obtain absolute path information. Returns. String. The fully qualified location of path , such as "C:\MyFile.txt"....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found