Coder Social home page Coder Social logo

laughedelic / scalafmt-probot Goto Github PK

View Code? Open in Web Editor NEW
16.0 7.0 4.0 37 KB

🤖Github bot for checking code formatting with scalafmt

Home Page: https://github.com/apps/scalafmt-probot

License: Mozilla Public License 2.0

Scala 100.00%
probot probot-app github-app github-integration github-bot github-api github-webhooks code-formatter scalafmt formatting

scalafmt-probot's Introduction

Scalafmt probot 🤖

A GitHub App built with Probot and Scala.js that runs Scalafmt on your pull-requests and reports any problems with code formatting using GitHub Checks API.

🚧 WORK IN PROGRESS 🚧

This project is in active development, it's not ready for usage yet.

scalafmt-probot's People

Contributors

laughedelic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

scalafmt-probot's Issues

Take into account excludeFilters/includeFilters

The bot parses .scalafmt.conf, but the check is run on the files contents, so the filters in project.excludeFilters should be applied out to the list of files to check. (also project.includeFilters?)

Actions

Here are some ideas for the possible actions:

  • when there's no .scalafmt.conf, cancel the check and offer an action to add an empty config
  • when the check fails, offer an action to commit fixed formatting
  • fail-fast by default, but offer an action to run the full check with a detailed report (see #1)

I think that interactiveness is great, but I don't like that it forces the user to give write permissions to all repos where they install this app.

Check only changed files

Current simple implementation just lists all files in the repo (at a given commit) and checks their formatting. This may take a long time in big repos. So the plan is to check only the files changed in the PR (i.e. assuming that master stays well-formatted).

Fail-fast behaviour vs. detailed reports

On one hand Checks API provides some means to make detailed reports with comments on particular lines of sources. So when the formatting check fails, it could generate a diff and comment on the pieces of the mis-formatted code.

On the other hand I personally don't see much value in such detailed reports. I would prefer the check to fail on the first mis-formatted file and report immediately, so that the feedback would be quick. I think that in most cases you don't care what exactly was mis-formatted, you just forgot to do it and as soon as you got this reminder on GitHub, you can just run scalafmt locally (in whatever preferred way) and fix it.

It could be a configuration option, but I would like to avoid a bot-specific configuration and even if there was one, I want to choose a sensible default.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.