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

EditorConfig file added and documented #203

Open
wants to merge 7 commits into
base: pages-source
Choose a base branch
from

Conversation

frobijn
Copy link
Contributor

@frobijn frobijn commented Jul 20, 2024

Description

Added documentation about the .editorconfig file. Another pull request will be made for the nanoff repository.

As PoC this is being applied to SNTP class library. Upon succesfull testing we'll move to the other repos as well.
Adding the PR here for reference nanoframework/nanoFramework.Networking.Sntp#134

Motivation and Context

Apparently the nanoFramework uses an appalling coding style as it is different from mine :-) The documentation describes that there is a vssettings file that contains the coding style. As a potential contributor I'm not prepared to modify the Visual Studio settings and to turn off automatic formatting. Fortunately there is a much better way to share these settings, at least for C# - Visual Studio supports adding the settings to an EditorConfig file.

It is possible to generate an EditorConfig file from the Visual Studio settings. As I don't have the correct settings, I've just added some of the formatting and naming rules. If I start contributing to the nanoFramework code, an EditorConfig file will also be added if it is not already present.

Perhaps one of the team members could generate a more complete version and add it to the repositories and documentation?

Types of changes

  • Improvement (correction, content improvement, typo fix, formatting)
  • New Article (new document for docs website)
  • Config and build (change in the configuration and build system, has no impact on code or features)

Checklist:

  • My doc follows the code style of this project.
  • I have read the CONTRIBUTING document.

Copy link

coderabbitai bot commented Jul 20, 2024

Important

Review skipped

Auto reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@josesimoes
Copy link
Member

@frobijn
Copy link
Contributor Author

frobijn commented Jul 26, 2024

I've updated the documentation page. I've also added a .editorconfig with only spell checker configuration, so the spell checker can be used for the markdown pages.

Copy link
Member

@Ellerbach Ellerbach left a comment

Choose a reason for hiding this comment

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

All up, looks good. @josesimoes if you can check if that works fine all up for SNTP, I'm pretty much in favor of having this available in the various repos.
@frobijn one of the challenge is going to be the complex https://github.com/nanoframework/nanoFramework.IoT.Device repository!

@frobijn
Copy link
Contributor Author

frobijn commented Jul 31, 2024

That is not a repository that's on my list to look closely at. But be assured, there are many ways to get it to work. Two hints:

  • having a modified .editorconfig in a subdirectory, in case the main one would make a mess out of the projects. That .editorconfig can be a complete version or one with only overrides

  • it is possible to suppress errors/warnings/messages from an .editorconfig, in addition to globalsuppressions.cs and #pragma disable

@@ -6,7 +6,7 @@ The general rule we follow is "use Visual Studio defaults". For details check th

1. We use [Allman style](https://en.wikipedia.org/wiki/Indent_style#Allman_style) braces, where each brace begins on a new line. Even a single line statement block should go with braces and nested in other statement blocks that use braces.
2. We use four spaces of indentation (no tabs).
3. We use `_camelCase` for internal and private fields and use `readonly` where possible. Prefix static fields can be used with `s_` and thread static fields with `t_`. When used on static fields, `readonly` should come after `static` (i.e. `static readonly` not `readonly static`).
3. We use `_camelCase` for internal and private fields and use `readonly` where possible. Prefix static fields with `s_` and thread static fields with `t_`. When used on static fields, `readonly` should come after `static` (i.e. `static readonly` not `readonly static`).
Copy link
Member

Choose a reason for hiding this comment

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

we don't reinforce the s_ and t_. IT's just a recommendation. But we do reinforce the _

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In dotnet's .editorconfig there is a rule that checks for this. You'll get a message that says "naming rule violation". As a simple contributor I would read that as a "must".

Also: see nanoframework/nanoFramework.Networking.Sntp#134 about this. I'm confused what is expected of me. I think if you produce a message about it, then it is part of the coding style.

Leniency is another question: how much can you deviate from the coding style? That is: when will your contribution be rejected because you first need to clean up the code. I guess if only the "s_" are missing, the contribution is accepted. But there may also be other violations that are acceptable...

Copy link
Member

Choose a reason for hiding this comment

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

For automated checks we have to choose one or the other. I'm afraid we can't have recommendations...
If we are stating that we are following .NET code style (which we aim to) then let's play ball and have those s_ prefixes.
No harm with that, it's just a convention.

Now, we will have extra work to "fix" these as we add the rules to the class repos and update the native code. But that's life. 😅

Copy link
Member

Choose a reason for hiding this comment

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

As for the contribution being accepted or not, considering that we'll have the editorconfig and will enable the check during the build in the pipeline, I suppose that makes it quite clear.

There is always a human reviewing the PRs and we try to be very friendly with the review comments. So not much to worry about.

For existing code, there will an extra step as we add the rules to the repos which will be making sure the code is compliant and make the necessary fixes.

@frobijn frobijn requested a review from Ellerbach August 1, 2024 15:09
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.

4 participants