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

Add linting following styleguide #1027

Merged
merged 19 commits into from
Dec 26, 2020
Merged

Conversation

TheTripleV
Copy link
Member

@TheTripleV TheTripleV commented Dec 22, 2020

Adds a linter package that extends doc8 to add tests for conformity to the stricter frc-docs styleguide.

Checks included:

  • CheckFilenames
    • make sure filenames are valid
    • make sure directory names are valid
  • CheckTermSpelling
    • make sure terms are spelled correctly
  • CheckHeadingUnderscores
    • make sure headings are used in the correct order
    • make sure heading underline lengths are correct
  • CheckDoubleNewlines
    • make sure there are no double newlines
  • CheckTrademarks
    • make sure the first instance of some terms are trademarked
  • CheckFIRSTItalicized
    • make sure FIRST is italicized
  • CheckBlankLinkAfterHeader
    • make sure headers are followed by a blank line
  • CheckBlankLinkAfterDirective
    • make sure directives without options are followed by a blank line
  • CheckIndentation
    • make sure indents follow styleguide (todo: add list support done)
  • CheckInteriorSpaces
    • make sure sentences only have 1 space separating them
  • CheckImageAlt
    • make sure all images have alt text
  • CheckSingleLineParagraph
    • make sure all paragraphs are on a single line

Testing

I wrote all the boilerplate required for testing.
Tests are welcome.

Future

This linter finds many issues in frc-docs. They should go in a separate PR once this one is finalized to reduce clutter.

@TheTripleV
Copy link
Member Author

The styleguide needs to be excluded as it explicitly does not follow the styleguide.

@Daltz333 Daltz333 linked an issue Dec 22, 2020 that may be closed by this pull request
@Daltz333 Daltz333 added the Extension Needs an extension created/added label Dec 22, 2020
@TheTripleV
Copy link
Member Author

linter reports 3482 errors.

@TheTripleV TheTripleV marked this pull request as ready for review December 22, 2020 21:26
@Daltz333
Copy link
Member

For right now, can it be added to run as diffs that way we can slowly migrate as things get updated.

@TheTripleV
Copy link
Member Author

I think that should do it?

@sciencewhiz
Copy link
Collaborator

Does this exclude code?

@TheTripleV
Copy link
Member Author

doc8 uses docutils directly so deleting code files shouldn't matter. Just in case, I changed it to only delete rst files.

@sciencewhiz
Copy link
Collaborator

I meant, for example, if a there's two consecutive new lines within a .. code:: directive, would this flag it?

@TheTripleV
Copy link
Member Author

code directives are excluded from all checks except for the two consecutive lines test.

I had accounted for code-blocks and code-tabs but forgot about regular old code. I fixed that now.

@sciencewhiz
Copy link
Collaborator

Is there a way to disable a specific linter for a block?

@TheTripleV
Copy link
Member Author

If you're asking if there are pre-processor flags of sort that allow users to disable linting for blocks, then no.

I think that any excluded blocks should be hardcoded into the checks.

@TheTripleV
Copy link
Member Author

Removed the linter source and updated ci to use ohnoyoudidnt

@Daltz333 Daltz333 linked an issue Dec 26, 2020 that may be closed by this pull request
@Daltz333 Daltz333 merged commit 42c3326 into wpilibsuite:master Dec 26, 2020
Daltz333 added a commit that referenced this pull request Dec 26, 2020
AustinShalit pushed a commit that referenced this pull request Dec 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Extension Needs an extension created/added
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Correct FRC acronym branding Fork the doc8 extension
3 participants