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

Added Super /Mega Linter #1

Closed
wants to merge 57 commits into from
Closed

Added Super /Mega Linter #1

wants to merge 57 commits into from

Conversation

ScottGibb
Copy link
Collaborator

@ScottGibb ScottGibb commented Nov 20, 2024

Adding Linting to the Project

This PR is focused on adding the following languages checks

  • yaml
  • Rust
  • Markdown

How it does this is up to discussion, currently investigating https://github.com/super-linter/super-linter/tree/v7.2.0.

Linting is currently set to be triggered on pull requests

  • Add Some form of Text Linting (TextLint)

  • Ensure All Markdown Files are being scanned

  • Get Linter Auto PR Fixes operational

  • Transition to using MegaLinter

@ScottGibb ScottGibb marked this pull request as ready for review November 22, 2024 12:28

# Remove this section when Super Linter is updated (https://github.com/dysonltd/tmag5273/issues/3)
Clippy:
name: Clippy
Copy link
Collaborator

@petekubiak petekubiak Nov 22, 2024

Choose a reason for hiding this comment

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

With a little jiggery-pokery it's possible to run clippy on doc examples too

Info can be found here - the bits you need are kind of dotted about but if you think it's worth implementing I've got a working example I was using on one of our other repos

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think this would be good to add. Especially since the Super Linter isnt upgraded yet for the latest rust version (#3). Are you able to share here and il add it in?

ReadMe.md Outdated
optimize throughput and accuracy. A dedicated
INT pin can act as a system interrupt during
low power wake-up and sleep mode, and can also be used by a
microcontroller to trigger a new sensor conversion.An integrated
Copy link
Collaborator

Choose a reason for hiding this comment

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

Missing space after full stop

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

So Super Linter has a natural language linter, I wonder if this will flag these?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ReadMe.md Outdated
integrates three independent Hall-effect sensors in the X, Y, and Z axes. A precision analog signal-chain along with an integrated 12-bit ADC digitizes
integrates three independent Hall-effect sensors in
the X, Y, and Z axes. A precision analog signal-chain
along with an integrated 12-bit ADC digitizes
Copy link
Collaborator

Choose a reason for hiding this comment

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

I appreciate that (presumably) the linter is keeping line lengths reasonably short, but it does make editing a bit of a pain due to having to change where all the newline characters are located.

I'm keen on the one-line-per-sentence approach as markdown renderers will automatically reformat into paragraphs, and this way you don't need to worry about where the line breaks occur. Then in the editor, line wrapping can be used to avoid sentences running off the right of the screen.

Is there a way we could get the linter to do this instead?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Il have a look

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I like the idea of the convention being newline on every sentence, im happy to change that. Im currently experimenting with the markdownlint-cli --fix, this looks promising.

ReadMe.md Outdated
provides full 360° angular position information for both
on-axis and off-axis angle measurement topologies.
The angle calculation is performed using two
user-selected magnetic axes. The device features
magnetic gain and offset correction to mitigate the
impact of system mechanical error sources.The TMAG5273 is offered in four different factory-programmed I2C addresses. The device also supports
additional I2C addresses through the modification
impact of system mechanical error sources.The TMAG5273 is
Copy link
Collaborator

Choose a reason for hiding this comment

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

Missing space after full stop

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

hmmm this is interesting, the markdownlint should of picked up on that

examples/ReadMe.md Outdated Show resolved Hide resolved
examples/ReadMe.md Outdated Show resolved Hide resolved
examples/ReadMe.md Outdated Show resolved Hide resolved
the library should be able to run in `no-std` environment such as baremetal. A
[esp32c3](https://github.com/esp-rs/esp-rust-board)example is shown [here](./esp32-c3/src/main.rs).
Due to it using a baremetal environment its recommended to go to that directory
and call `cargo run` from within it and flash the code on to the device.
Copy link
Collaborator

Choose a reason for hiding this comment

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

There's a lot of "it"s in this sentence, maybe worth rephrasing as a set of instructions?

@ScottGibb
Copy link
Collaborator Author

After some googling and issues with getting the fix_LANGUAGE_x in the SuperLinter configuration to work. Ive shifted my attention over to MegaLinter which may be better maintained. It also has rust support with the most up to date Rust version alongside some other improvements.

Copy link
Contributor

github-actions bot commented Nov 22, 2024

🦙 MegaLinter status: ❌ ERROR

Descriptor Linter Files Fixed Errors Elapsed time
✅ ACTION actionlint 1 0 0.02s
❌ COPYPASTE jscpd yes 7 1.47s
✅ MARKDOWN markdownlint 4 0 0 0.49s
❌ MARKDOWN markdown-link-check 4 1 4.0s
✅ MARKDOWN markdown-table-formatter 4 0 0 0.19s
✅ RUST clippy yes no 22.99s
❌ YAML yamllint 2 30 0.36s

See detailed report in MegaLinter reports
Set VALIDATE_ALL_CODEBASE: true in mega-linter.yml to validate all sources, not only the diff

MegaLinter is graciously provided by OX Security

.cspell.json Outdated
Copy link
Collaborator

Choose a reason for hiding this comment

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

How does this spell check work? I tend to find them to just add noise where code uses nonstandard words and contractions all over the place.

name: Linting

on: # yamllint disable-line rule:truthy
# push: null
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this line required still?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think we will be moving away from this actually after finding MegaLinter
https://megalinter.io/v8/
It handles the analysis slightly differently.

.jscpd.json Outdated
Copy link
Collaborator

Choose a reason for hiding this comment

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

What does this file do?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I believe this one is for the Natural language Check, but will need to check it.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Is it possible to inherit a lint standard for markdown instead of having a long file of custom configuration like this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

So you can run markdownlint with the standard and we would need to apply two settings around line length. This is how it was originally and was in json, but then SuperLinter needed a yaml file as it wasnt reading the json for some reason....

We should be able to solve this by moving to MegaLinter

.textlintrc.json Outdated
Copy link
Collaborator

Choose a reason for hiding this comment

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

Like the spelling config, I'd prefer to limit the number of custom lint config files we need to track across repos as they add visual noise.

examples/README.md Show resolved Hide resolved
@@ -2,14 +2,21 @@

## Summary

This internal crate is a utilities package designed for connecting the Embedded Targets to the Library as such it is not to be used as part of the library.
This internal crate is a utilities package designed for connecting the Embedded
Copy link
Collaborator

Choose a reason for hiding this comment

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

Again I'm not really a fan of line breaks in the middle of sentences because it makes editing a pain. We can have a discussion about this when all three of us are about.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Agreed, i'm not sure how best to handle this. Because we cant break on a sentence end because some sentences go really long.

@ScottGibb ScottGibb self-assigned this Nov 25, 2024
@ScottGibb ScottGibb added the enhancement New feature or request label Nov 25, 2024
@ScottGibb ScottGibb linked an issue Nov 25, 2024 that may be closed by this pull request
ScottGibb added a commit that referenced this pull request Nov 25, 2024
@ScottGibb ScottGibb changed the title Added Super Linter Added Super /Mega Linter Nov 25, 2024
@ScottGibb
Copy link
Collaborator Author

Closing PR to reopen. To continue testing workflow

@ScottGibb ScottGibb closed this Nov 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants