Melevir / flake8-cognitive-complexity

An extension for flake8 that validates cognitive functions complexity
MIT License
69 stars 3 forks source link

Plugin is not working on Python <3.7, but this is not mentioned in readme #1

Closed 4ster closed 5 years ago

4ster commented 5 years ago

Python starts from 3.7? Seems, plugin fails on Python 3.6.8 on line: from __future__ import annotations Is it possible to add information about requirements in readme?

/home/andy/PROJECTS/events-registration/.env/bin/flake8 --max-complexity 10 --max-cognitive-complexity=3 /home/andy/PROJECTS/events-registration/backend/backend
Traceback (most recent call last):
  File "/home/andy/PROJECTS/events-registration/.env/lib/python3.6/site-packages/flake8/plugins/manager.py", line 158, in load_plugin
    self._load()
  File "/home/andy/PROJECTS/events-registration/.env/lib/python3.6/site-packages/flake8/plugins/manager.py", line 135, in _load
    self._plugin = self.entry_point.load()
  File "/home/andy/PROJECTS/events-registration/.env/lib/python3.6/site-packages/entrypoints.py", line 82, in load
    mod = import_module(self.module_name)
  File "/home/andy/PROJECTS/events-registration/.env/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 674, in exec_module
  File "<frozen importlib._bootstrap_external>", line 781, in get_code
  File "<frozen importlib._bootstrap_external>", line 741, in source_to_code
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/andy/PROJECTS/events-registration/.env/lib/python3.6/site-packages/flake8_cognitive_complexity/checker.py", line 1
    from __future__ import annotations
    ^
SyntaxError: future feature annotations is not defined

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/andy/PROJECTS/events-registration/.env/bin/flake8", line 8, in <module>
    sys.exit(main())
  File "/home/andy/PROJECTS/events-registration/.env/lib/python3.6/site-packages/flake8/main/cli.py", line 18, in main
    app.run(argv)
  File "/home/andy/PROJECTS/events-registration/.env/lib/python3.6/site-packages/flake8/main/application.py", line 393, in run
    self._run(argv)
  File "/home/andy/PROJECTS/events-registration/.env/lib/python3.6/site-packages/flake8/main/application.py", line 380, in _run
    self.initialize(argv)
  File "/home/andy/PROJECTS/events-registration/.env/lib/python3.6/site-packages/flake8/main/application.py", line 363, in initialize
    self.find_plugins()
  File "/home/andy/PROJECTS/events-registration/.env/lib/python3.6/site-packages/flake8/main/application.py", line 199, in find_plugins
    self.check_plugins.load_plugins()
  File "/home/andy/PROJECTS/events-registration/.env/lib/python3.6/site-packages/flake8/plugins/manager.py", line 410, in load_plugins
    plugins = list(self.manager.map(load_plugin))
  File "/home/andy/PROJECTS/events-registration/.env/lib/python3.6/site-packages/flake8/plugins/manager.py", line 297, in map
    yield func(self.plugins[name], *args, **kwargs)
  File "/home/andy/PROJECTS/events-registration/.env/lib/python3.6/site-packages/flake8/plugins/manager.py", line 408, in load_plugin
    return plugin.load_plugin()
  File "/home/andy/PROJECTS/events-registration/.env/lib/python3.6/site-packages/flake8/plugins/manager.py", line 165, in load_plugin
    raise failed_to_load
flake8.exceptions.FailedToLoadPlugin: Flake8 failed to load plugin "CCR" due to future feature annotations is not defined (checker.py, line 1).

Process finished with exit code 1
Melevir commented 5 years ago

Thanks for the report! Version 0.0.2 of the plugin supports python 3.6 + readme has badge about it :)