Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: improved formatting for C# #724

Merged
merged 12 commits into from
Apr 25, 2022

Conversation

slowikowskiarkadiusz
Copy link
Contributor

Description
In this PR I resolve most issues with formatting of the generated C# code, accordingly to conventions I've observed as a C# programmer. The changes include:

  • Opening bracket at classes/enums definition were at the same line as the class name. Now it's going to be generated in a line below
  • A newline between dependencies (usings) and class definition
  • Provided indentation in appropriate places (i.e. class members were being generated with the same indent as the class declaration)
  • Each member of an enum is now in a separate line (this might seem a bit controversial, since basically neither of C# formatters is going to try to fix enum members that are all in a single line)
  • Inserted/Removed newlines between particular parts of code (members of classes, enums definitions etc)

There might be also other issues than those that remain unresolved, but I think the generated code is going to look much more up to the standard.

No docs changes are required IMO.

Related issue(s)
Just a chore, I don't think it's worth making an issue

@coveralls
Copy link

coveralls commented Apr 20, 2022

Pull Request Test Coverage Report for Build 2211797647

  • 10 of 11 (90.91%) changed or added relevant lines in 4 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.04%) to 92.989%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/generators/csharp/CSharpGenerator.ts 3 4 75.0%
Totals Coverage Status
Change from base Build 2195145254: -0.04%
Covered Lines: 2632
Relevant Lines: 2703

💛 - Coveralls

Copy link
Member

@jonaslagoni jonaslagoni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great 🔥

Had a few comments 🙂

src/generators/csharp/presets/CommonPreset.ts Outdated Show resolved Hide resolved
src/generators/csharp/CSharpGenerator.ts Outdated Show resolved Hide resolved
slowikowskiarkadiusz and others added 2 commits April 23, 2022 02:01
Co-authored-by: Jonas Lagoni <jonas-lt@live.dk>
Co-authored-by: Jonas Lagoni <jonas-lt@live.dk>
@ron-debajyoti
Copy link
Contributor

There are a few failing snapshots @slowikowskiarkadiusz. Would you mind updating them ?

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@slowikowskiarkadiusz
Copy link
Contributor Author

There are a few failing snapshots @slowikowskiarkadiusz. Would you mind updating them ?

Should be in place now :)

Copy link
Member

@jonaslagoni jonaslagoni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

/rtm

@jonaslagoni
Copy link
Member

Gonna use fix: instead as we are changing the formatting that is rendered, and it need a new release 🙂

@jonaslagoni jonaslagoni merged commit 18eed3e into asyncapi:master Apr 25, 2022
@asyncapi-bot
Copy link
Contributor

🎉 This PR is included in version 0.56.4 🎉

The release is available on:

Your semantic-release bot 📦🚀

@asyncapi-bot
Copy link
Contributor

🎉 This PR is included in version 1.0.0-next.23 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants