SAP / ui5-linter

A static code analysis tool for UI5
Apache License 2.0
40 stars 0 forks source link

ANSI codes were not removed when saving linter report to a file as part of an AzDO pipeline #175

Open marcelschork opened 1 week ago

marcelschork commented 1 week ago

Expected Behavior

When saving the results of the linter to a file the ANSI codes should always be removed.

Current Behavior

When saving the results of the linter to a file within a CI pipeline on AzDO the ANSI codes were not removed. Running the same command on the terminal (MacOS 13.2.1 + zsh/bash) the ANSI codes are removed and everything is fine.

We are writing the lint results back to a pull request in AzDO and this is how it is looking like (without the sed workaround being applied)

image

I did not yet check any other CI/CD platform like GitHub Actions, Jenkins, etc.

Steps to Reproduce the Issue

  1. Take any UI5 application with some ui5lint errors
  2. Create a build pipeline in AzDo
    
    pool:
    vmImage: 'ubuntu-latest'

steps:

Context

RandomByte commented 1 week ago

It looks like that environment does not support the formatting/coloring we are doing using chalk. Such environments should be detected by chalk itself (through supports-color). But I recall similar issues with Azure in the past.

If possible, could you test whether setting the environment variable CI=true for the ui5lint command resolves this?

marcelschork commented 1 hour ago

I just tested it. Setting the env variable CI to true and running the linter does not solve the issue. Then I checked the chalk GitHub repo and FORCE_COLOR=0 is what I was looking for. We may can add it to the documentation.