Skip to content

oelint: Fix parsing of color enabled output#931

Merged
mfussenegger merged 4 commits into
mfussenegger:masterfrom
offa:oelint_color
Jun 25, 2026
Merged

oelint: Fix parsing of color enabled output#931
mfussenegger merged 4 commits into
mfussenegger:masterfrom
offa:oelint_color

Conversation

@offa

@offa offa commented May 28, 2026

Copy link
Copy Markdown
Contributor

If color is enabled through oelint configuration the parser wont match and no issues are reported.

Stripping the ANSI color sequences from the linter output addresses this.

If color is enabled through oelint configuration the parser wont match
and no issues are reported.

Stripping the ANSI color sequences from the linter output addresses
this.
Comment thread spec/oelint-adv_spec.lua Outdated

@mfussenegger mfussenegger left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be possible to instead override the config with some kind of argument/flag, or setting a NO_COLOR env variable?

@offa

offa commented Jun 7, 2026

Copy link
Copy Markdown
Contributor Author

Unfortunately not. The CLI allows enable only and there are no env variables for config override.

@mfussenegger

mfussenegger commented Jun 17, 2026

Copy link
Copy Markdown
Owner

Any chance to bring this up upstream to have an option to force no-colors? I'd like to avoid having to deal with this in nvim-lint. Other editor integrations likely have the same problem.

See also http://no-color.org/

offa added 2 commits June 19, 2026 18:27
If color is enabled through oelint configuration the parser wont match and no issues are reported.
@offa

offa commented Jun 19, 2026

Copy link
Copy Markdown
Contributor Author

NO_COLOR support was added in the new release 👍. I have reverted my initial approach and set NO_COLOR=1 instead.

While this works as expected when calling the parser manually, nvim-lint doesn't show any warnings. The env line sets NO_COLOR correctly, but it drops the other env vars. What’s the recommended approach here?


Update

Not touching anything at all, but just using master works now!? 🤔

@mfussenegger

Copy link
Copy Markdown
Owner

but it drops the other env vars.

That's currently sort of working as intended. It only preserves PATH if a linter has env set. Is that a problem?

Not touching anything at all, but just using master works now!?

That's odd, can you investigate more?

@offa

offa commented Jun 20, 2026

Copy link
Copy Markdown
Contributor Author

That's currently sort of working as intended. It only preserves PATH if a linter has env set. Is that a problem?

I need to look into that more carefully; that's at least how it seems.

That's odd, can you investigate more?

Error on my end, configuration file wasn't picked up correctly.

},
env = {
["NO_COLOR"] = "1",
["HOME"] = os.getenv("HOME"),

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The missing HOME caused the linter to crash because it relies on it. A naive fix is to restore it that way. Is there a better solution?

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm considering to copy the current env by default if any linter.env variables are set. But for now this seems like a good solution

@mfussenegger mfussenegger merged commit a219b2c into mfussenegger:master Jun 25, 2026
2 of 3 checks passed
@offa offa deleted the oelint_color branch June 26, 2026 08:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants