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

Модификация диагностики LineLengthDiagnostic #1842

Merged
merged 4 commits into from
Sep 29, 2021

Conversation

theshadowco
Copy link
Member

Описание

Добавил опционную настройку для возможности отключать комментарии-описания методов

Связанные задачи

Closes: #726

Чеклист

Общие

  • Ветка PR обновлена из develop
  • Отладочные, закомментированные и прочие, не имеющие смысла участки кода удалены
  • Изменения покрыты тестами
  • Обязательные действия перед коммитом выполнены (запускал команду gradlew precommit)

Для диагностик

  • Описание диагностики заполнено для обоих языков (присутствуют файлы для обоих языков, для русского заполнено все подробно, перевод на английский можно опустить)

Дополнительно

} else {
var descriptionRanges = documentContext.getSymbolTree().getMethods().stream()
.map(MethodSymbol::getDescription)
.filter(Optional::isPresent)
Copy link
Member

Choose a reason for hiding this comment

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

filter+map на flatMap(Optional::stream)

Copy link
Member Author

Choose a reason for hiding this comment

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

точно!

if (first.getStart().getLine() + 1 > token.getLine()) {
return false;
} else if (first.getEnd().getLine() + 1 < token.getLine()) {
descriptionRanges.remove(first);
Copy link
Member

Choose a reason for hiding this comment

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

интересный подход с рекурсией вместо цикла :)

Copy link
Member

Choose a reason for hiding this comment

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

а коллекция из стрима получается отсортированная? не нужно ли добавить ordered по номеру строки токена?

Copy link
Member Author

Choose a reason for hiding this comment

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

утверждается, что стрим не меняет порядок входных элементов, значит дополнительно упорядочивать не нужно
https://www.baeldung.com/java-stream-ordering

@sonarcloud
Copy link

sonarcloud bot commented Sep 29, 2021

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 2 Code Smells

93.1% 93.1% Coverage
0.0% 0.0% Duplication

@nixel2007 nixel2007 merged commit 6b0d46d into develop Sep 29, 2021
@nixel2007 nixel2007 deleted the feature/modLineLength branch September 29, 2021 21:34
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.

[MOD] LineLength отключить для описаний методов
2 participants