Skip to content

Conversation

@cripson1994
Copy link
Owner

No description provided.

Copy link

@yurii-litvinov yurii-litvinov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • файлы .class и другие продукты сборки не надо выкладывать в систему контроля версий
  • нужна ещё диаграмма и текст про архитектуру
    С функциональной точки зрения всё зашибись, но с кодом какая-то беда. Поправьте, пожалуйста :)


/**
* Добавляет переменную в окружение
* @param key - имя переменной

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Дефисы лучше не писать, JavaDoc сам их генерит (а так сгенерит два, думая, что дефис --- часть комментария)

* @return - значение переменной
*/
public static String get(String key) {
if(table.containsKey(key)) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

По стайлгайду положен пробел перед (

@@ -0,0 +1,37 @@
package environment;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Имя пакета неканоничноъ. https://docs.oracle.com/javase/tutorial/java/package/namingpkgs.html

}

public Cat() {
this.args = null;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

По идее, он и так null, Java-машина гарантирует инициализацию всех полей нулями

/**
* Класс-обёртка команды cat
*/
public class Cat extends CommandInterface{

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

По стайлгайду положен пробел перед {

@@ -0,0 +1,66 @@
package prepair;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prepair --- это нечто среднее между prepare и repair? :)

/**
* Класс для интерполяции строк
*/
public class Interpol {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Лучше не сокращать имена.

outContent.reset();
t = m.getPrintThread();
t.join(mills);
assertEquals("1\n2 3\n4 5 6\n", outContent.toString());

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Лучше разделить эти тест кейсы на несколько тестов. Принцип независимости тестов же.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Напоминаю :)


@DisplayName("test cat")
@Test
void test2() throws BadQuotesException, IOException, InterruptedException {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

System.setErr(System.err);
}

public void runManeger(String input) throws BadQuotesException, IOException {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Даже в именах очень много опечаток. Большая часть кода, наверное, была написана поздно ночью :)

Copy link

@yurii-litvinov yurii-litvinov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ещё нужно было краткое обоснование выброа библиотеки для разбора параметров, в виде текста где-нибудь в корневой папке проекта


import static org.junit.jupiter.api.Assertions.*;

class GrepTest extends TestCommand{

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Пробела перед { не хватает :)

"from (\n" +
" select GENERATE_SERIES \n" +
" from GENERATE_SERIES('2012-08-01'::date,'2012-08-31','1 day')) d\n", outContent.toString());
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Каждый тестовый сценарий идеологически должен быть в отдельном тесте. Чтобы если один тест не прошёл, то сразы было бы видно, что именно не так.

/**
* Препроцессинг, инициализурующий функцианальные поля grep для различных ключей
* @throws ParseException
* @throws NumberFormatException

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Тут тоже неплохо бы комментарии

errOutput.write(errBuilder.toString().getBytes());
errOutput.flush();
output.close();
} catch (IOException e) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

И тут тоже проглатывать исключения нехорошо


}

private void evalGrep (String[] args, PipedOutputStream output, PipedInputStream input, PipedOutputStream errOutput) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Пробел перед "(" после имени функции не ставится

} else if (counter <= lineCount) {
output.write((prefix + line + "\n").getBytes());
}
counter ++;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А вот унарные операторы обычно не отделяются, правильнее counter++;

private void printHelp (PipedOutputStream errOutput) {
StringWriter out = new StringWriter();
PrintWriter writer = new PrintWriter(out);
helpFormatter.printHelp(writer,80,"grep",null,posixOptions,1,4,null,true);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А после запятых пробелы нужны

Copy link

@yurii-litvinov yurii-litvinov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good enough. CLI и grep зачтены

@@ -0,0 +1 @@
Ответ очень прост: когда-то давно я уже пользовался этой библиотекой и поэтому знаю что к чему в ней. А новую изучать не вижу смысла, если и эта хорошо себя показывает. No newline at end of file

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Золотой Молоток". Примерно как "почему я программирую на Java? Потому что я всю жизнь программировал на Java, и отец мой программировал на Java, и дед мой программировал на Java, и никогда с ней проблем не было" :)

outContent.reset();
t = m.getPrintThread();
t.join(mills);
assertEquals("1\n2 3\n4 5 6\n", outContent.toString());

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Напоминаю :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants