MaibornWolff / metric-gardener

BSD 3-Clause "New" or "Revised" License
5 stars 0 forks source link

`xor` counted for complexity in C++ #267

Closed ResistantBear closed 3 months ago

ResistantBear commented 4 months ago

@mylinhdao In #256 you have mentioned the issue that we currently count xor as logical binary operator in C++. This is an alternative representation for ^ for encodings that do not support the ^character, which still means a bitwise xor (see source here).

Could you take care to bring your test cases for this out of your old branch for #256 to a new branch for this issue here?

@mylinhdao @clemens-mw I have seen that the proposed fix for this was to give binary_expression_xor the "binary_expression" category instead of "logical_binary_expression". As PHP also includes this node and it seems to be a logical operator there, you might use the activated_for field to use it only for PHP. That should be fine as long as we do not need to evaluate the category "binary_expression" for any metric. Assinging "binary_expression" for C++ and "logical_binary_expression" for PHP would require #231 which I do not think should be done before we actually need it.

clemens-mw commented 4 months ago

We should also add a test for PHP xor