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 more checks to dangerfile.js #1553

Closed
3 of 4 tasks
chris48s opened this issue Mar 7, 2018 · 5 comments
Closed
3 of 4 tasks

Add more checks to dangerfile.js #1553

chris48s opened this issue Mar 7, 2018 · 5 comments
Assignees
Labels
developer-experience Dev tooling, test framework, and CI

Comments

@chris48s
Copy link
Member

chris48s commented Mar 7, 2018

A few suggestions for additional checks we might try to add:

  • If PR contains tests using assert, suggest expect syntax.
  • If file contains .expectJsonTypes({ object: "literal" }), suggest .expectJson({ object: "literal" }) instead.
  • If PR modifies a file in /logo, remind the submitter that it should be minified (for bonus points, maybe try to work out if it has been minified - are there any obvious checks we can do here?)
  • If the PR is targeted at a branch other than master, warn reviewers.
    I realise sometimes it makes sense to target another branch e.g: node-8 but this project mostly doesn't use release banches and I think it is worth flagging to the reviewer if someone targets a PR straight at gh-pages, like this: Delete me #1552 as we would probably want to change the target.

If anyone else has thoughts on this based on points that often crop up in review, lets collect them here..

@chris48s chris48s added the developer-experience Dev tooling, test framework, and CI label Mar 7, 2018
@paulmelnikow
Copy link
Member

These all sound great!

(2) would be huge!

For (3), logo minification, we could try running the logo through svgo and seeing if the output is the same. It's possible that would be more simply written as a unit test.

@platan
Copy link
Member

platan commented Oct 5, 2018

Regarding (2)
There are several approaches.

  1. My first thought: add a Danger rule, which operates on a diff content and try to find if there is a problem (e.g. using a regular expression).
  2. Add a Danger rule, which operates on a whole file and use some AST parser to find problem. This gives better results than the regular expression but it would be complicated to find a problem in a diff.
  3. Instead of using Danger (which only informs user that something should be changed) we can use ESLint to not only check code on a developer computer but also automatically fix it (using the --fix ESLint option). Currently there is no such plugin for ESLint, but I would like to create it :-).

What do you think about this?

@chris48s
Copy link
Member Author

chris48s commented Oct 5, 2018

Yeah, although I originally suggested that as a danger rule, it isn't really a good candidate for that type of check because it really requires actually parsing/interpreting the code in order to do it robustly.

Thinking about it as a linting rule (option 3) is a much better way to think about it 👍

@platan
Copy link
Member

platan commented May 1, 2019

After #2687 we have no expectJsonTypes in our code :-)
Do we want to add any other checks? If not, can we close this issue?

@paulmelnikow
Copy link
Member

Closing sounds good to me!

@platan platan closed this as completed May 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
developer-experience Dev tooling, test framework, and CI
Projects
None yet
Development

No branches or pull requests

3 participants