1
0
Fork 1
mirror of https://github.com/TeamOctolings/Octobot.git synced 2025-01-31 08:51:12 +03:00
Commit graph

3 commits

Author SHA1 Message Date
3134c35751
Ban usages of Thread#Sleep (#243)
Using Thread.Sleep blocks the _entire_ thread from doing *anything*,
while Task.Delay allows the thread to execute other tasks while the
delay is passing. The inability to cancel Thread.Sleep may also cause
longer shutdowns

tl;dr Thread.Sleep bad, Task.Delay good
made because of
578c03871d

Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
2023-12-21 20:21:20 +03:00
31968837e5
Fix JSON corruption when saving (#100)
This PR fixes an issue that caused guild data JSON files to be corrupted
upon saving. As it turns out `File.OpenWrite(string)` does not clear the
file before writing to it. That means, if a file contains `{"MyKey":
"MyValue"}` and I write `{}` to it using `File.OpenWrite(string)`, the
contents of the file will be `{}MyKey": "MyValue"}`. This is a malformed
JSON and will cause an error upon next bot startup.

In addition, this PR blacklists the `File.OpenWrite` method using
`CodeAnalysis/BannedSymbols.txt` to prevent its accidental use in the
future.

Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
2023-08-22 07:46:57 +00:00
397bb83ba8
Add code analysis to prohibit using bad methods and properties (#70)
This PR adds the package `Microsoft.CodeAnalysis.BannedApiAnalyzers` to
scan for banned code (defined by `CodeAnalysis/BannedSymbols.txt`) and
provide warnings if it is used. The list of banned symbols is borrowed
from osu! and other projects

Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
2023-07-24 20:35:45 +03:00