File tree Expand file tree Collapse file tree 3 files changed +260
-264
lines changed Expand file tree Collapse file tree 3 files changed +260
-264
lines changed Original file line number Diff line number Diff line change @@ -235,18 +235,18 @@ object Heuristics
235235 * Returns a list of language commit stats extracted from the given file.
236236 */
237237 fun analyze (file : DiffFile ) : List <CommitStats >? {
238- var buf = toBuf(file.new.content)
238+ val buf = toBuf(file.new.content)
239239 var extractor: ExtractorInterface ? = null
240240
241241 // Look for an extractor by a file extension. If failed, then fallback
242242 // to generic content analysis.
243- val extractorFactory = HeuristicsMap .get( file.extension)
243+ val extractorFactory = HeuristicsMap [ file.extension]
244244 if (extractorFactory != null ) {
245245 extractor = extractorFactory(buf)
246- }
247- else {
248- if (XMLRegex .containsMatchIn(buf))
246+ } else {
247+ if (XMLRegex .containsMatchIn(buf)) {
249248 extractor = CommonExtractor (Lang .XML )
249+ }
250250 }
251251
252252 return extractor?.extract(listOf (file))
@@ -255,7 +255,7 @@ object Heuristics
255255 /* *
256256 * Returns a portion of the file content not exceeding the limit.
257257 */
258- const val HEURISTICS_CONSIDER_BYTES = 50 * 1024
258+ private const val HEURISTICS_CONSIDER_BYTES = 50 * 1024
259259 private fun toBuf (lines : List <String >) : String {
260260 var buf = " "
261261 for (line in lines) {
Original file line number Diff line number Diff line change 44package app.hashers
55
66import app.Logger
7- // import app.hashers.VendorConventions
87import app.model.Author
98import app.model.Commit
109import app.model.DiffContent
1110import app.model.DiffFile
1211import app.model.DiffRange
1312import app.model.Repo
1413import app.utils.EmptyRepoException
15- import app.utils.FileHelper
1614import io.reactivex.Observable
1715import java.io.BufferedReader
18- import java.io.FileReader
19- import java.io.File
2016import java.io.InputStreamReader
2117import org.apache.commons.codec.digest.DigestUtils
2218import org.eclipse.jgit.api.Git
You can’t perform that action at this time.
0 commit comments