-
-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathFileUtil.java
More file actions
37 lines (30 loc) · 1.12 KB
/
FileUtil.java
File metadata and controls
37 lines (30 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package org.overengineer.inlineproblems.utils;
import org.overengineer.inlineproblems.settings.SettingsState;
public class FileUtil {
/**
* Returns true if the file should be ignored, current checks involve the file name and the line count
* @param fileName can be null to ignore
* @param lineCount can be -1 to ignore
* @return true if the file should be ignored, false otherwise
*/
public static boolean ignoreFile(String fileName, int lineCount) {
boolean ignore = false;
var settings = SettingsState.getInstance();
if (fileName != null) {
for (var e : settings.getFileExtensionBlacklist().split(";")) {
if (e.isBlank() || e.isEmpty() || e.equals(";")) continue;
if (fileName.endsWith(e)) {
ignore = true;
break;
}
}
}
if (lineCount >= 0) {
var maxFileLines = settings.getMaxFileLines();
if (maxFileLines >= 0 && lineCount >= maxFileLines) {
ignore = true;
}
}
return ignore;
}
}