Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Бочаров Александр #185

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

Geratoptus
Copy link

No description provided.

? ReadFromExistingFile(path)
: Result.Fail<List<string>>("No file found");

public abstract Result<List<string>> ReadFromExistingFile(string path);
Copy link

@masssha1308 masssha1308 Jan 7, 2025

Choose a reason for hiding this comment

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

можно сделать protected


namespace TagCloud.WordsReader.Readers;

public abstract class BaseFileReader(string path) : IWordsReader

Choose a reason for hiding this comment

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

Нет необходимости в двух абстракциях (и интерфейс, и абстрактный класс)

@@ -18,7 +19,7 @@ public CsvFileReader(CsvFileReaderSettings settings)
: this(settings.FilePath, settings.Culture)

Choose a reason for hiding this comment

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

Word можно сделать init

public Result<List<string>> ReadWords()
=> File.Exists(path)
? ReadFromExistingFile(path)
: Result.Fail<List<string>>("No file found");
Copy link

@masssha1308 masssha1308 Jan 7, 2025

Choose a reason for hiding this comment

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

В ридерах обрабатывается только 1 одна ошибка (не найден файл), но явно могут возникнуть и другие. Давай их тоже обработаем

@@ -10,8 +11,8 @@ public class CircularCloudLayouter(Point layoutCenter, IPointsGenerator pointsGe
private const string FiniteGeneratorExceptionMessage =

Choose a reason for hiding this comment

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

А почему текст решил вынести в константу? Смущает что текст ошибки только в одном месте константа, во всех остальных нет, хочется придерживаться одного подхода во всей задаче

"./Dictionaries/enUS.aff");
private const string EnglishDic = "./Dictionaries/enUS.dic";
private const string EnglishAff = "./Dictionaries/enUS.aff";
public Result<List<string>> ApplyFilter(List<string> words)

Choose a reason for hiding this comment

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

А почему не IEnumerable? Если сделать IEnumerable, то можно не делать приведения к List как в строке 14

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.

2 participants