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

Support excluding single LOC from codacy analysis #187

Open
hanjo2046 opened this issue Mar 3, 2023 · 3 comments
Open

Support excluding single LOC from codacy analysis #187

hanjo2046 opened this issue Mar 3, 2023 · 3 comments

Comments

@hanjo2046
Copy link

Not sure whether it's the right place to report it, I tried below keywords without luck.
// NOSONAR
// eslint-disable-line no-eval

@oscarhermoso
Copy link

@hanjo2046 Did you ever find a solution for this one?

@hanjo2046
Copy link
Author

Hi @oscarhermoso , unfortunately no

@oscarhermoso
Copy link

Only way I could get it working was through the System.Diagnostics.CodeAnalysis attribute SuppressMessage

eg.

// ...
using System.Diagnostics.CodeAnalysis;

[TestFixture]
public class IPAddressTests

        [Test]
        [SuppressMessage("SonarLint", "S1313", Justification = "nonsensitive IP, just a test")]
        public void IsValidIPAddress_ExternalIP_ReturnTrue()
        {
            var ip = "180.151.80.19" // <-- this previously complained

            var result = IsValidIPAddress(ip);

            Assert.IsTrue(result);
        }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants