Repository: wemake-services/wemake-python-styleguide

Issue:
Constant condition is not detected when used with `and` or `or`
This code does not raise:

```python
if some or True: ...
```

This one raises:

```python
if True: ...
```

```
  1:4      WPS314 Found conditional that always evaluates the same
  if True: ...
```

Discussion:
sobolevn: Great work, @novikovfred! 👍 

Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 42e28c13..87a64ed2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -24,6 +24,7 @@ Semantic versioning in our case means:
 - Fixes `BitwiseAndBooleanMixupViolation` work with PEP 604 union types #1884
 - Fixes `CognitiveModuleComplexityViolation` to not trigger
   for a single-item modules
+- Fixes that `ConstantConditionViolation` was not reported for a BoolOp
 
 
 ## 0.15.1
diff --git a/wemake_python_styleguide/visitors/ast/compares.py b/wemake_python_styleguide/visitors/ast/compares.py
index 379387a9..4f84d7cb 100644
--- a/wemake_python_styleguide/visitors/ast/compares.py
+++ b/wemake_python_styleguide/visitors/ast/compares.py
@@ -333,9 +333,13 @@ class WrongConditionalVisitor(BaseNodeVisitor):
         self.generic_visit(node)
 
     def _check_constant_condition(self, node: ast.AST) -> None:
-        real_node = operators.unwrap_unary_node(get_assigned_expr(node))
-        if isinstance(real_node, self._forbidden_nodes):
-            self.add_violation(ConstantConditionViolation(node))
+        if isinstance(node, ast.BoolOp):
+            for condition in node.values:
+                self._check_constant_condition(condition)
+        else:
+            real_node = operators.unwrap_unary_node(get_assigned_expr(node))
+            if isinstance(real_node, self._forbidden_nodes):
+                self.add_violation(ConstantConditionViolation(node))
 
     def _check_simplifiable_if(self, node: ast.If) -> None:
         if not ifs.is_elif(node) and not ifs.root_if(node):


Test patch:
diff --git a/tests/test_visitors/test_ast/test_compares/test_conditionals.py b/tests/test_visitors/test_ast/test_compares/test_conditionals.py
index ea3987b5..8a31d3ed 100644
--- a/tests/test_visitors/test_ast/test_compares/test_conditionals.py
+++ b/tests/test_visitors/test_ast/test_compares/test_conditionals.py
@@ -60,7 +60,7 @@ def container():
     'variable is False',
     '[1, 2, 3].size > 3',
     'variable is None',
-    'variable is int or not None',
+    'variable is int or not some()',
     pytest.param(
         '(unique := some()) is True',
         marks=pytest.mark.skipif(not PY38, reason='walrus appeared in 3.8'),
@@ -107,6 +107,10 @@ def test_valid_conditional(
     '{"set"}',
     '("tuple",)',
     '["list"]',
+    'variable or False',
+    'variable and False',
+    'variable or True',
+    'variable and True',
     pytest.param(
         '(unique := True)',
         marks=pytest.mark.skipif(not PY38, reason='walrus appeared in 3.8'),