Redsart / TodoApp

This repo is for practice and learning purposes, so please do not submit PRs.
1 stars 1 forks source link

Enforce high code quality #19

Closed kpau closed 4 years ago

kpau commented 5 years ago

Enforce the use of best practices and code standards when developing the app. Read what is static code analysis. Add it to the project. Create a page in the Wiki which will include:

Run the analysis on the project and investigate the errors. Make a list of the types of the errors and post it in this issue as a comment. We will discuss which needs fixing and which can be ignored.

See Overview of code analysis for managed code in Visual Studio for more information.

Redsart commented 4 years ago

25

Redsart commented 4 years ago

https://github.com/Redsart/TodoApp/wiki/Code-quality

kpau commented 4 years ago

There are still several errors coming from the code analyzer:

  1. CA1026: Replase method 'UserInput.' with an overload that supplies all default arguments. The rule applies only to public methods and Microsoft does not recommend to suppress this rule. The UserInput class is used only in the ConsoleApp, so it should not be set as public at first place. Set its Access Modifier to internal. This should resolve the warnings. Reference: Access Modifiers (C# Programming Guide)

  2. CA1704: Correct the spelling of 'Todo'. In our case this is intentionally misspelled. To resolve the warnings create CustomDictionary.xml file and add "Todo" as a Recognied word. See How to Fix Violations for details.

  3. CA2210: Assemblies should have valid strong names. This is advanced topic, but it is recommended for an assembly to be signed with a valid strong name. To resolve this just follow the instructions under How to Fix Violations > To sign your assembly with a strong name in Visual Studio (steps 1-7). Follow these instructions for both projects in the solution. The "Key file name" should be the name of the project: "TodoApp.ConsoleApp" and "TodoApp.Library".

Regarding the wiki page:

Comments on the code will be added in the Pull Request.

kpau commented 4 years ago

The wiki page and the code changes looks good 👍 There are some minor comments in the PR.