Standards Checklists and Best Practices - amitbhilagude/userfullinks GitHub Wiki
Architectural Principles: Set some team-level architectural principal while designing any solution e.g. as below.
Design for Simplicity
Simple solutions avoid lot much complexity for better maintainable solutions e.g. Polling mechanism over Signal R
Build for Flexibility
Build solutions that can extend easily with future requirements
Loose Coupling
Decouple architecture which will help to reduce dependency.
Focus on Core IP over generic functionality
Focus on building business uses cases instead of building a generic framework e.g. Logging as it will be readily available as open source.
Prefer PaaS based Solution
Azure First
Design for multi-tenancy
Will help to isolate workload and solve the noisy neighbor problem
"Just Enough" Architecture
Build architecture that will give clear boundaries and guidance to the team and start building the solutions.
9 Documentation is Key
Document all solutions, design decisions, and reasons for change for future reference.
Code Quality Analysis
Sonarqube will be used for Code Quality Analysis
Sonarqube support many languages for code quality analysis. You can enable it based on the requirement e.g. C#, Javascript
Quality Profile. You can define set of standard rule for each Quality profile.
Bug: Code that passes compilation but may cause issues at runtime
E.g. "=+" should not be used instead of "+=". Sonarqube will raise an issue when there is space between two operators
CodeSmell: Code that may cause maintainability issues, go against coding standards or may be difficult to understand
E.g. "async" and "await" should not be used as identifiers to avoid any confusion.
Vulnerability: Code that may cause security Vulnerability.
"HttpOnly" should be set on cookies. The HttpOnly cookie attribute tells the browser to prevent client-side scripts from reading cookies with the attribute, and its use can go a long way to defending against Cross-Site Scripting (XSS) attacks. Thus, as a precaution, the attribute should be set by default on all cookies set server-side, such as session-id cookies.
Security hotspot: Code that is sensitive from a security perspective as it may introduce vulnerabilities depending on the context and usage.
E.g. Username and password hard-coded in a code
Azure DevOps Integration
Service Connection
Use of DevOps Tasks in Build Pipeline
Prepare Analysis for Sonarqube: Create Project if not exist
Run Code Analysis
Publish Quality gates
Code Analysis during Development
Sonarlint
Code Review Guidelines
Pull Request Process
Create a Feature branch from the master/main branch which is a short-lived branch.
Push all changes in the feature branch and create a pull request.
Pull Requests should review by at least 2 individuals and pass all quality gates.
Comments should be resolved and let the reviewer close them and approve the pull request.
Best practice is the Use of IAsyncResultFilter middleware to convert Entity Model into Outer Model. Automapper is used in this middleware to map this property.
Dependency Injection
Is the correct Lifetime of dependency Injection registered e.g. Singleton, Scoped, and Transit
nested dependency injection is correct e.g. Scoped referred the Singletone then any impact?
Did you organise dependency correctly? e.g. You may separate out all registration in separate file and dependency injection abstract package
Any advanced DI requirement which is not possible with .net nuget package then use autofac nuget package
Domain Driven Design.
Did we have modelling create to highlight the relationship