Skip to content

Latest commit

 

History

History
37 lines (30 loc) · 2.44 KB

CONTRIBUTING.md

File metadata and controls

37 lines (30 loc) · 2.44 KB

Development

The two main ways to work with CSharpier locally are the playground or with formatting tests.

Using the playground

From your IDE run the following in the /CSharpier/CSharpier.Playground directory

dotnet watch run
  • This should open the playground website at http://localhost:7000
  • Paste the code you want to format there and click format.
  • The playground includes options to view the AST and generated doc tree, which help troubleshooting issues.

Formatting Tests

The main way CSharpier is tested is with the files at src/CSharpier.Tests/FormattingTests/TestFiles. Any changes to formatting should include appropriate test coverage using these files.

A source generator is used to generate an nunit test for each file. That test

  • Uses CSharpier to format each [FileName].cst to a new file [FileName].actual.cst
  • If a file [FileName].expected.cst exists, it is compared to [FileName].actual.cst instead
  • If the files differ, a diff tool will automatically open to allow you to compare the files.

Other Tests

Most areas of CSharpier are covered by tests. Some to take note of

  • /Scripts/TestCli.ps1 - Full end to end style tests, only used for cases that can't be covered another way.
  • /Src/CSharpier.Tests/CommandLineFormatterTests - Integration tests that are close to end to end.
  • /Src/CSharpier.Tests/DocPrinterTests - used to test the doc types directly. Can be useful to understand how the different doc types work.
  • /Scripts/CreateTestingPR.ps1 - used to test the formatting changes in your branch against a large repo. Useful for finding edge cases you may have missed. (this script may require changes to work correctly)

Helpful Information

Issues

If you plan to contribute by working on an issue, you can assign it to yourself by adding a comment .assign