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

Option --report-uncovered placed before --config-file makes deptrac ignore the provided configuration file #1425

Open
Fractaos opened this issue Jun 25, 2024 · 2 comments · May be fixed by qossmic/deptrac-src#62
Labels

Comments

@Fractaos
Copy link

Tested on: 2.0.1

Hello, while doing some tests on a project, I figured out that somehow, when placing the flag --report-uncovered (or --fail-on-uncovered) before specifying the configuration file through the --config-file option, this last one is ignored and deptrac tries to use the default configuration file instead.

The problem doesn't occur for the --no-cache flag for instance but I've not tested the other ones.

Examples:

Running tools/vendor/bin/deptrac analyze --config-file=deptrac_hexagonal.yaml --report-uncovered will works properly, with the following output:

 57/57 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%


 -------------------- ----- 
  Report                    
 -------------------- ----- 
  Violations           0    
  Skipped violations   0    
  Uncovered            0    
  Allowed              250  
  Warnings             0    
  Errors               0    
 -------------------- ----- 

But running tools/vendor/bin/deptrac analyze --report-uncovered --config-file=deptrac_hexagonal.yaml will give me an error due to deptrac.yml not being found:

In CannotLoadConfiguration.php line 12:
                                                                                                 
  Could not load deptrac.yaml. Reason: The file "deptrac.yaml" does not exist (in: "/var/www").  

For additional information, I tested the same operation on another project where qossmic/deptrac-shim:1.0.2 is installed instead and it seems to work without any issue.

@gennadigennadigennadi
Copy link
Member

image
The problem is that as soon as there is a not defined argument the bind will throw and stop parsing the other args.

If I remember correctly the reason for this behaviour has something to do with sharing common configs over the commands.

@dbrumann, @patrickkusebauch Am I right?

@gennadigennadigennadi
Copy link
Member

gennadigennadigennadi commented Jun 25, 2024

A quick fix would be to use $input->getParameterOption('--config-file') instead of $input->getOption('config-file');

Maybe just revert this commit: qossmic/deptrac-src@703b212 ?

LeSuisse pushed a commit to Enalean/tuleap that referenced this issue Oct 4, 2024
Closes request #39741: qossmic/deptrac-shim: 1.0.2 -> qossmic/deptrac:
2.0.1

No functional change. CI should be happy.

Notes:
- "regex" configuration is now "value".
- I could not make the "class" collector work, defaulting to
"classLike".
- Due to a bug [0], the `--report-uncovered` and `--fail-on-uncovered`
flags MUST come after `--config-file`, or deptrac will not find the file
and raise an error that it did not find `deptrac.yaml` (the default
file).
- There are still 7 existing core -> plugins violations, but for an
unknown reason, deptrac does not see them on the CI:
  PermissionsManager:
    - Tuleap\Tracker\TrackerDuplicationUserGroupMapping
  PermissionsDao:
    - Tuleap\Tracker\TrackerDuplicationType
    - Tuleap\Tracker\TrackerDuplicationUserGroupMapping
  Tuleap\Reference\CrossReferenceManager:
    - Tuleap\Tracker\Artifact\Artifact
    - Tuleap\Tracker\Artifact\ArtifactsDeletion\DeletionContext
  Tuleap\Project\UGroups\XML\XMLUserGroup
    - Tuleap\Tracker\XML\XMLUser

[0] qossmic/deptrac#1425

Change-Id: Ifc5d7ea1735d56cd3909b87f3130bd7189056162
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants