A Guide to StyleCI (Extended)

A Guide to StyleCI (Extended)

8eb6f4f9cae1b7969fc3df9d4ccd5dc4?s=128

Graham Campbell

September 19, 2017
Tweet

Transcript

  1. A Guide to

  2. Graham Campbell https://github.com/GrahamCampbell https://twitter.com/GrahamJCampbell https://gjcampbell.co.uk/ Who am I? Disclaimer: The

    views and opinions expressed are my own. StyleCI and Cachet are not associated with the University of York, Cambridge Consultants, or Bugsnag. StyleCI and Cachet are the intellectual property of Alt Three Services Limited.
  3. Who am I? Current: • Student at the University of

    York ◦ BSc Computer Science and Mathematics Graham Campbell https://github.com/GrahamCampbell https://twitter.com/GrahamJCampbell https://gjcampbell.co.uk/ Disclaimer: The views and opinions expressed are my own. StyleCI and Cachet are not associated with the University of York, Cambridge Consultants, or Bugsnag. StyleCI and Cachet are the intellectual property of Alt Three Services Limited.
  4. Current: • Student at the University of York ◦ BSc

    Computer Science and Mathematics • Placement at Cambridge Consultants ◦ Software Technologies, ICE Who am I? Graham Campbell https://github.com/GrahamCampbell https://twitter.com/GrahamJCampbell https://gjcampbell.co.uk/ Disclaimer: The views and opinions expressed are my own. StyleCI and Cachet are not associated with the University of York, Cambridge Consultants, or Bugsnag. StyleCI and Cachet are the intellectual property of Alt Three Services Limited.
  5. Current: • Student at the University of York ◦ BSc

    Computer Science and Mathematics • Placement at Cambridge Consultants ◦ Software Technologies, ICE • Laravel Framework Core Team ◦ Contributing since August 2013 Who am I? Graham Campbell https://github.com/GrahamCampbell https://twitter.com/GrahamJCampbell https://gjcampbell.co.uk/
  6. Current: • Student at the University of York ◦ BSc

    Computer Science and Mathematics • Placement at Cambridge Consultants ◦ Software Technologies, ICE • Laravel Framework Core Team ◦ Contributing since August 2013 • StyleCI Founder and Cachet Core Who am I? Graham Campbell https://github.com/GrahamCampbell https://twitter.com/GrahamJCampbell https://gjcampbell.co.uk/ Disclaimer: The views and opinions expressed are my own. StyleCI and Cachet are not associated with the University of York, Cambridge Consultants, or Bugsnag. StyleCI and Cachet are the intellectual property of Alt Three Services Limited.
  7. Current: • Student at the University of York ◦ BSc

    Computer Science and Mathematics • Placement at Cambridge Consultants ◦ Software Technologies, ICE • Laravel Framework Core Team ◦ Contributing since August 2013 • StyleCI Founder and Cachet Core Previous: • Bugsnag UK Office ◦ Primarily worked on their PHP notifiers Who am I? Graham Campbell https://github.com/GrahamCampbell https://twitter.com/GrahamJCampbell https://gjcampbell.co.uk/ Disclaimer: The views and opinions expressed are my own. StyleCI and Cachet are not associated with the University of York, Cambridge Consultants, or Bugsnag. StyleCI and Cachet are the intellectual property of Alt Three Services Limited.
  8. The Problem Standardizing code style across your workplace or OSS

    can be hard.
  9. The Solution Standardizing code style across your workplace or OSS

    can be hard. December 2014 StyleCI created for my personal OSS projects.
  10. • Easy to get started. ◦ One-click enable from StyleCI.

    ◦ Configure from the browser or a .styleci.yml. The Solution
  11. • Easy to get started. ◦ One-click enable from StyleCI.

    ◦ Configure from the browser or a .styleci.yml. • Hours are saved! ◦ No more code style reviews as part of code reviews. ◦ StyleCI can send fixes as PR on demand. ◦ StyleCI can be configured to do this automatically! ◦ StyleCI can be configured to automatically merge its own PRs. ◦ StyleCI can also be configured to directly commit the fixes! The Solution
  12. Automate code style: Don’t let code style take over your

    code reviews. Image source: https://hscenturion.co.za/site/wp-content/uploads/2017/01/besigheidstudies.jpg.
  13. The Team James Brooks Graham Campbell Joe Cohen

  14. History December 2014 StyleCI created for my personal OSS projects.

    March 2015 Opened to everyone for public repos! July 2015 Launched private repo support and new website. June 2016 Added direct push support. July 2016 New PR analysis system. Q4 2014 Q1 2015 Q2 2015 Q3 2015 Q4 2015 Q1 2016 Q2 2016 Q3 2016 Q4 2016 Q1 2017 Q2 2017 Q3 2017 December 2016 Added Slack notifications.
  15. Image source: https://memegenerator.net/img/instances/500x/61002060/demo-time.jpg.

  16. So, how does all this work?

  17. • StyleCI has to interface with webhooks as well as

    web users. ◦ In fact, 43% of our requests last month were from GitHub webhooks! Architectural Problems
  18. • StyleCI has to interface with webhooks as well as

    web users. ◦ In fact, 43% of our requests last month were from GitHub webhooks! • StyleCI has process commands/events in a good order. ◦ Double hitting repo enables, double hitting plan change forms, lots of commit events. Architectural Problems
  19. • StyleCI has to interface with webhooks as well as

    web users. ◦ In fact, 43% of our requests last month were from GitHub webhooks! • StyleCI has process commands/events in a good order. ◦ Double hitting repo enables, double hitting plan change forms, lots of commit events. • StyleCI has to be correct with it’s fixing. ◦ We don’t want to break people’s code! Architectural Problems
  20. • StyleCI has to interface with webhooks as well as

    web users. ◦ In fact, 43% of our requests last month were from GitHub webhooks! • StyleCI has process commands/events in a good order. ◦ Double hitting repo enables, double hitting plan change forms, lots of commit events. • StyleCI has to be correct with it’s fixing. ◦ We don’t want to break people’s code! • StyleCI has to be high performance. ◦ It has to be able to cope with daily usage. ◦ It has to return the results as fast as possible. Architectural Problems
  21. StyleCI is Built Using Laravel 5! The Laravel Framework and

    the Laravel Trademark is the intellectual property of Taylor Otwell.
  22. HTTP Execution Framework Bootstrap Serve Response Incoming Request HTTP Pipeline

    Laravel’s Request Execution
  23. • TODO TODO Diagram courtesy of blackfire.io.

  24. • TODO TODO Diagram courtesy of blackfire.io.

  25. Diagram courtesy of blackfire.io.

  26. Again, again!

  27. Diagram courtesy of blackfire.io.

  28. Command Bus!

  29. • We have commands and handlers • Some commands are

    async • Commands never return data • Commands may omit events • Commands may throw exceptions Commands
  30. None
  31. None
  32. • We have events and handlers • All handlers are

    synchronous • Some handlers are “crashable” Events
  33. None
  34. None
  35. None
  36. None
  37. Diagram courtesy of bugsnag.com.

  38. The backend...

  39. Diagram courtesy of blackfire.io.

  40. Diagram courtesy of blackfire.io. Diagram courtesy of blackfire.io.

  41. Diagram courtesy of blackfire.io.

  42. Diagram courtesy of blackfire.io.

  43. Diagram courtesy of blackfire.io.

  44. Diagram courtesy of blackfire.io.

  45. Caching

  46. None
  47. None
  48. None
  49. None
  50. None
  51. None
  52. 1.1 Million Analyses Performed! *When I checked last night, this

    figure stood at 1,135,053.
  53. What are you waiting for? Sign up today for free,

    and get unlimited public repos. Paid plans are also available for private repos. https://styleci.io/