diff options
author | Evgeny Mandrikov <mandrikov@gmail.com> | 2012-02-09 00:07:24 +0400 |
---|---|---|
committer | Evgeny Mandrikov <mandrikov@gmail.com> | 2012-02-09 01:56:03 +0400 |
commit | 4eedeb8c01eb478ef0015de0a46849d781766114 (patch) | |
tree | 48c6ea53fcc20fa6efd58594355666118fe0fe73 /sonar-squid/src | |
parent | fff856ad40b5a27148e6f1f48819797ae2f0c94f (diff) | |
download | sonarqube-4eedeb8c01eb478ef0015de0a46849d781766114.tar.gz sonarqube-4eedeb8c01eb478ef0015de0a46849d781766114.zip |
SONAR-3210 Compute new measure for Java files - LoC in file
Diffstat (limited to 'sonar-squid/src')
-rw-r--r-- | sonar-squid/src/main/java/org/sonar/squid/text/Source.java | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/sonar-squid/src/main/java/org/sonar/squid/text/Source.java b/sonar-squid/src/main/java/org/sonar/squid/text/Source.java index 7b29770f87d..f7a7339e55f 100644 --- a/sonar-squid/src/main/java/org/sonar/squid/text/Source.java +++ b/sonar-squid/src/main/java/org/sonar/squid/text/Source.java @@ -19,6 +19,7 @@ */ package org.sonar.squid.text; +import com.google.common.annotations.Beta; import org.sonar.squid.measures.Metric; import org.sonar.squid.recognizer.CodeRecognizer; @@ -107,6 +108,9 @@ public class Source { return getMeasure(metric, 1, lines.size()); } + /** + * Numbering of lines starts from 1. + */ public int getMeasure(Metric metric, int fromLine, int toLine) { if (toLine > lines.size()) { throw new IllegalStateException("There are only " + lines.size() + " lines in the file and you're trying to reach line " + toLine); @@ -125,4 +129,13 @@ public class Source { public Set<Integer> getNoSonarTagLines() { return noSonarTagLines; } + + /** + * @since 2.14 + */ + @Beta + public int getNumberOfLines() { + return lines.size(); + } + } |