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

2 commits

Author SHA1 Message Date
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