From 0cc473e04f76ecbb551349fb81a87300d23945b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20K=C3=BChne?= Date: Mon, 20 Oct 2008 21:50:18 +0000 Subject: [PATCH] The NCSS complexity checker reported an incorrect fileMax value (bug #2161419). --- .../checkstyle/checks/metrics/JavaNCSSCheck.java | 2 +- .../checkstyle/checks/metrics/JavaNCSSCheckTest.java | 12 ++++++------ src/xdocs/releasenotes.xml | 5 ++++- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/metrics/JavaNCSSCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/metrics/JavaNCSSCheck.java index 1b894c198..c74d85652 100755 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/metrics/JavaNCSSCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/metrics/JavaNCSSCheck.java @@ -200,7 +200,7 @@ public class JavaNCSSCheck extends Check final int count = counter.getCount(); if (count > mFileMax) { log(aRootAST.getLineNo(), aRootAST.getColumnNo(), "ncss.file", - count, mMethodMax); + count, mFileMax); } } diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/metrics/JavaNCSSCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/metrics/JavaNCSSCheckTest.java index 5a289e555..723493600 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/metrics/JavaNCSSCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/metrics/JavaNCSSCheckTest.java @@ -18,18 +18,18 @@ public class JavaNCSSCheckTest extends BaseCheckTestSupport DefaultConfiguration checkConfig = createCheckConfig(JavaNCSSCheck.class); checkConfig.addAttribute("methodMaximum", "0"); - checkConfig.addAttribute("classMaximum", "0"); - checkConfig.addAttribute("fileMaximum", "0"); + checkConfig.addAttribute("classMaximum", "1"); + checkConfig.addAttribute("fileMaximum", "2"); String[] expected = { - "2:1: NCSS for this file is 35 (max allowed is 0).", - "9:1: NCSS for this class is 22 (max allowed is 0).", + "2:1: NCSS for this file is 35 (max allowed is 2).", + "9:1: NCSS for this class is 22 (max allowed is 1).", "14:5: NCSS for this method is 2 (max allowed is 0).", "21:5: NCSS for this method is 4 (max allowed is 0).", "30:5: NCSS for this method is 12 (max allowed is 0).", "42:13: NCSS for this method is 2 (max allowed is 0).", - "49:5: NCSS for this class is 2 (max allowed is 0).", - "56:1: NCSS for this class is 10 (max allowed is 0).", + "49:5: NCSS for this class is 2 (max allowed is 1).", + "56:1: NCSS for this class is 10 (max allowed is 1).", "61:5: NCSS for this method is 8 (max allowed is 0).",}; verify(checkConfig, getPath("metrics" + File.separator diff --git a/src/xdocs/releasenotes.xml b/src/xdocs/releasenotes.xml index cd2c13892..f06da0d24 100755 --- a/src/xdocs/releasenotes.xml +++ b/src/xdocs/releasenotes.xml @@ -28,7 +28,10 @@

Fixed Bugs:

Notes: