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

Add Relative Path to Report Output #706

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

ttomdewit
Copy link

@ttomdewit ttomdewit commented Dec 7, 2019

Type: (feature)
Issue: Resolves #704
Breaking change: no

Explain what the PR does and also why. If you have parts you are not sure about, please explain.

This PR adds a baseName key to the report that'll allow for easier reading. In my case I need the baseName key for GitLab CI/CD.

Please check this points before submitting your PR.

  • Add test to cover the changes you made on the code.
  • If you have a change on the documentation, please link to the page that you change.
  • If you add a new feature please update the documentation in the same PR.
  • If you really need to add a breaking change, explain why it is needed. Understand that this result in a lower change to get the PR accepted.
  • Any PR need 2 approvals before it get merged, sometimes this can take some time. Please be patient.

Copy link
Member

@kylekatarnls kylekatarnls left a comment

Choose a reason for hiding this comment

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

The tests will need to cover getBaseName new method. Right now it does not because the violation class is mocked.

But if you have trouble, I can add them.

src/test/php/PHPMD/AbstractTest.php Outdated Show resolved Hide resolved
Copy link
Author

@ttomdewit ttomdewit left a comment

Choose a reason for hiding this comment

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

The tests will need to cover getBaseName new method. Right now it does not because the violation class is mocked.

But if you have trouble, I can add them.

This I don't fully understand. Can you help?

*
* @return string
*/
public function getBaseName()
Copy link
Author

Choose a reason for hiding this comment

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

Would it be beneficial if we move this method up, such as getFileName() on line 141? I suggest we move it next to \PDepend\Source\AST\ASTCompilationUnit::getFileName. Would that be a better idea?

Copy link
Member

Choose a reason for hiding this comment

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

That can be a good idea, but we need to take care that it means we also need to upper the minimum PDepend version for PHPMD. You can create a PR on PDepend, that means that we need to create a new release for that project before merging this PR.

@tvbeek
Copy link
Member

tvbeek commented Dec 23, 2019

The tests will need to cover getBaseName new method. Right now it does not because the violation class is mocked.
But if you have trouble, I can add them.

This I don't fully understand. Can you help?

Because your addition on the getRuleViolationMock function in the src/test/php/PHPMD/AbstractTest.php class you mock the getBaseName method. That is useful for the other tests. But now your change on the src/test/php/PHPMD/Renderer/JSONRendererTest.php and the src/test/resources/files/renderer/json_renderer_expected.json doesn't really test the newly added method.

The most visible way to validate it is by running phpunit with the option --coverage-html=path/to/coverage/dir, then open index.html in path/to/coverage/dir (or what you choose) and navigate to the file that you changed. You will see that getBaseName from the RuleViolation isn't coveraged by the test.

@ravage84 ravage84 changed the title Add baseName key to report Add Relative Path to Report Output Apr 19, 2020
@ravage84 ravage84 added this to the 2.9.0 milestone Apr 29, 2020
@ravage84
Copy link
Member

ravage84 commented May 6, 2020

@ttomdewit are you still interested in pursuing this?

@ttomdewit
Copy link
Author

@ravage84 Yes, but I’m recovering from burnout and dealing with depression so I’m not able to commit to anything I’m afraid.

@ravage84
Copy link
Member

ravage84 commented May 6, 2020

@ttomdewit no worries. We can keep it open for you. Have a good recovery.

@tvbeek tvbeek modified the milestones: 2.9.0, 2.10.0 Sep 2, 2020
@kylekatarnls kylekatarnls modified the milestones: 2.10.0, 2.11.0 Apr 11, 2021
@kylekatarnls kylekatarnls modified the milestones: 2.11.0, 2.12.0 Nov 27, 2021
@kylekatarnls kylekatarnls modified the milestones: 2.12.0, 2.13.0 Jun 19, 2022
@kylekatarnls kylekatarnls modified the milestones: 2.13.0, 2.14.0 Sep 10, 2022
@kylekatarnls kylekatarnls modified the milestones: 2.14.0, 2.15.0 Sep 27, 2023
@kylekatarnls kylekatarnls removed this from the 2.15.0 milestone Dec 10, 2023
@kylekatarnls kylekatarnls added this to the 2.16.0 milestone Dec 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

Add Relative Path to Report Output
4 participants