question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Migrations: Make generated code play well with StyleCop

See original GitHub issue

Steps to reproduce

Add a new migration

The issue

Let me start with saying “Thanks for an awesome project”.

This isn’t a huge problem, but for all of us that uses StyleCop, adding a new migration creates a lot of warnings (and errors for release builds where warnings-as-errors are enabled).

  • Namespaces in Migrations/MyAppDbContextModelSnapshot are not ordered alphabetically.
  • Namespaces in Migrations/20161205224611_MyMigration.cs are not ordered alphabetically.
  • Namespaces in Migrations/20161205224611_MyMigration.Designer.cs are not ordered alphabetically.
  • Access modifier for Migrations/MyAppDbContextModelSnapshot class is implicit.
  • Access modifier for Migrations/20161205224611_MyMigration.Designer.cs class is implicit.

I would be happy to provide a PR to fix this if you think it’s worth doing. Another solution to this would be to add the standard <auto-generated> header to the generated files.

Further technical details

EF Core version: (found in project.json or packages.config) Operating system: Windows 10 Visual Studio version: VS 2015

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
rowanmillercommented, Dec 12, 2016

@patriksvensson we’d love to take a PR on this one. Here is what we think should be done…

  • Add <auto-generated> to the .designer files and to the model snapshot
  • Do the alphabetical sorting of using statements
0reactions
patriksvenssoncommented, Jul 5, 2023

Odd, because it’s not being added to new migrations.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Migrations: Make generated code play well with StyleCop ...
Steps to reproduce Add a new migration The issue Let me start with saying "Thanks for an awesome project". This isn't a huge...
Read more >
How to Set Up StyleCop and Code Analysis on an Assembly
A well defined coding style paired with frequent peer reviews allow team members ... The first thing we need to do is install...
Read more >
Stylecop vs FXcop
StyleCop performs source code analysis is not very configurable. It doesn't really do the same thing as FxCop, which analyzes the compiled code....
Read more >
C# code style - "this." added to member usage even when ...
All my existing code is checked using StyleCop (which got broken with the 2018.1 GA release and was working fine during RC) so...
Read more >
StyleCop Support for F# FAKE - Codit
StyleCop is a tool that analyzes your source files with the default Microsoft coding conventions describing how code should look like. It's not ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found