Skip to content

Issue #7: add example for MethodLength #112

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

Closed
wants to merge 1 commit into from
Closed

Issue #7: add example for MethodLength #112

wants to merge 1 commit into from

Conversation

timurt
Copy link

@timurt timurt commented Jul 19, 2020

#7

Demonstration of the case, when violations should be thrown only before patching and should be suppressed after

@romani
Copy link
Member

romani commented Jul 19, 2020

please add expected.txt
please use "//ok" and "//violation" comments on lines to show how validation is working.
origin file is not required.
please uncomment filter in config
please follow names and pattern of https://github.com/checkstyle/patch-filters/tree/master/src/test/resources/com/puppycrawl/tools/checkstyle/filters/suppressionpatchxpathfilter/MethodLength/newline
please make UT on it, it is just copy of few lines.
if test does not work(context strategy is not ready) we can mark it with Ignore with link to issue when it be implemented


I confirm that there should be no violation, as update is not related MethodLength.

@timurt
Copy link
Author

timurt commented Jul 22, 2020

@romani @rdiachenko check please

Copy link
Member

@romani romani left a comment

Choose a reason for hiding this comment

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

please do minor changes and merge:

@@ -122,4 +122,21 @@ public void testMemberName() throws Exception {
testByConfig(
"MemberName/patchedline/defaultContextConfig.xml");
}

@Test
@Ignore("MethodLength should have a violation when method length"
Copy link
Member

Choose a reason for hiding this comment

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

please put "until ", it is much easier to see where are we have problems.

public class Test {
private String name;

public void test() { // violation context, should be suppressed after patching
Copy link
Member

Choose a reason for hiding this comment

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

Test.java is always after patch.

should be suppressed after patching

we will see this in expected.txt, lets not duplicate information.
In Input files we keep comment on lines where violation is present without PatchFilter.

Copy link
Member

Choose a reason for hiding this comment

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

please make it simple // violation to show clearly that is not related to any strategy in filter.

to avoid any other confusion we might have do // violation without filter to make it absolutely clear. If you agree lets update all Inputs (in separate issue).

@@ -0,0 +1,7 @@
public class Test {
Copy link
Member

Choose a reason for hiding this comment

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

contexttwo -> context/relevant/.. or contextNotRelevant/....

@timurt timurt closed this Aug 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants