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

Правило Отключение проверок всего модуля - DisableAllDiagnostics - ГОТОВО #3075

Draft
wants to merge 6 commits into
base: develop
Choose a base branch
from

Conversation

artbear
Copy link
Contributor

@artbear artbear commented Jun 19, 2023

Описание

  • Реализовано правило
  • в класс DiagnosticIgnoranceComputer добавлено вычисление интервалов установки BSLLS-off

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

Closes #3074

Чеклист

Общие

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

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

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

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

@ghost
Copy link

ghost commented Jun 19, 2023

👇 Click on the image for a new way to code review

Review these changes using an interactive CodeSee Map

Legend

CodeSee Map legend

@sonarcloud
Copy link

sonarcloud bot commented Jun 19, 2023

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 0 Code Smells

100.0% 100.0% Coverage
0.0% 0.0% Duplication

@artbear artbear changed the title Правило Отключение проверок всего модуля - DisableAllDiagnostics Правило Отключение проверок всего модуля - DisableAllDiagnostics - ГОТОВО Aug 24, 2023
<!-- Блоки выше заполняются автоматически, не трогать -->
## Описание диагностики
<!-- Описание диагностики заполняется вручную. Необходимо понятным языком описать смысл и схему работу -->
Правило срабатывает на отключение проверки кода всего модуля через специальный комментарий `// BSLLS-off` или `BSLLS-выкл`
Copy link
Member

Choose a reason for hiding this comment

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

Сначала описать проблему и варианты решения, а логику работы описать ниже

@@ -74,6 +76,7 @@ public class DiagnosticIgnoranceComputer implements Computer<DiagnosticIgnorance

private final Map<DiagnosticCode, List<Range<Integer>>> diagnosticIgnorance = new HashMap<>();
private final Map<DiagnosticCode, Deque<Integer>> ignoranceStack = new HashMap<>();
private final List<org.eclipse.lsp4j.Range> ignoreOffList = new ArrayList<>();
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.

@@ -197,6 +198,10 @@ private DiagnosticCode checkIgnoreOff(
Deque<Integer> stack = ignoranceStack.computeIfAbsent(key, s -> new ArrayDeque<>());
stack.push(comment.getLine());

if (ignoreOff.equals(IGNORE_ALL_OFF)){
Copy link
Member

Choose a reason for hiding this comment

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

отформатировать

}

@Test
void testOnAndOff() {
Copy link
Member

Choose a reason for hiding this comment

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

добавить тесты

  • ТОЛЬКО отключение в начале модуля
  • несколько включений \ отлкючений в модуле

@@ -74,6 +76,7 @@ public class DiagnosticIgnoranceComputer implements Computer<DiagnosticIgnorance

private final Map<DiagnosticCode, List<Range<Integer>>> diagnosticIgnorance = new HashMap<>();
private final Map<DiagnosticCode, Deque<Integer>> ignoranceStack = new HashMap<>();
private final List<org.eclipse.lsp4j.Range> ignoreOffList = new ArrayList<>();
Copy link
Member

Choose a reason for hiding this comment

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

Не вижу причин хранить это отдельно. Вся инфа есть в Data классе по ключу DiagnosticCode("all")

@artbear artbear marked this pull request as draft June 4, 2024 09:57
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.

[NEW] Отключение проверок всего модуля - DisableAllDiagnostics
3 participants