-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- added encoding to md file generation
- added ignoring rules md doc - fixed some typos in readme, and added link to new ignore doc
- Loading branch information
1 parent
4db07ab
commit e1bcbf2
Showing
5 changed files
with
63 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# Ignoring Rules | ||
|
||
Certain rules can be ignored within the T-SQL of the object itself. This is useful for whenever you want a rule to continue to run, but you have valid reasons for ignoring it in certain instances. Not all rules are ignorable. Refer to the documentation to determine which ones are. | ||
|
||
In those cases you can use: | ||
|
||
- IGNORE {RuleId}: Ignores a single occurrence of a rule within the file. Must be placed on, or above the line that violated the rule. | ||
- GLOBAL IGNORE {RuleId}: Ignores all occurrences of that rule within the file. | ||
|
||
Ignores must be done in comment syntax using either of these formats: | ||
|
||
- -- IGNORE {RuleId} | ||
- /* IGNORE {RuleId} */ - This is the preferred syntax as it will not cause sql to be malformed if the line breaks are removed. | ||
|
||
## Examples | ||
|
||
For example, for us to ignore the rule [SRD0032](Design/SRD0032.md) (Avoid use of OR in where clause) we can this several ways. This is a very common rule to have to ignore. | ||
|
||
To ignore just one of the rules: | ||
|
||
```sql | ||
CREATE PROCEDURE dbo.Example AS | ||
BEGIN | ||
SELECT * | ||
FROM dbo.table1 | ||
WHERE id1 = 1 OR id2 = 2 /* IGNORE SRD0032 */ | ||
|
||
|
||
SELECT * | ||
FROM dbo.table2 | ||
WHERE id1 = 1 OR id2 = 2 -- this will still flag as a violation of SRD0032 | ||
END | ||
``` | ||
|
||
Now you could just add ignores for each occasion of this rule violation, but instead you could use a global ignore to ignore all violations of that rule within the stored procedure. | ||
|
||
```sql | ||
CREATE PROCEDURE dbo.Example AS | ||
BEGIN | ||
/* GLOBAL IGNORE SRD0032 */ | ||
SELECT * | ||
FROM dbo.table1 | ||
WHERE id1 = 1 OR id2 = 2 | ||
|
||
|
||
SELECT * | ||
FROM dbo.table2 | ||
WHERE id1 = 1 OR id2 = 2 | ||
END | ||
``` | ||
|
||
## Notes | ||
|
||
If you find that you do not want a rule to ever run, you can simply uncheck it from your list of rules in your project properties instead of adding global ignores everywhere. |
Binary file not shown.