rasa lint might be a good idea
See original GitHub issueDescription of Problem: I am playing with rasa, let’s say for the first time. The basics worked and I got a new intent working. This worked fine and now I want to add a form. I change a yml/md file here and there and I get this error:
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File “/Users/vincent/Development/koaning-rasa/venv/bin/rasa”, line 8, in <module> sys.exit(main()) File “/Users/vincent/Development/koaning-rasa/venv/lib/python3.6/site-packages/rasa/main.py”, line 76, in main cmdline_arguments.func(cmdline_arguments) File “/Users/vincent/Development/koaning-rasa/venv/lib/python3.6/site-packages/rasa/cli/interactive.py”, line 60, in interactive zipped_model = train.train(args) File “/Users/vincent/Development/koaning-rasa/venv/lib/python3.6/site-packages/rasa/cli/train.py”, line 75, in train kwargs=extract_additional_arguments(args), File “/Users/vincent/Development/koaning-rasa/venv/lib/python3.6/site-packages/rasa/train.py”, line 40, in train kwargs=kwargs, File “uvloop/loop.pyx”, line 1417, in uvloop.loop.Loop.run_until_complete File “/Users/vincent/Development/koaning-rasa/venv/lib/python3.6/site-packages/rasa/train.py”, line 91, in train_async kwargs, File “/Users/vincent/Development/koaning-rasa/venv/lib/python3.6/site-packages/rasa/train.py”, line 130, in _train_async_internal new_fingerprint = await model.model_fingerprint(file_importer) File “/Users/vincent/Development/koaning-rasa/venv/lib/python3.6/site-packages/rasa/model.py”, line 208, in model_fingerprint stories = await file_importer.get_stories() File “/Users/vincent/Development/koaning-rasa/venv/lib/python3.6/site-packages/rasa/importers/importer.py”, line 261, in get_stories stories = await asyncio.gather(*stories) File “/Users/vincent/Development/koaning-rasa/venv/lib/python3.6/site-packages/rasa/importers/rasa.py”, line 55, in get_stories exclusion_percentage, File “/Users/vincent/Development/koaning-rasa/venv/lib/python3.6/site-packages/rasa/core/training/dsl.py”, line 210, in read_from_files f, domain, interpreter, template_variables, use_e2e File “/Users/vincent/Development/koaning-rasa/venv/lib/python3.6/site-packages/rasa/core/training/dsl.py”, line 238, in read_from_file return await reader.process_lines(lines) File “/Users/vincent/Development/koaning-rasa/venv/lib/python3.6/site-packages/rasa/core/training/dsl.py”, line 346, in process_lines raise ValueError(msg) ValueError: (‘Error in line 12: Invalid to parse arguments in line ' form{“name”: “schedule_form”'. Failed to decode parametersas a json object. Make sure the eventname is followed by a proper json object. Error: Expecting ',' delimiter: line 1 column 25 (char 24)’, “Invalid story file format. Failed to parse ‘/Users/vincent/Development/koaning-rasa/data/stories.md’”)
Five minutes later and I still don’t know what file nlu.md
/stories.md
/domain.yml
I need to edit/fix. Something that could really help here is a command line tool that would lint the files. Probably a good idea to add rasa lint
. This seems to be a package where setting files are central to the functionality, without a linter it can be rather daunting for a newcomer to debug their code.
I’ve tried using this:
rasa data validate
but it yields the same issue.
Overview of the Solution:
Preferably something like;
rasa lint Oddities found:
- domain.yml cannot be parsed -> check line 12
Examples
There’s some other things that could be done in the linter.
rasa lint Oddities found:
- domain.yml cannot be parsed -> check line 12 Un-used intents:
- i_scream is never used
Definition of Done:
As a new user I mainly care about having tools that keep me on the “happy path” even when I make a config typo. At the moment the docs are a bit daunting. A linter tool could help.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:12 (9 by maintainers)
Top GitHub Comments
I think mainly this should be checked before the training, a separate linting command is cherry on top
rasa lint
could also act to sort/dump the config and domain to avoid unnecessary git diffs. We could also create a pre-commit hook to implement this functionality automatically if users opt-in by activating the hook