Task 2 4 1#15
Conversation
|
|
|
|
|
| html.append("table{border-collapse:collapse;margin:10px 0;} "); | ||
| html.append("th,td{border:1px solid #000;padding:4px 8px;} "); | ||
| html.append("caption{text-align:left;font-weight:bold;padding:4px 0;} "); | ||
| html.append("</style></head><body>\n"); |
There was a problem hiding this comment.
объединить в один textblock?
| continue; | ||
| } | ||
|
|
||
| html.append("<h2>Группа ").append(escape(group.getName())).append("</h2>\n"); |
There was a problem hiding this comment.
более читаемый вариант сделать строку с плейсхолдером либо %s и через format подставить group.getName()
|
|
||
| private String labTable(Lab lab, List<StudentReport> reports) { | ||
| StringBuilder sb = new StringBuilder(); | ||
| sb.append("<table><caption>Лабораторная ").append(escape(lab.getId())) |
There was a problem hiding this comment.
аналогично коментам выше
| public int countViolations(File projectDir) { | ||
| File srcRoot = findJavaSrc(projectDir); | ||
| if (srcRoot == null) { | ||
| return -1; |
There was a problem hiding this comment.
может исключения для ошибок использовать все-таки?)
| File tmp = File.createTempFile("google_checks", ".xml"); | ||
| tmp.deleteOnExit(); | ||
| FileOutputStream out = new FileOutputStream(tmp); | ||
| byte[] buf = new byte[4096]; |
| return out.substring(idx + 1); | ||
| } | ||
| } | ||
| for (String b : new String[]{"main", "master"}) { |
There was a problem hiding this comment.
new String[]{"main", "master"}
это очень круто, но давайте в какой-нибудь константный лист в классе вынесем
| } | ||
|
|
||
| /** Запускает команду и возвращает результат. */ | ||
| public static Result run(File workDir, long timeoutSeconds, String... command) |
There was a problem hiding this comment.
может добавим немного ооп?
| public class App { | ||
|
|
||
| /** Парсит команду, находит DSL-скрипт и запускает проверку. */ | ||
| public static void main(String[] args) throws Exception { |
There was a problem hiding this comment.
давайте не кидаться исключениями, а ловить их и выводить пользователю инфу об ошибке
| File script = new File(workDir, "oop-checker.groovy"); | ||
| if (!script.exists()) { | ||
| System.err.println("В рабочей директории не найден oop-checker.groovy"); | ||
| System.exit(1); |
|
|
||
| Config config = new DslLoader().load(script); | ||
|
|
||
| if (command.equals("test") || command.equals("report")) { |
There was a problem hiding this comment.
в будущем собираемся добавить еще 10 команд. как поступим с текущим подходом?
|
| } | ||
| } catch (Exception ignore) { | ||
| // не смогли получить git log — возвращаем пустой список | ||
| } catch (GitOperationException e) { |
| } | ||
|
|
||
| /** Даты коммитов в диапазоне, в формате ISO. */ | ||
| public List<String> commitDates(File repoDir, LocalDate from, LocalDate to) { |
There was a problem hiding this comment.
может тогда не лист строк возвращать, а лист дат?
|
|
|
farkhutdinovDmitry
left a comment
There was a problem hiding this comment.
нейминг коммитов по-прежнему бессодержательный, по остальному ок
No description provided.