-
Notifications
You must be signed in to change notification settings - Fork 62
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
Fix: Duplication in Puml errormessages; #122
Fix: Duplication in Puml errormessages; #122
Conversation
Signed-off-by: Stephan Joneleit <[email protected]>
21e5959
to
7825108
Compare
Hi, @ZDI-StephanJoneleit , thanks for your contribution! I wonder if you could provide a test-case for this? Maybe @brandhuf could help out here? |
TestCase_ArchUniteNet_Issue121_PullRequest122.txt We hope the test case will help you. Remarks: Kind Regards, |
|
||
//Prevent failDescriptions like "does depend on X and does depend on X and does depend on Y and does depend on Y | ||
var failDescriptionCache = new List<string>(); | ||
|
||
foreach (var dependency in ruleType.GetTypeDependencies()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder:
Instead of filtering afterwards, wouldn't Distinct() operation on the dependencies list or rather a DistinctBy on the dependencies with regard to the dependency.FullName property be easier to read?
DistinctBy in LINQ can be emulated with: dependency.GroupBy(p => p.FullName).Select(g => g.First())
Could you convert the very good testcase you provided (thanks again!) into an automated test? If you don't find the time I can do this as well, but it might take a while.
I'm happy to see that ArchUnitNet made its way to Zeiss :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Distinct is now implemented and tested.
The result stays the same but is now easier to read.
The automated test will be added later.
Also we want to thank You (all) for this great Open Source Project.
It does help us a lot for our .NET/Java Health Checks.
Especially the PlantUML Support is a huge help for larger projects.
… instead of during iteration; Signed-off-by: Stephan Joneleit <[email protected]>
1b7dd47
to
a7846b0
Compare
Signed-off-by: Stephan Joneleit <[email protected]>
a2deaea
to
3db7197
Compare
Remarks: I'm sorry but I was only able to run the test with an empty global.json file; Signed-off-by: Stephan Joneleit <[email protected]>
1c3c5ac
to
8bc0147
Compare
ArchUnit.sln
Outdated
@@ -1,7 +1,7 @@ | |||
| |||
Microsoft Visual Studio Solution File, Format Version 12.00 | |||
# Visual Studio 15 | |||
VisualStudioVersion = 15.0.26430.16 | |||
# Visual Studio Version 16 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm Sorry, it looks like VS updated the Solution File on it's own.
It was not shown in the commits.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm sorry, but it didn't passed the automatic tests.
It might be due the changes in the solution file VS made on it's own (which was not shown in the commits)
and I had problems with the global.json file, which I had to clear so that the tests run.
I try my best to fix these problems.
Kind Regards:
- Joneleit, Stephan
Fix: Unsupported SDK in global.json -> SDK Version 5.0.203 cannot be downloaded on the official dotnet download page (minimun 5.0.202 which is unfortunally not 5.0.203), that's why I included rollForward; Signed-off-by: Stephan Joneleit <[email protected]>
global.json
Outdated
@@ -1,5 +1,6 @@ | |||
{ | |||
"sdk": { | |||
"version": "5.0.203" | |||
"version": "5.0.203", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I needed to change something in the global.json file.
Unfortunally, you only can download SDK Version 5.0.202 or 5.0.3xx from the official .NET Website.
Because my SDKs MUST match 5.0.203 (which you cannot download (maybe I only didn't found it) I use SDK 5.0.202 (which is lower) and SDK 5.0.3xx (which is the next feature version).
I do recommend to set version to 5.0.202 (which you still can download) and use an own rollForward (for example latestMajor/Minor (in the future when new features are added) (and on my machine was per default only installed the latest (SDK) version).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found the SDK 5.0.203 after a little deeper search.
…n the .NET Website because the Bot "Travis CI" failed (maybe due different SDK Versions); Signed-off-by: Stephan Joneleit <[email protected]>
Signed-off-by: Stephan Joneleit <[email protected]>
For some reasons the Update still does not pass throu Travis CI. I'll try my best to help you as good as I can, so feel free to contact me again. Kind Regards,
|
@fgather , do you have an Idea why it failed? Could it be due the test I wrote and included? |
|
||
var groups = splittedMessages.GroupBy(x => x.Trim().Trim('\t')); | ||
var duplications = groups.Where(x => (x.Count() > 1 | ||
&& !String.IsNullOrWhiteSpace(x.FirstOrDefault())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Switch && and || to ensure Empty strings will be ignored.
!String.IsNullOrWhitespace(x.FirstOrDefaul) && (x.Count() > 1 || firstError.Contains(x.First()))
This would protect from errors due Empty or Whitespace strings (depending on the string inside FirstError).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corrected
Signed-off-by: Stephan Joneleit <[email protected]>
Solved(?) |
…rchUnitNET should be in there) copy the classes for the PlantUML diagram to the TestAssembly (ExampleTests should only be used for examples and not for testing purposes) Signed-off-by: Fritz Brandhuber <[email protected]>
Signed-off-by: Fritz Brandhuber <[email protected]>
Signed-off-by: Fritz Brandhuber <[email protected]>
…to 121_FixDuplicationsInPumlErrormessages # Conflicts: # ArchUnitNet.MSTest.CheckErrormessages/PlantUMLErrormessagesCheck.cs
@ZDI-StephanJoneleit I created a PR to your branch with some improvements. Mainly I moved the TestClass to the ArchUnitNETTests assembly, where all tests for ArchUnitNET should be. I also copied the classes for the PlantUML file to the TestAssembly, because ExampleTest should only contain examples and should not be used for testing. I also simplified the test a bit, because it was quite complicated before. Can you please accept it? Afterwards we can merge this into master. |
…sages improvements to 121 fix duplications in puml errormessages
Assigned to Issue #121
We fixed the problem with the errormessages in puml by adding a cache like in the non-puml versions.
Duplication will be now filtered.