[SpecFlow] Feature file code analyzer
Hi.
I'd like to add a code analyzer to my SpecFlow project to analyze feature files for errors, warnings, and suggest code fixes.
For example, I'd like to be able to configure a project to display a build warning or error if a scenario has more than one "Given", "When", or "Then" step.
For example, I would like the following feature file to produce a warning or error:
Scenario: This is a test scenario
Given this is the first step
Given this is the second step
The warning or error should indicate something like "The scenario contains more than one Given, When, or Then step. Scenarios should not have more than one Given, When, or Then step. Use an And step instead."
The Scenario and Background steps should be separated to allow a Given step in both code blocks.
The code analyzer could allow the writer to easily fix the code within the light bulb action menu when integrated with Visual Studio for example, and would allow changing the second "Given" step to an "And" step.
The severity of issues should probably be configurable to allow options like none, suggestion, warning, error in an editorconfig file.
https://docs.microsoft.com/en-us/visualstudio/code-quality/use-roslyn-analyzers?view=vs-2022
I would also like to be able to specify other coding styles for my feature files in editorconfig, and I'm not sure if it's related to code analyzers.
For example, I would like to use spaces instead of tabs in feature files and specify to use 4 spaces for indentation.
There are other formatting (space, indentation, and new line) rules I would like to be applied within feature files, like when using tables.
Thank you.
Please sign in to leave a comment.
Comments
0 comments