Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CodeClimate Report: location/path must be set from repository root #1064

Open
codegain opened this issue Dec 21, 2022 · 3 comments
Open

CodeClimate Report: location/path must be set from repository root #1064

codegain opened this issue Dec 21, 2022 · 3 comments

Comments

@codegain
Copy link

Hi,

the code-climate report generated with -f codeclimate has an issue: The entry for location/path per issue must be set relative to the repository root. Currently this is set as an absolute path.

This is a problem for GitLab CI which sets an URL in its interface relative to this path in the repository. This is also stated in the GitLab CI documentation: https://docs.gitlab.com/ee/ci/testing/code_quality.html#implementing-a-custom-tool

location.path | The relative path to the file containing the code quality violation.

F.e.:

[
    {
        "type": "issue",
        "check_name": "Dependency violation",
        "description": "App\\GreetingService has uncovered dependency on App\\Greeting\\GreetingInterface (Interface)",
        "categories": [
            "Style",
            "Complexity"
        ],
        "severity": "major",
        "location": {
            "path": "\/builds\/group\/example\/src\/GreetingService.php",
            "lines": {
                "begin": 9
            }
        }
    },

which generates a URL in GitLab like https://gitlab.com/group/example/-/blob/9013bc9744e99436767e0ef57d0fbcf6a7f5//builds/group/example/src/GreetingService.php#L9

Possible solution: Cut everything from the path up to the working directory of deptrac or determine path based on paths in the deptrac config/option.

@dbrumann
Copy link
Collaborator

I might have some time this Friday (or maybe next one) to look into this. I think an additional option for the formatter might be a good idea. Something like relativePathBase and then we can just use Path::makeRelative() when its set. If you like, you can also create a PR, if you want to contribute the fix yourself.

@juagarc4
Copy link

If no one else works already on this one, I would give it a try.

@patrickkusebauch
Copy link
Collaborator

@juagarc4 nobody is, feel free to pick it up. 🙂

@juagarc4 juagarc4 self-assigned this Apr 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants