Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Publish generated list of rules on documentation website#261

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
per1234 merged 12 commits intoarduino:mainfromper1234:rule-docs
Aug 26, 2021
Merged

Publish generated list of rules on documentation website#261

per1234 merged 12 commits intoarduino:mainfromper1234:rule-docs
Aug 26, 2021

Conversation

@per1234
Copy link
Contributor

This will provide a convenient reference for information about the rules Arduino Lint applies to projects, including:

  • More verbose description of the rule than would be appropriate for the command line output.
  • Link to the reference information that will allow the reader to fully understand the cause of the rule violation and how to fix it.
  • Table showing the rule violation level (i.e., error/warning/disabled) vs. common tool configuration.

I added a bespoke "Rules > Introduction" page to give some general information about the rule system. , but the "Sketch", "Library", "Platform", and "Package index" pages are all auto-generated from the Arduino Lint source code and will be automatically updated any time rules are added or modified without any additional effort.

The rule documentation content is generated by the "ruledocsgen" Go program, which is a separate module, located in its own subfolder of the repository, similar to the standardized "docsgen" program that generates the command line reference. In order for the project infrastructure to support this supplemental module, I synced with the latest versions of the relevant"template" assets, which have had that very capability added since the time of the last sync.

The existing structure and content of the rule configurations was not sufficient for this new usage, so I adjusted and expanded on them:

  • Add dedicated field for reference URLs and add references to rules that did not already have one where appropriate
  • Add or expand the contents of theDescription field.
    • This content is now written in Markdown. Its existing use is limited to the JSON format output. Since the Markdown syntax is very lightweight and intuitive, and any reader of the JSON format output will already have been presented with plenty of syntax, I don't think the change has a harmful effect on that output.

Demo:https://per1234.github.io/arduino-lint/dev/rules/

Resolves#158

In order to catch platform-specific bugs, the "Test Go" workflow uses a job matrix to run the tests on multiple runners.The step that uploads code coverage data to Codecov is intended to run only during the Linux job. The runner name`ubuntu-latest` was used in the conditional to accomplish this. However, it might become necessary or desirable to pin aspecific runner version (e.g., `ubuntu-18.04`). The accompanying adjustment to the conditional might be forgotten andthere would not be any obvious sign that the coverage upload had stopped, nor why.This will be avoided by using the general `runner.os` context item to identify the Linux job in the conditional. Thiswill not be ideal in the event multiple Linux runners are added to the workflow's job matrix, but this is less likely tooccur and a redundant coverage data upload shouldn't cause any problems.
This projects contains two Go modules, one in the root and one in the `docsgen` subfolder. More will be added. In orderto support checks on the supplemental modules in the project subfolders, it's necessary to configure the commands to runfrom their path. This is passed to the task via the GO_MODULE_PATH environment variable. If this variable is not defined,the default root module path is used as default, preserving the previous task behavior.The workflows use a job matrix to allow easy configuration for any number of module paths and a dedicated parallel jobfor each module.
Many of the rule messages contain a URL that can be visited to find the detailed information about the problem and howto fix it.Moving this information to a dedicated field in the struct allows for improved formatting of the rule output as well asenhanced capabilities for the use of this data in other applications.
Some of the content has been moved to a new URL. Although the visitor was redirected to the new location, meaning theywere not exactly broken, it is better to send them to the right location from the start.
@per1234per1234 added topic: documentationRelated to documentation for the project type: enhancementProposed improvement topic: infrastructureRelated to project infrastructure topic: codeRelated to content of the project itself labelsAug 25, 2021
@silvanocerza
Copy link
Contributor

What is the purpose of theFoo/Foo.ino file? 🤔

These will make it easy for users to find information about the problem that caused the rule violation, and how to solveit.
@per1234
Copy link
ContributorAuthor

What is the purpose of the Foo/Foo.ino file?

No purpose whatsoever, it was an artifact from an experiment I accidentally committed to the repository. I have now removed it:
https://github.com/arduino/arduino-lint/compare/96310248eb0bc5d47e70e1e34cd4c405a31aaeae..7be0eb83432d5685e1f5e8df4a44c04f7d2fb63f
Thanks for catching that!

silvanocerza reacted with thumbs up emoji

The `Description` field of the rule configuration was previously only used to add supplemental information to the verbosetool output. In this usage, it did not need to stand on its own as a complete documentation of the rule, and also was nota high priority since the verbose output is likely not as frequently used.A new requirement for the rule configuration data has emerged from the project to publish a list of rules. The`MessageTemplate` data is not suitable for use in this application due to being written for use in indicating a problemthat was found, rather than a documentation of the rule. The new requirement is compatible with the existing use of the`Description` field, so it is not necessary to add a new field. However, the existing content of the `Description fieldis mostly not inadequate, so it must be expanded.This content is now written in Markdown. Its existing use is limited to the JSON format output. Since the Markdown syntaxis very lightweight and intuitive, and any reader of the JSON format output will already have been presented with plentyof syntax, I don't think the change has a harmful effect on that output.
The tool output and rules list assume that the text in the required rule configuration fields is present. In cases whereit is left empty, this assumption might result in strange or misformatted output. At the moment they are all populated,so that assumption is fine. In the event the test catches an empty field, it can either be fixed or the code changed tonot rely on that field being populated.
This will provide a convenient reference for information about the rules Arduino Lint applies to projects.- More verbose description of the rule than would be appropriate for the command line output.- Link to the reference information that will allow the reader to fully understand the cause of the rule violation and  how to fix it.- Table showing the rule violation level (i.e., error/warning/disabled) vs. common tool configuration.I added a bespoke "Rules > Introduction" page to give some general information about the rule system. , but the "Sketch","Library", "Platform", and "Package index" pages are all auto-generated from the Arduino Lint source code and will beautomatically updated any time rules are added or modified without any additional effort.The rule documentation content is generated by the "ruledocsgen" Go program, which is a separate module, located in itsown subfolder of the repository, similar to the standardized "docsgen" program that generates the command line reference.
…iptionsSome of the rules must refer to data paths in configuration files such as the package index. In the case of arrays, it isnecessary to indicate that the reference applies to an arbitrary element. Prefiously, the `[]` syntax was used for thispurpose (e.g., `packages[].tools[]`). It is now changed to using `[*]` (e.g., `packages[*].tools[*]`).
The primary purpose of text of the rule configuration's `Description` field is for display in the rule reference sectionof the documentation website. For this reason, it is written in Markdown, and thus can be output as is.The situation is different with the rule configuration's `Brief` field, since it is displayed prominently in the tooloutput. For this reason, the use of Markdown would not be appropriate. This text may contain incidental markup charactersthat would result in unwanted formatting and thus the `Brief` field text must be escaped for display on the website.
…nnerThere is a convention of configuring Arduino boards platforms to provide a user interface for configuring the buildprocess through the addition of references and fallback empty definitions of a series of properties that follow theformat of `compiler.<pattern type>.extra_flags`, where "<pattern type>" corresponds to the compilation pattern thatreferences them:- `c`- `cpp`- `S`- `ar`- `c.elf`Previously, `x` was used as a placeholder for the component of the property name that varies in order to allow a singlerule to refer to the entire set. "<pattern type>" is a little bit more clear than "x".
…rule messagesFeedback was provided that the previous "additional" term was not very clear. "Unrecognized" was determined to be better.
@codecov-commenter
Copy link

codecov-commenter commentedAug 26, 2021
edited by codecovbot
Loading

Codecov Report

❌ Patch coverage is84.24242% with26 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.69%. Comparing base (1af853e) to head (ff3b56a).
⚠️ Report is 1447 commits behind head on main.

Files with missing linesPatch %Lines
ruledocsgen/main.go83.95%17 Missing and 9 partials⚠️
Additional details and impacted files
@@            Coverage Diff             @@##             main     #261      +/-   ##==========================================- Coverage   89.83%   89.69%   -0.15%==========================================  Files          43       44       +1       Lines        6327     6492     +165     ==========================================+ Hits         5684     5823     +139- Misses        531      548      +17- Partials      112      121       +9
FlagCoverage Δ
unit89.69% <84.24%> (-0.15%)⬇️

Flags with carried forward coverage won't be shown.Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report?Share it here.

🚀 New features to boost your workflow:
  • ❄️Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@per1234
Copy link
ContributorAuthor

Hi@silvanocerza. I sent you another review request because I had to make a code change to this PR. There is a pretty significant diff for the full force push:
https://github.com/arduino/arduino-lint/compare/c6e7e9360a0ce836414081a4598f4d3ccb306215..ff3b56ae71ba98c39c44ccf3bd1f1dffdc2f0618
but this is because it is making all the improvements that resulted from@ubidefeo's excellent review of the content.

The code changes of interest are to escape the rule "brief" text to make it suitable for inclusion in the Markdown source documents the website is generated from:
f62a372

silvanocerza reacted with thumbs up emoji

Copy link
Contributor

@ubidefeoubidefeo left a comment

Choose a reason for hiding this comment

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

Went through all the agreed upon changes to this and found everything properly adjusted.
Fantastic job

@per1234per1234 merged commitf2a37a7 intoarduino:mainAug 26, 2021
@per1234per1234 deleted the rule-docs branchAugust 26, 2021 22:30
@per1234per1234 self-assigned thisNov 20, 2021
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@ubidefeoubidefeoubidefeo approved these changes

+1 more reviewer

@silvanocerzasilvanocerzasilvanocerza approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

@per1234per1234

Labels

topic: codeRelated to content of the project itselftopic: documentationRelated to documentation for the projecttopic: infrastructureRelated to project infrastructuretype: enhancementProposed improvement

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Where can I find the list of rules?

4 participants

@per1234@silvanocerza@codecov-commenter@ubidefeo

[8]ページ先頭

©2009-2025 Movatter.jp