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

Rule #17

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open

Rule #17

wants to merge 10 commits into from

Conversation

jcdkiki
Copy link
Collaborator

@jcdkiki jcdkiki commented Jan 1, 2024

TooComplexCondition.

Реализация этого критерия.

Подсчитывает количество логических бинарных операций в условии. Если их количество превышает некоторую константу, значит автору кода стоит это исправить. Возможно, этот критерий должен подсчитывать нечто иное, а не количечтво логических логических бинарных операций. ???? \_/(0_0)\_/

К слову, вся система постепенно создает проблемы. Для добавления новых критериев придется каждый раз редактировать CMakeLists.txt, tester.py и бог знает что еще.

У меня есть идеи, как это решить, но они, похоже, подождут разрешения вопроса с предыдущим PR (ветка new).

Copy link

@mirrin00 mirrin00 left a comment

Choose a reason for hiding this comment

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

Возможно, этот критерий должен подсчитывать нечто иное, а не количечтво логических логических бинарных операций

Думаю, пока сойдёт количество бинарных операций

К слову, вся система постепенно создает проблемы. Для добавления новых критериев придется каждый раз редактировать CMakeLists.txt, tester.py и бог знает что еще.

CMakeLists.txt всё равно придётся редактировать, wildcards не очень признаны, поэтому нужно каждый файлик осмысленно добавить в сборку. tester.py переродиться во что-нибудь другое (я так думаю), поэтому с ним проблема уйдёт

Comment on lines 25 to 27
for (Stmt::child_iterator child = stmt->child_begin(); child != stmt->child_end(); child++) {
result += getStmtComplexity(*child);
}

Choose a reason for hiding this comment

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

  1. Заменить на использование цикла for each
  2. Желательно заменить рекурсию на цикл

Comment on lines 7 to 9
using namespace std;
using namespace clang;
using namespace oclint;

Choose a reason for hiding this comment

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

Исправить аналогично #9

Comment on lines 69 to 75
.. code-block:: cpp

void example()
{
// TODO: modify the example for this rule.
}
)rst";

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.

None yet

2 participants