Automated way of checking for snippet code guideline compliance

RESOLVED FIXED

Status

RESOLVED FIXED
4 years ago
4 years ago

People

(Reporter: mkelly, Assigned: koddsson, Mentored)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

4 years ago
There are requirements for snippet code documented at https://abouthome-snippets-service.readthedocs.org/en/latest/developing.html#snippet-requirements. There's also some style guides used across webdev that we like to subscribe to, documented at http://mozweb.readthedocs.org/en/latest/.

It's a PITA to spend time during code reviews bothering with these nits. gvn posted an interesting blog post (https://gist.github.com/gvn/7536832) essentially recommending that you automate these rules rather than making humans check them. I think this is a grand idea, and one that should be investigated!

One possible piece of this could be stylecop, potch's project to easily enforce odd rules against a CSS codebase: https://github.com/potch/stylecop
(Assignee)

Comment 1

4 years ago
Since you linked mozweb read the docs does this mean that we are following PEP8 in snippets?
(Reporter)

Comment 2

4 years ago
(In reply to Kristján Oddsson [:koddsson] from comment #1)
> Since you linked mozweb read the docs does this mean that we are following
> PEP8 in snippets?

Snippets the service, yes, with a few allowances (such as 100-character lines instead of 80 and leniency with how you prefer to format your docstrings). 

But this bug is about snippet code, as in the HTML/CSS/JavaScript in an individual snippet. We often have people external to the team making snippets, and an automated tool would help them.
(Reporter)

Comment 4

4 years ago
Fixed and merged in https://github.com/mozilla/snippets-service/compare/c707e13d6c15...8b4bcb04ad73. Travis should now comment on PRs with linting status. Nice work!
Assignee: nobody → koddsson
Status: NEW → RESOLVED
Last Resolved: 4 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.