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

Handle -sonar_ignores attribute declared in erlang code #16

Open
tothlac opened this issue Nov 22, 2020 · 0 comments
Open

Handle -sonar_ignores attribute declared in erlang code #16

tothlac opened this issue Nov 22, 2020 · 0 comments
Labels
enhancement New feature or request

Comments

@tothlac
Copy link

tothlac commented Nov 22, 2020

In some cases it is not easy to translate a not tail recursive function into its tail recursive implementation.
Theoretically it is always possible but sometimes the tail recursive version will be much uglier and longer and even less efficient.
Besides that it is not always a problem to have not tail recursive functions if we know the recursion is not infinite.

For java code it is possible to indicate it in the source code that the given function should not be validated by sonar checks.
https://stackoverflow.com/questions/24058137/sonarqube-suppress-warnings-on-function-level

It would be good to implement something in the erlang plugin which works similarly. People should be able to indicate that the given function/check implemented by the plugin should be suppressed. Something similar like ignore warnings option for dialyzer.

-dialyzer([{nowarn_function, [f/0]}, no_improper_lists]).

For instance:

-sonar_ignores([{no_tail_recursive_call, [f1/0, 
                                          f2/1]},
                {depth_of_cases, [f2/1,
                                  f3/1]},
                {indentation_size, [f2/1]}]).

@DaniruKun DaniruKun added the enhancement New feature or request label Dec 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants