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

VSG crashes when the package keyword is the first word in the file #1100

Closed
JHertz5 opened this issue Jan 17, 2024 · 1 comment
Closed

VSG crashes when the package keyword is the first word in the file #1100

JHertz5 opened this issue Jan 17, 2024 · 1 comment
Labels

Comments

@JHertz5
Copy link
Contributor

JHertz5 commented Jan 17, 2024

Environment
VHDL Style Guide (VSG) version: 3.20.0.dev5
Git commit SHA: e41bdd8

Describe the bug
The following snippet will cause VSG to fail with a Python error when attempting to fix errors.

package my_package is

end package;

I suspect that this is similar to #1091.

To Reproduce
Steps to reproduce the behavior:

  1. Create a file, test.vhd with the following contents:
package my_package is

end package;
  1. Run vsg -f test.vhd --fix
  2. See the follwing output:
$ ./bin/vsg -f test.vhd --fix
multiprocessing.pool.RemoteTraceback: 
"""
Traceback (most recent call last):
  File "/usr/lib/python3.10/multiprocessing/pool.py", line 125, in worker
    result = (True, func(*args, **kwds))
  File "<path>/bin/../vsg/apply_rules.py", line 125, in apply_rules
    oRules.fix(
  File "<path>/bin/../vsg/rule_list.py", line 160, in fix
    oRule.fix(self.oVhdlFile, dFixOnly)
  File "<path>/bin/../vsg/rule.py", line 106, in fix
    self.analyze(oFile)
  File "<path>/bin/../vsg/rules/align_tokens_in_region_between_tokens_skipping_lines_starting_with_tokens.py", line 65, in analyze
    lToi = oFile.get_tokens_bounded_by(self.left_token, self.right_token, bIncludeTillBeginningOfLine=True)
  File "<path>/bin/../vsg/vhdlFile/vhdlFile.py", line 231, in get_tokens_bounded_by
    return extract.get_tokens_bounded_by(oLeft, oRight, self.lAllObjects, self.oTokenMap, include_trailing_whitespace=include_trailing_whitespace, bExcludeLastToken=bExcludeLastToken, bIncludeTillEndOfLine=bIncludeTillEndOfLine, bIncludeTillBeginningOfLine=bIncludeTillBeginningOfLine)
  File "<path>/bin/../vsg/vhdlFile/extract/get_tokens_bounded_by.py", line 53, in get_tokens_bounded_by
    oStart = lAllObjects[iStart]
IndexError: list index out of range
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "<path>/./bin/vsg", line 15, in <module>
    main()
  File "<path>/bin/../vsg/__main__.py", line 153, in main
    for tResult in pool.imap(f, enumerate(commandLineArguments.filename)):
  File "/usr/lib/python3.10/multiprocessing/pool.py", line 873, in next
    raise value
IndexError: list index out of range
@JHertz5 JHertz5 added the bug label Jan 17, 2024
@JHertz5
Copy link
Contributor Author

JHertz5 commented Jan 17, 2024

This is exactly the same bug as #1091, I just hadn't updated my fork to include that change :( Closing.

@JHertz5 JHertz5 closed this as not planned Won't fix, can't repro, duplicate, stale Jan 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

No branches or pull requests

1 participant