Skip to content

Commit

Permalink
Try this
Browse files Browse the repository at this point in the history
  • Loading branch information
danielmarbach committed Oct 3, 2024
1 parent 6cdf4f2 commit cf487c0
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions .github/codequality-rules/forbidden-libraries.ql
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
/**
* @name Forbidden test mocking libraries
* @description This query identifies any usage of the forbidden NuGet packages Moq and FakeItEasy by checking imports.
* @description Prevents the use of FakeItEasy and Moq libraries in the project
* @kind problem
* @problem.severity error
* @precision high
* @id cs/forbidden-mocking-libraries
*/

import csharp
Expand All @@ -11,6 +13,6 @@ predicate isForbiddenLibrary(string name) {
name = "FakeItEasy" or name = "Moq"
}

from ImportDirective import
where isForbiddenLibrary(import.getImportName())
select import, "This project imports a forbidden library: " + import.getImportName()
from NamespaceImport import
where isForbiddenLibrary(import.getImportedNamespace())
select import, "This project imports a forbidden library: " + import.getImportedNamespace()

0 comments on commit cf487c0

Please sign in to comment.