38 Commits

Author SHA1 Message Date
Huo Yaoyuan
6ef7d2da48 Put globalconfig into seperated folder and reference explicitly 2024-12-04 19:27:05 +08:00
Huo Yaoyuan
2b68a6a7f3 Remove banned ToUpper and ToLower covered by CA1304 2024-11-27 23:53:16 +08:00
Huo Yaoyuan
a5cf8b6989 Port legacy ruleset into globalconfig 2024-11-27 23:49:42 +08:00
Dean Herbert
b4ed7217c1 Bring back HasFlagsFast
.NET version performs poorly on debug.
2024-08-19 19:40:59 +09:00
Dan Balasescu
b4aa48697d Remove HasFlagFast 2024-07-02 13:26:53 +09:00
Susko3
b620e6fcb7 Move get entry assembly api to RuntimeInfo
A better place for it, as the entry assembly is queried in non-"debug" situations.
2024-01-31 23:55:13 +01:00
Susko3
bad00445dd Add Assembly.GetEntryAssembly() to banned symbols 2023-02-02 22:29:58 +01:00
Salman Ahmed
5009a517c7 Ban char.ToLower()/char.ToUpper() as well for better safety 2022-10-21 23:20:36 +03:00
Bartłomiej Dach
a74798ba30 Disallow usage of string.To{Upper,Lower}() without explicit culture 2022-06-23 11:57:41 +02:00
Dean Herbert
f5c69eabff Ban usage of ManualResetEventSlim.Wait() without a timeout value 2022-06-23 15:26:52 +09:00
Salman Ahmed
dcc29723e4 Correctify recommended method and property 2022-05-18 20:33:20 +03:00
Dean Herbert
2e1beee72d Add bannedsymbols rule 2022-05-18 19:49:14 +09:00
Dean Herbert
6ee82f1c06 Update BannedSymbols to match new naming 2022-01-06 22:55:20 +09:00
Dean Herbert
8379393786 Remove secondary method and rename WaitSafelyForResult to GetResultSafely 2022-01-06 22:50:53 +09:00
Dean Herbert
7f9969da72 Update BannedSymbols in line with new usage
Co-authored-by: Bartłomiej Dach <dach.bartlomiej@gmail.com>
2022-01-06 12:20:45 +09:00
Dean Herbert
78c657de41 Replace all usages of Task.Result with extension method with added safety 2022-01-03 16:57:10 +09:00
Dean Herbert
322e5c9585 Replace all usages of Task.Wait with extension method with added safety
As seen recently, it is quite easy in our semi-`async` world to
accidentally cause a deadlock in the TPL thread pool. The cause of this
is a `.Wait()` or `.Result` from within an already `async` context.

Finding these cases by reading code is quite hard, as they can be nested
multiple calls deep. Likewise, I couldn't find an existing analyser that
finds such cases (and to some it is considered a non-issue as the thread
pool should grow to add new threads when it gets in this state - but for
us this can take too long).

This is a proposal to replace all calls with a custom method with added
safety. Note that this PR will intentionally fail as it points out the
issues that are fixed in https://github.com/ppy/osu-framework/pull/4973.

The rationale for this change was that I couldn't cover all cases in
osu! side `TestMultiplayerClient` by reading the code alone.
2022-01-03 16:47:37 +09:00
Bartłomiej Dach
1fdccce978 Use another workaround for mono/.NET runtime inconsistencies 2021-06-08 23:25:09 +02:00
Dean Herbert
2289274553 Blacklist UriKind.RelativeOrAbsolute 2021-06-03 14:15:06 +09:00
Dean Herbert
36e8c2ef59 Re-enable ConfigureAwait analysis rule 2021-03-06 23:18:48 +09:00
smoogipoo
78b3d08b3c Add Enum.HasFlag to banned APIs 2021-02-25 14:21:43 +09:00
Huo Yaoyuan
b7b25ab0ec CA1715: use prefix for generic parameters. 2019-12-11 19:03:43 +08:00
Huo Yaoyuan
7a7f95583c Don't warn on CA1810. 2019-11-19 18:11:06 +08:00
Huo Yaoyuan
a3c87878cc Revert "CA1806: use discards for ignored returns", but keep the ReSharper config. 2019-11-19 17:56:12 +08:00
Huo Yaoyuan
c6e299672a CA1309: compare strings correctly. 2019-11-18 01:21:15 +08:00
Huo Yaoyuan
3fd1c79946 CA2201: throw correct exception type. 2019-11-18 01:21:11 +08:00
Huo Yaoyuan
14a5e5305a CA1806: use discards for ignored returns. 2019-11-18 01:20:57 +08:00
Huo Yaoyuan
fe52be8735 CA1052: use static class. 2019-11-17 23:54:40 +08:00
Huo Yaoyuan
372a56783a CA1041: provide message for [Obsolete]. 2019-11-17 23:52:43 +08:00
Huo Yaoyuan
c6494225d2 CA2208: create Argument*Exception correctly.
They even don't have agreement on arguments order.
2019-11-17 23:44:35 +08:00
Huo Yaoyuan
d287819863 CA1827 is accidentally disabled. 2019-11-17 23:34:40 +08:00
Huo Yaoyuan
9b7acc8989 CA1820: use string.IsNullOrEmpty. 2019-11-17 23:32:13 +08:00
Huo Yaoyuan
8ceac307f2 CA1401: P/Invoke should not be public. 2019-11-17 23:30:36 +08:00
Huo Yaoyuan
34ec36c2f0 CA1825: use Array.Empty instead of new [0]. 2019-11-17 23:19:31 +08:00
Huo Yaoyuan
4d7a3d3a51 CA1810: don't use static constructor for reference type 2019-11-17 23:16:48 +08:00
Huo Yaoyuan
8060e0cc3a Turn on unrelated rules. 2019-11-17 22:54:04 +08:00
Huo Yaoyuan
33f6be166d Add FxCop with everything turned off. 2019-11-17 22:29:01 +08:00
Huo Yaoyuan
fd0b551a4a Run code analysis on every project. 2019-11-17 22:07:00 +08:00