racodond / sonar-gherkin-plugin

SonarQube Cucumber Gherkin Analyzer
GNU Lesser General Public License v3.0
36 stars 21 forks source link

False positive when a variable is used inside a table #54

Closed hindsholm closed 7 years ago

hindsholm commented 7 years ago

This gherkin code

    Scenario Outline: Create banana with 2 different dates, valid combinations of rateDifference
        Given I have a valid "postBananas.json" json body
        And I have 2 identical elements of "interestRateChanges"
        And I set these elements to:
            | "interestRateChanges[0].date"           | "2025-06-10" |
            | "interestRateChanges[1].date"           | "2025-06-15" |
            | "interestRateChanges[0].rateDifference" | <value0>     |
            | "interestRateChanges[1].rateDifference" | <value1>     |
        When a POST is performed on the endpoint "bananas"
        Then the response code is "201"
        And I get the created banana ID
        And I perform a GET on bananas endpoint with the created banana ID
        And the response code is "200"
        And the response body has these elements:
            | "interestRateChanges[0].date"           | "2025-06-10" |
            | "interestRateChanges[1].date"           | "2025-06-15" |
            | "interestRateChanges[0].rateDifference" | <value0>     |
            | "interestRateChanges[1].rateDifference" | <value1>     |
        Examples:
            | value0 | value1 |
            | 492.0  | -0.01  |
            | -0.01  | -0.012 |

gives the error message "Remove the following unused variables: value0, value1" even though the two variables are indeed used inside other tables.

racodond commented 7 years ago

Hi @hindsholm,

Thanks a lot for your feedback! I'll fix this issue in the upcoming version. Cheers,

David