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
235
235
* Returns a list of language commit stats extracted from the given file.
236
236
*/
237
237
fun analyze (file : DiffFile ) : List <CommitStats >? {
238
- var buf = toBuf(file.new.content)
238
+ val buf = toBuf(file.new.content)
239
239
var extractor: ExtractorInterface ? = null
240
240
241
241
// Look for an extractor by a file extension. If failed, then fallback
242
242
// to generic content analysis.
243
- val extractorFactory = HeuristicsMap .get( file.extension)
243
+ val extractorFactory = HeuristicsMap [ file.extension]
244
244
if (extractorFactory != null ) {
245
245
extractor = extractorFactory(buf)
246
- }
247
- else {
248
- if (XMLRegex .containsMatchIn(buf))
246
+ } else {
247
+ if (XMLRegex .containsMatchIn(buf)) {
249
248
extractor = CommonExtractor (Lang .XML )
249
+ }
250
250
}
251
251
252
252
return extractor?.extract(listOf (file))
@@ -255,7 +255,7 @@ object Heuristics
255
255
/* *
256
256
* Returns a portion of the file content not exceeding the limit.
257
257
*/
258
- const val HEURISTICS_CONSIDER_BYTES = 50 * 1024
258
+ private const val HEURISTICS_CONSIDER_BYTES = 50 * 1024
259
259
private fun toBuf (lines : List <String >) : String {
260
260
var buf = " "
261
261
for (line in lines) {
Original file line number Diff line number Diff line change 4
4
package app.hashers
5
5
6
6
import app.Logger
7
- // import app.hashers.VendorConventions
8
7
import app.model.Author
9
8
import app.model.Commit
10
9
import app.model.DiffContent
11
10
import app.model.DiffFile
12
11
import app.model.DiffRange
13
12
import app.model.Repo
14
13
import app.utils.EmptyRepoException
15
- import app.utils.FileHelper
16
14
import io.reactivex.Observable
17
15
import java.io.BufferedReader
18
- import java.io.FileReader
19
- import java.io.File
20
16
import java.io.InputStreamReader
21
17
import org.apache.commons.codec.digest.DigestUtils
22
18
import org.eclipse.jgit.api.Git
You can’t perform that action at this time.
0 commit comments