src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Annotations/AnnotationsChecker.py

branch
eric7
changeset 10043
f1427d95cfde
parent 9653
e67609152c5e
child 10046
35b27af462ef
--- a/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Annotations/AnnotationsChecker.py	Fri May 19 16:01:53 2023 +0200
+++ b/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Annotations/AnnotationsChecker.py	Fri May 19 18:08:45 2023 +0200
@@ -185,7 +185,7 @@
     #######################################################################
     ## Annotations
     ##
-    ## adapted from: flake8-annotations v2.9.0
+    ## adapted from: flake8-annotations v2.9.1
     #######################################################################
 
     def __checkFunctionAnnotations(self):
@@ -632,7 +632,7 @@
     #######################################################################
     ## 'from __future__ import annotations' checck
     ##
-    ## adapted from: flake8-future-annotations v0.0.5
+    ## adapted from: flake8-future-annotations v1.1.0
     #######################################################################
 
     def __checkAnnotationsFuture(self):
@@ -645,6 +645,10 @@
             "ForceFutureAnnotations",
             AnnotationsCheckerDefaultArgs["ForceFutureAnnotations"],
         )
+        checkFutureAnnotations = self.__args.get(
+            "CheckFutureAnnotations",
+            AnnotationsCheckerDefaultArgs["CheckFutureAnnotations"],
+        )
 
         visitor = AnnotationsFutureVisitor()
         visitor.visit(self.__tree)
@@ -657,3 +661,7 @@
             self.__error(0, 0, "A871", imports)
         elif forceFutureAnnotations:
             self.__error(0, 0, "A872")
+
+        if checkFutureAnnotations and visitor.hasSimplifiedTypes():
+            simplifiedTypes = ", ".join(sorted(visitor.getSimplifiedTypes()))
+            self.__error(0, 0, "A873", simplifiedTypes)

eric ide

mercurial