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

AttributeError: 'NoneType' object has no attribute 'pos' #518

Open
tdanielsousa opened this issue Oct 31, 2024 · 0 comments
Open

AttributeError: 'NoneType' object has no attribute 'pos' #518

tdanielsousa opened this issue Oct 31, 2024 · 0 comments

Comments

@tdanielsousa
Copy link

Describe the bug
I had a space after the function name before the argument so : function_name (int n), and i had a main commented after the function.
It gave the error that i pasted down below and no more info.
Removing the main fixed this issue, although there was no problem with the main, and that said main was inside /* */ .
I then fixed the function name to function_name(int n) removing the space and the error was gone, even with the same main in place, that single space cause norminette to not work.

Erroneous code

Traceback (most recent call last):
File "/home/tiago/.local/bin/norminette", line 8, in
sys.exit(main())
^^^^^^
File "/home/tiago/.local/share/pipx/venvs/norminette/lib/python3.12/site-packages/norminette/main.py", line 155, in main
registry.run(context, source)
File "/home/tiago/.local/share/pipx/venvs/norminette/lib/python3.12/site-packages/norminette/registry.py", line 61, in run
ret, jump = self.run_rules(context, rule)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/tiago/.local/share/pipx/venvs/norminette/lib/python3.12/site-packages/norminette/registry.py", line 37, in run_rules
self.run_rules(context, rule)
File "/home/tiago/.local/share/pipx/venvs/norminette/lib/python3.12/site-packages/norminette/registry.py", line 29, in run_rules
result = rule.run(context)
^^^^^^^^^^^^^^^^^
File "/home/tiago/.local/share/pipx/venvs/norminette/lib/python3.12/site-packages/norminette/rules/check_func_declaration.py", line 66, in run
context.new_error("NO_SPC_BFR_PAR", context.peek_token(i))
File "/home/tiago/.local/share/pipx/venvs/norminette/lib/python3.12/site-packages/norminette/context.py", line 249, in new_error
pos = tkn.pos
^^^^^^^
AttributeError: 'NoneType' object has no attribute 'pos'

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

No branches or pull requests

1 participant