aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-squid/src
diff options
context:
space:
mode:
authorEvgeny Mandrikov <mandrikov@gmail.com>2012-02-09 00:07:24 +0400
committerEvgeny Mandrikov <mandrikov@gmail.com>2012-02-09 01:56:03 +0400
commit4eedeb8c01eb478ef0015de0a46849d781766114 (patch)
tree48c6ea53fcc20fa6efd58594355666118fe0fe73 /sonar-squid/src
parentfff856ad40b5a27148e6f1f48819797ae2f0c94f (diff)
downloadsonarqube-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.java13
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();
+ }
+
}